AR Business Card done using OpenCV and OpenGL. This repository is a demonstration and it includes codes that can be used for academic orientation purposes, especially AR-related projects. A few techniques such as ArUco Marker, OpenGL API, and OpenCV libraries are utilized in this program. Please checkout the following contents for better understanding.
- OpenCV and OpenGL installation
- Pygame
- Generate ArUco Marker
- Camera Calibration
main.py
- main program script
marker.py
- script for detecting aruco marker
objloader.py
- load in 3d model and projection
matrixTrasnform.py
- script for handling model view matrix and projection matrix
projeciton.py
- opencv for 2d images projection
frame_to_video.py
- combine images to video
- Calibrate your own camera and save the values into
cam_parameter/cam_matrix.txt
and distorted coefficients tocam_parameter/dist_coefficient.txt
- You may want to generate aruco marker and set the parameter in the
marker.py
unless you stick to the same marker that was already in used. - Pygame window is used to display the program and each frame in the window will be saved in the directory
frames
- you may run the scriptframe_to_video.py
after the demonstration and get a video result. - Feel free to replace all the sources in the
src
folder. The folder includes all the images and videos that will be projected onto the scene.projection.py
handles the 2D projection (using homography matrix) while theobjloader.py
handles the 3D model projection. 3D models are located in the folder3d_models
. - I have already recorded video for the demonstration. You may set the video path
(card_cap)
inmain.py
to 0 for real-time laptop camera capture.
Sample result (video):
output.mp4
This is only for academic orientation purposes and not for any business purposes. Since this is a demonstration of using OpenCV and OpenGL, you may notice that changes in background or vibration will affect performance. You may consider using Vuforia, Unity or any other kind of techniques that will boost the performance and produce a better result.