How sreeharipremkumar/structure-from-motion works
Project type and purpose
• This is a C++ command‑line application for Structure‑From‑Motion (SfM), as indicated by the project name and presence of main.cpp, CMakeLists.txt, and an OpenCVSFM executable in the build directory.
• Its purpose is to take a set of images (e.g., in templeRing/) and compute camera poses and a sparse 3D point cloud.
File structure
• Top‑level:
• CMakeLists.txt – build configuration
• main.cpp – entry point
• templeRing/ – sample dataset (images and parameter files)
• build/ – generated build artifacts, Visual Studio projects, executable
• .vscode/ – editor settings
• No obvious “frontend” vs “backend” split; it’s a single native binary with modular SFM stages.
• Dependencies are managed via CMake and link against OpenCV (SFM module).
Insights from README
• Minimal; confirms this is Structure‑From‑Motion.
Main components
a. Input Module
• Image Loader (reads templeRing images)
• Parameter Loader (reads camera intrinsics from .txt)
b. Preprocessing
• Feature Detector / Descriptor (e.g., SIFT, ORB via OpenCV)
• Feature Matcher
c. SfM Pipeline
• Pairwise Pose Estimation (essential matrix, RANSAC)
• Incremental Reconstruction (triangulation, bundle adjustment)
d. Output Module
• 3D Point Cloud Exporter (PLY, OBJ)
• Camera Trajectory Output
e. External Dependencies
• OpenCV (core, imgproc, features2d, calib3d, sfm)
• CMake (build system)
Relationships and interactions
• Data flows left→right:
Images & Params → Preprocessing → SfM Pipeline → Outputs
• Feature Detector feeds into Matcher; Matcher & calibrations feed into Pose Estimation; Pose Estimation & existing points feed into Reconstruction loop; final results go to Exporter.
• All modules are compiled into a single executable (main.cpp calls each stage).
Architectural patterns / design principles
• Modular pipeline: each stage is decoupled and testable.
• Use of external libraries (OpenCV) for heavy lifting.
• CMake for cross‑platform builds; single monolithic service (no microservices).
Final checklist
• Landscape orientation
• External dependencies drawn separately but connected to modules that use them