<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Python, GTSAM, Computer Vision | Rahil Bhowal</title><link>https://rahil-bhowal007.github.io/resume-website/tags/python-gtsam-computer-vision/</link><atom:link href="https://rahil-bhowal007.github.io/resume-website/tags/python-gtsam-computer-vision/index.xml" rel="self" type="application/rss+xml"/><description>Python, GTSAM, Computer Vision</description><generator>Hugo Blox Builder (https://hugoblox.com)</generator><language>en-us</language><lastBuildDate>Sun, 24 Nov 2024 00:00:00 +0000</lastBuildDate><image><url>https://rahil-bhowal007.github.io/resume-website/media/icon_hu7729264130191091259.png</url><title>Python, GTSAM, Computer Vision</title><link>https://rahil-bhowal007.github.io/resume-website/tags/python-gtsam-computer-vision/</link></image><item><title>3D Reconstruction Using Structure From Motion (SfM)</title><link>https://rahil-bhowal007.github.io/resume-website/teaching/3d-reconstruction-structure-from-motion/</link><pubDate>Sun, 24 Nov 2024 00:00:00 +0000</pubDate><guid>https://rahil-bhowal007.github.io/resume-website/teaching/3d-reconstruction-structure-from-motion/</guid><description>&lt;h2 id="objective">Objective&lt;/h2>
&lt;p>To reconstruct a 3D scene and camera trajectory from a sequence of images using Structure-from-Motion (SfM). The pipeline includes feature detection, pose estimation, 3D point triangulation, and bundle adjustment for optimization.&lt;/p>
&lt;h2 id="dataset">Dataset&lt;/h2>
&lt;p>&lt;strong>Source&lt;/strong>: A custom dataset of images depicting a static scene (&amp;ldquo;buddha_images&amp;rdquo;).
&lt;strong>Details&lt;/strong>: The dataset consists of 25 images captured from different perspectives, simulating real-world camera motion around the object.
&lt;figure >
&lt;div class="flex justify-center ">
&lt;div class="w-100" >&lt;img alt="Original Dataset" srcset="
/resume-website/teaching/3d-reconstruction-structure-from-motion/original_dataset_hu16627670037610402540.webp 400w,
/resume-website/teaching/3d-reconstruction-structure-from-motion/original_dataset_hu18298456156182482465.webp 760w,
/resume-website/teaching/3d-reconstruction-structure-from-motion/original_dataset_hu8612513613827875412.webp 1200w"
src="https://rahil-bhowal007.github.io/resume-website/resume-website/teaching/3d-reconstruction-structure-from-motion/original_dataset_hu16627670037610402540.webp"
width="738"
height="760"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
&lt;/p>
&lt;p align="center">
&lt;it>Original Dataset&lt;/it>
&lt;p>&lt;strong>Preprocessing:&lt;/strong>
Images are normalized to ensure uniform pixel intensity.
CLAHE (Contrast Limited Adaptive Histogram Equalization) is applied for better feature detection in low-contrast regions.&lt;/p>
&lt;p>
&lt;figure >
&lt;div class="flex justify-center ">
&lt;div class="w-100" >&lt;img alt="Preprocessing the dataset" srcset="
/resume-website/teaching/3d-reconstruction-structure-from-motion/Preprocessing_hu16598873739779166740.webp 400w,
/resume-website/teaching/3d-reconstruction-structure-from-motion/Preprocessing_hu5876227944412584365.webp 760w,
/resume-website/teaching/3d-reconstruction-structure-from-motion/Preprocessing_hu17756982730106449652.webp 1200w"
src="https://rahil-bhowal007.github.io/resume-website/resume-website/teaching/3d-reconstruction-structure-from-motion/Preprocessing_hu16598873739779166740.webp"
width="738"
height="760"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
&lt;/p>
&lt;p align="center">
&lt;it>Preprocessed dataset&lt;/it>
&lt;h2 id="problem-statement">Problem Statement&lt;/h2>
&lt;p>The goal is to accurately reconstruct the 3D structure of the scene and estimate the camera trajectory by:&lt;/p>
&lt;ol>
&lt;li>Detecting and matching features across the images.&lt;/li>
&lt;li>Estimating relative camera poses and 3D points.&lt;/li>
&lt;li>Refining the reconstruction with bundle adjustment to minimize reprojection errors.&lt;/li>
&lt;/ol>
&lt;h2 id="workflow">Workflow&lt;/h2>
&lt;p>&lt;strong>1. Image Preprocessing&lt;/strong>&lt;/p>
&lt;pre>&lt;code>Images are loaded and enhanced to improve feature detection.
Conversion to grayscale and CLAHE is applied for contrast improvement.
&lt;/code>&lt;/pre>
&lt;p>&lt;strong>2. Feature Detection and Matching&lt;/strong>&lt;/p>
&lt;pre>&lt;code>SIFT (Scale-Invariant Feature Transform) is used to detect robust keypoints in each image.
Keypoints are matched between consecutive images using FLANN-based matching.
RANSAC is applied to eliminate outliers and ensure reliable matches.
&lt;/code>&lt;/pre>
&lt;p>&lt;strong>3. Pose and Structure Estimation&lt;/strong>&lt;/p>
&lt;pre>&lt;code>Fundamental Matrix: Estimated using RANSAC for epipolar geometry constraints.
Essential Matrix: Extracted from the fundamental matrix to estimate relative camera poses.
3D Point Triangulation: Feature correspondences are triangulated to estimate initial 3D points.
&lt;/code>&lt;/pre>
&lt;p>
&lt;figure >
&lt;div class="flex justify-center ">
&lt;div class="w-100" >&lt;img alt="Epipolar Lines" srcset="
/resume-website/teaching/3d-reconstruction-structure-from-motion/epipolar_lines_hu7827697987014114266.webp 400w,
/resume-website/teaching/3d-reconstruction-structure-from-motion/epipolar_lines_hu9131896081585381650.webp 760w,
/resume-website/teaching/3d-reconstruction-structure-from-motion/epipolar_lines_hu80999310732477610.webp 1200w"
src="https://rahil-bhowal007.github.io/resume-website/resume-website/teaching/3d-reconstruction-structure-from-motion/epipolar_lines_hu7827697987014114266.webp"
width="654"
height="760"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
&lt;/p>
&lt;p align="center">
&lt;it>Epipolar lines&lt;/it>
**4. Bundle Adjustment**
&lt;pre>&lt;code>Framework: GTSAM is used to build a factor graph that models the relationship between camera poses and 3D points.
Optimization:
Camera poses and 3D points are refined by minimizing reprojection errors.
The Levenberg-Marquardt algorithm is employed for nonlinear optimization.
&lt;/code>&lt;/pre>
&lt;p>&lt;strong>5. Visualization&lt;/strong>
The 3D reconstruction is visualized as:
A point cloud representing the reconstructed scene.
A trajectory showing the path of the camera during image capture.&lt;/p>
&lt;h2 id="output">Output&lt;/h2>
&lt;p>
&lt;figure >
&lt;div class="flex justify-center ">
&lt;div class="w-100" >&lt;img alt="Without Bundle Adjustment" srcset="
/resume-website/teaching/3d-reconstruction-structure-from-motion/without_bundleadjustment_hu6942033191206393866.webp 400w,
/resume-website/teaching/3d-reconstruction-structure-from-motion/without_bundleadjustment_hu9187262976241223686.webp 760w,
/resume-website/teaching/3d-reconstruction-structure-from-motion/without_bundleadjustment_hu6402079543670450562.webp 1200w"
src="https://rahil-bhowal007.github.io/resume-website/resume-website/teaching/3d-reconstruction-structure-from-motion/without_bundleadjustment_hu6942033191206393866.webp"
width="760"
height="760"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
&lt;/p>
&lt;p align="center">
&lt;it>Without Bundle Adjustment&lt;/it>
&lt;p>
&lt;figure >
&lt;div class="flex justify-center ">
&lt;div class="w-100" >&lt;img alt="With Bundle Adjustment" srcset="
/resume-website/teaching/3d-reconstruction-structure-from-motion/with_bundleadjustment_hu4539902871305604662.webp 400w,
/resume-website/teaching/3d-reconstruction-structure-from-motion/with_bundleadjustment_hu14807982979724959188.webp 760w,
/resume-website/teaching/3d-reconstruction-structure-from-motion/with_bundleadjustment_hu13079284056632531521.webp 1200w"
src="https://rahil-bhowal007.github.io/resume-website/resume-website/teaching/3d-reconstruction-structure-from-motion/with_bundleadjustment_hu4539902871305604662.webp"
width="760"
height="760"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
&lt;/p>
&lt;p align="center">
&lt;it>With Bundle Adjustment&lt;/it>
&lt;p>
&lt;figure >
&lt;div class="flex justify-center ">
&lt;div class="w-100" >&lt;img alt="Output zoomed image" srcset="
/resume-website/teaching/3d-reconstruction-structure-from-motion/featured_hu14569655443375324010.webp 400w,
/resume-website/teaching/3d-reconstruction-structure-from-motion/featured_hu2822277910763705096.webp 760w,
/resume-website/teaching/3d-reconstruction-structure-from-motion/featured_hu5183902391674200487.webp 1200w"
src="https://rahil-bhowal007.github.io/resume-website/resume-website/teaching/3d-reconstruction-structure-from-motion/featured_hu14569655443375324010.webp"
width="196"
height="359"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
&lt;/p>
&lt;p align="center">
&lt;it>Output image&lt;/it>
&lt;h2 id="did-you-find-this-page-helpful-consider-sharing-it-">Did you find this page helpful? Consider sharing it 🙌&lt;/h2></description></item></channel></rss>