CO543/CO5430 Computer Vision Project, Group 13. Sparse 3D reconstruction from multiple images.
| Name | E-Number | |
|---|---|---|
| K.L.D.H. Liyanagama | E/23/202 | e23202@eng.pdn.ac.lk |
| W.G.R.P. Gamage | E/23/108 | e23108@eng.pdn.ac.lk |
| C.M.H.K. Chandrasekara | E/23/043 | e23043@eng.pdn.ac.lk |
Team data also lives in data/index.json (single source of truth).
Given a set of overlapping images of a scene, recover the camera pose for
each image and a sparse 3D point cloud of the scene, using classical
feature based Structure from Motion. See docs/UserGuide.md for the full
pipeline explanation and datasets/templeRing/README.txt for dataset details.
run.py orchestrates the classical incremental SfM pipeline:
config.py).python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
This repo does not commit dataset images (see .gitignore).
Download TempleRing (Middlebury Multi-View Stereo dataset) yourself and place
the .png files in datasets/templeRing/images/. The calibration files
(templeR_par.txt, templeR_ang.txt, README.txt) are already included.
python run.py # ORB baseline (default), TempleRing
python run.py --feature_type sift # SIFT variant
python run.py --out outputs/my_run # custom output location
Each run prints, in order: keypoints per image, matching progress, the chosen initial pair, per-image PnP registration, bundle adjustment convergence, the final metrics summary (keypoints/matches/inliers/points/timing), and pose accuracy against ground truth.
run.py flags (defaults come from config.py):
| Flag | Default | Description |
|---|---|---|
--feature_type |
config.FEATURE_TYPE (orb) |
sift or orb |
--images |
config.IMAGES_DIR |
Folder of input images |
--out |
outputs/<feature_type>/ |
Output folder (derives from --feature_type if not given) |
--gt_calibration |
config.GT_CALIBRATION_PATH |
Ground-truth *_par.txt for intrinsics + pose scoring |
--no_gt_intrinsics |
off | Ignore GT intrinsics, use the width/height approximation |
Results land in outputs/<feature_type>/:
points3D.ply, points3D_open3d.ply — sparse point cloudcameras.json — recovered camera poses + intrinsicssparse/0/{cameras,images,points3D}.txt — COLMAP format (for Gaussian
Splatting later)images/ — registered images copied for COLMAP/Gaussian SplattingRender the point cloud plus recovered camera frustums to PNGs (a turntable of views) using Open3D’s offscreen renderer. Works on headless machines and Wayland+NVIDIA setups where the interactive windowed viewer fails:
python view.py outputs/sift
Writes points3D_view_*.png into the results folder (add --angles 12 for
more views, --out elsewhere to redirect).
For interactive exploration, open the .ply in MeshLab:
meshlab outputs/sift/points3D.ply
The .ply is a sparse, unmeshed point cloud — use Point Splatting in
MeshLab to view it as dots.
Visualize detected keypoints and pairwise feature matches without running the
full pipeline (reuses the exact detection/matching logic). Only
--feature_type is required:
python viz_matches.py --feature_type sift
Writes to outputs/<feature_type>_viz/:
keypoints/keypoints_<i>.png — keypoints drawn on each image (fixed small
radius so large SIFT scales stay readable)matches/<i>_<j>.png — all raw matches in red with RANSAC inliers overlaid
in greenmatches/inliers_<i>_<j>.png — only the RANSAC-verified inliersUseful flags: --pairs "0,1 1,2" (only render specific pairs),
--interactive (pop each image up with cv2.imshow), --matching_strategy,
--match_window, --max_features, --gt_calibration, --out.
Root/
├── run.py # main entry point (wires pipeline + evaluation)
├── sfm_baseline.py # SfM pipeline (detection -> matching -> RANSAC ->
│ incremental registration -> BA -> export)
├── evaluate.py # ground-truth pose loading + accuracy scoring
├── viz_matches.py # keypoint + feature-match visualization tool
├── view.py # offscreen 3D renderer (point cloud + camera poses)
├── config.py # parameters
├── requirements.txt
├── data/index.json # team data
├── datasets/templeRing/ # calibration + image folder (images gitignored)
├── outputs/ # per-run results (gitignored)
└── docs/UserGuide.md # detailed pipeline + troubleshooting guide
docs/UserGuide.md — full pipeline explanation, reading the ground-truth
evaluation, and troubleshootingdatasets/templeRing/README.txt — dataset details