- Notifications
You must be signed in to change notification settings - Fork0
danielbob32/ComputerVisonImageMatching
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Welcome to the3D Reconstruction and Plane Detection project! This repository contains a Python script that performs 3D reconstruction from stereo images using epipolar geometry. It detects keypoints, matches them between images, computes the Fundamental and Essential matrices, reconstructs a 3D point cloud, and fits planes to the reconstructed points using RANSAC.
This project demonstrates how to perform:
- 🔑Keypoint detection using SIFT
- 🔗Feature matching between two images
- 📐Computation of the Fundamental and Essential matrices
- 🧭Recovery of camera pose (rotation and translation)
- 🌐Triangulation of matched points to create a 3D point cloud
✈️ Plane fitting using RANSAC- 🎨Visualization of keypoints, matches, epipolar lines, and planes
- Keypoint Detection: Detects and computes descriptors using SIFT.
- Feature Matching: Matches features using BFMatcher with a ratio test.
- Epipolar Geometry: Calculates the Fundamental and Essential matrices.
- Pose Recovery: Determines the relative camera positions.
- 3D Reconstruction: Triangulates points to form a 3D point cloud.
- Plane Detection: Uses RANSAC to detect planes in the point cloud.
- Visualization: Provides comprehensive plotting functions for analysis.
- 🐍Python 3.6 or higher
- 📦NumPy
- 👁️OpenCV (cv2)
- 📊Matplotlib
Clone the Repository
git clone https://github.com/danielbob32/ComputerVisonImageMatchingcd ComputerVisonImageMatching
Install Dependencies
Install the required Python packages:
pip install numpy opencv-python matplotlib
- Prepare Your Data
- 📁 Create a directory for your data, e.g., data/example_3/.
- 🖼️ Place your stereo images I1.png and I2.png in this directory.
- 📄 Provide the camera intrinsic matrix K.txt in the same directory. The matrix should be in text format with comma-separated values.
- Configure ParametersIn the main() function of the script, you can adjust the following parameters:
data_dir='data/example_3'# Path to your data directoryamount=70# Number of matches and epipolar lines to displayplanes_amount=2# Number of planes to detectRansac_iterations=1000# RANSAC iterations for plane fittingthreshold=0.5# Distance threshold for RANSAC
- Run the Script
Execute the script using the command line:
python main.py
- View the Results
The script will display various plots:
- 📷 Keypoints detected in both images
- 🔍 Matched features between images
- 📏 Matches with connecting lines
- 📐 Epipolar lines corresponding to the matches
- 🛰️ Planes fitted to the 3D point cloud
- 🧭 Normals of the detected planes projected onto the images
Note: The results directory should contain the generated images from running the script.
- main.py: Main Python script containing all functions and the main() function.- data/: Directory containing sample images and camera matrix.- results/: Directory where output images and plots are saved.- README.md: Project documentation.
Contributions are welcome! If you have suggestions for improvements or new features, feel free to open an issue or submit a pull request.
- Fork the repository.
- Create your feature branch: git checkout -b feature/YourFeature
- Commit your changes: git commit -am 'Add some feature'
- Push to the branch: git push origin feature/YourFeature
- Open a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
For questions or suggestions, please contact Daniel Bobritski:
📧 Email:danielbob32@gmail.com💼 LinkedIn: Daniel Bobritski🎮 Discord: danielxp13#9709
About
3D reconstruction from stereo images using epipolar geometry.
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Contributors2
Uh oh!
There was an error while loading.Please reload this page.