Thursday, 3 July 2014

Release build of opencv

1. Increase processing speed, dramatically
It is to my surprise that, building in release mode will give me much much shorter processing time for stitching. This is comparable to the dedicated library/tools Hugin(panotools). IT IS GOOOOD!!

2. solving crashes with 'exception' warning
It is wierd that after i successfully made a 8-photo panorama, i cannot recreate this kind of error again. Hopefully it will never come back.

Update: ok, it comes back. It happens when you are stitching bigger photos in debug mode!

This proves that release version of OpenCV is more stable than the debug version!



3. solving out of memory problem
This is solved by compiling the program in x64. The corresponding environmental variables, used by OpenCV libraries, need to be directed to x64 directories as well


4. Some other problem encountered
According to my tests, OpenCV does not fully support original JPEG files captured by DSLR. More specifically, OpenCV does not read the metadata (exif) of the image. That is to say, properties such as orientation of the photo is not known in OpenCV, as shown below.
The photo is rotated 90 degree from the correct orientation, due to opencv's ignorance of exif information

This problem itself shouldn't cost much problem. However, from my tests, opencv does no really favor stitching photo vertically.
The memory usage shoots up if opencv tries to stitch photos sideways

Hence, the solution is to 'hard-code' the rotation info into the image itself. This is achieved by opening image using Paint or Photoshop then saving the image directly, without any modification.



5. FINAL RESULT: 23.81s for 8 full-resolution dslr photo (modified by PS/paint, to apply exif info into image file itself)

The stitched image here: