In this repository, Projection 3D Objects on top of reference images using augmented reality techniques is demonstrated.
In General, This works based on feature extraction and feature description using SIFT features. The workflow is describe as
- Feature reach image(i.e to make feature extraction easier) is used as a reference image.
- Using Opencv, Video of the reference image is captured(Consistently)
- Both the reference image and current video frame ,
SIFT
features and descriptors are extracted. - Based Lowe's(author of SIFT) ratio test good matching points are extracted.
- A homography is calculated using RANSAC Algorithm.
- projection matrix is calculated from the homography and some orthonormal vector Properties to project the 3D object into reference image
pip3 install opencv-python numpy pyqt5
Incase if you get this error:
'QObject::moveToThread: Current thread (0x55fded9ab880) is not the object's thread (0x55fdedb9aee0). Cannot move to target thread (0x55fded9ab880)'
you need to install opencv version which matches with your installed pyqt version
in our case opencv-python==4.3.0.36
and pyqt5==5.15.1
works fine.
-
First reference image should be provided either by coping to
assets/images
folder with '1.jpg' filename then run the program in your command line usingpython run_program.py
-
Alternatively the reference image could provided as command line argument as
python run_program.py --input_path [path-to-the-image]/1.jpg