Reconstruction of a scene given two non stereo images and the camera intrinsic parameters matrix. Four different methods are implemented, the first three perform a sparse reconstruction using feature matching (SIFT and SURF) or sparse optical flow (Lucas-Kanade). The fourth method performs a dense reconstruction using optical flow (Farneback).
The workflow of this project is based on the examples provided in the book: Mastering OpenCV with Practical Computer Vision Projects.
Install the OpenCV. When running the cmake, make sure to enable the non free packages in order to be able to use the SIFT and SURF features.
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D OPENCV_ENABLE_NONFREE=ON \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \
-D PYTHON_EXECUTABLE=~/.virtualenvs/cv/bin/python \
-D BUILD_EXAMPLES=ON .
For the scene point cloud visualization, the python library is used. In order to install it:
pip install open3d
The program takes as input: the path to the two images, the path to a .txt file containing the camera intrisic parameters matrix, the type of features used for the reconstruction, and optionally, the feature matching method which is set by default to bruteforce.
Usage: scene_reconstruction [params] image1 image2
-K (value:./path/to/K.txt)
intrisic parameters matrix path
--features (value:sift)
feature type , SIFT, SURF, OF_SPARSE, OF_DENSE
--help (value:true)
print this message
--matcher (value:bruteforce)
matcher type
image1 (value:./img1.jpg)
image1 path
image2 (value:./img2.jpg)
image2 path
An example would be:
./scene_reconstruction ../images/pic1.png ../images/pic2.png -K=../intrisic_matrix.txt -features=SIFT