multiple_view_geometry
multiple_view_geometry copied to clipboard
A demonstration of how multple view geometry works
Multi view geometry key concepts in Python
1. Demo on how to calculate epipolar line
Given:
- The two camera positions in world frame,
- The position of the cube in world frame,
- The camera intrinsics
Then:
- Calculate the projection of the keypoints from the cube onto the image frame
- Calculate the epipolar line in each image using its coorespondence and essential matrix
Demo
Command to run the demo:
python ./epipolar_geometry.py
or interact with the notebook
jupyter notebook epipolar_geometry.ipynb
2. Eight points algorithm
Given
- The positions of 8 or more pairs of point correspondence in two frames
- The camera intrinsics
Then:
- Calculate the essential matrix, and derive the translation (with a scale) and rotation of the two camera poses.
3. Structure from motion
Given
- The positions of points correspondence in two frames
- The camera intrinsics
- The poses of the two cameras in world frame
Then:
- Calculate the 3d position of the observed points in world frame, by solving a least square error problem
4. Bundle adjustment
Given
- Initial guess of the two camera poses in world frame
- Noisy observation of points correspondence in image frame
- Estimation of the 3d points in world frame
- The camear intrinsics
Then:
- Optimize the pose of the cameras' poses and 3d points positions using bundle adjustment from g2o library
Command to run the tests above:
pytest