Pages - Menu

Sunday, August 10, 2014

OpenAR: OpenCV Augmented Reality Program



OpenAR is a very simple C++ implementation to achieve Marker based Augmented Reality. OpenAR based on OpenCV and solely dependent on the library. OpenAR decodes markers in a frame of image. OpenAR does not implement Marker tracking across frames. Also OpenAR does not implement Template matching for Marker decoding.

Demo:


Building up to openAR:
Some of the basic operations are independently discussed in the previous posts -
Link  Installing Ubuntu 14.04
Link  Installing OpenCV 2.4.9 in Ubuntu
Link  Building a simple OpenCV Program
Link  OTSU thresholding
Link  Corner Detection
Link  Connected Component extraction

Source:
Git: https://github.com/bharathp666/openAR

Download:
Download from DsynFLO box folder - https://app.box.com/s/p2cpo7i6vp9ilazk3dhv

Instructions:
cmake .
make
./openar

License:
ZERO License. Students, Geeks, Tramps alike, free for all. :)

Implementation Notes:
1.     The program picks up one blob at a time and does not release it until it is verified if it is the marker. This method is chosen to eliminate creation of yet an another array containing details of all blobs of the image.
2.     Tracking the marker in subsequent frames is not implemented to keep the program simple and understandable. (It was too complicated for me as well!)
3.     Augmentation jugglery



Tuning the code:
If you are facing issues to reliably detect Markers, the following can be done -
1. Decrease the severity to determine corners. Warning: Segmentation fault (read next section)
2. Decrease the severity on blob size constraints.

Limitations:
1. Possible Segmentation fault due to too many corners and hence the array of corners may overflow.
2. Rotation of image according to the pattern orientation is not taken care but it can be done easily.
3. Detection fails on  blurry images caused by rapid movement of  markers.

Further enhancements:
Interested contributors fork me at Github or Mail me -
[  ] Code movement from legacy OpenCV 1.0 to 2.4.9
[  ] OpenGL integration - if required or may be OpenCV 3D visualization (3.0+)
[  ] Create an OpenAR library

Support:
For most parts- it must work. In case you hit a problem you can comment below or mail me, I would be glad to help. I'm not a seasoned C++ programmer and for any advanced assistance; posting a question at stackoverflow.com under 'opencv' tag is recommended.

References and Further reading:
1.    [Book] Learning OpenCV - Computer Vision with the OpenCV Library     
By Gary Bradski, Adrian Kaehler
First Edition

2.    ARlib – C++ Augmented reality library
by Danny Diggins

3.   Features from accelerated segment test
by Edward Rosten

4.    Connected Components Analysis

5.    Perpendicular Distance of a Point from a line
6.    Solutions to Equation of a Line


OpenCV Online Resources:

If you like my work - Please share !!!

No comments:

Post a Comment