Thread Tools
This thread is privately moderated by Jack Crossfire, who may elect to delete unwanted replies.
Sep 17, 2014, 03:01 AM
Registered User
Jack Crossfire's Avatar
Thread OP
Discussion

OpenCV rides again


OpenCV was last used in Cinelerra many years ago in an object replacement experiment. It sucked, so it was never put in the mane build system.

Object replacement with OpenCV & SURF (2 min 42 sec)


Now, it rises again in an attempt to do better at video stabilization. There are some simple stackoverflow examples, in addition to the hideously complex samples/cpp/videostab.cpp. It seems to detect features & optical flow reasonably well.

In modules/calib3d/include/opencv2/calib3d.hpp there's

findHomography

for detecting homography.

In modules/videostab/include/opencv2/videostab/global_motion.hpp there's

estimateGlobalMotionRansac

for getting just translation, rotation, & scaling. Both return a matrix for an affine transform. Multiply the homography matrix to accumulate motion, but usually it zeros out the accumulator or crashes.

Thus begins your revelation that every CvMat needs to be manually initialized with a piece of memory allocated on your own. Different languages do it differently, but the C interface needs memory management. It's 1 of those projects where all the energy goes to porting to different languages just enough to get the buzzword on a white paper, but no language besides C++ is finished.

Ideally, everyone would interface OpenCV in C++, but the examples are split between many languages. When given a choice of translating languages or making something work, everyone says they want to port between 15 languages, but without a boss telling them what to do, they just want it to work, so all their hobby projects are fragments of whatever different languages the OpenCV examples were written in.

Cinelerra motion vs Opencv homography (1 min 5 sec)


In the end, stabilizing action cam footage with feature extraction, homography, or RANSAC was a failure. Got slightly better results by increasing block_size & min_distance to over 16. It was completely unusable with timelapse footage. It might have some use for short panning sequences.

Maybe there are other ways to get stabilization out of OpenCV, other parameters to tweek, or a way to combine feature extraction with absdiff. At this point, you realize it doesn't matter how slow the stabilization algorithm is or how automatic the feature extraction is. It's footage you'll never get again & it only needs to be stabilized once.
Sign up now
to remove ads between posts
Sep 17, 2014, 06:18 AM
AMA 79169
rdstarwalt's Avatar
Interesting post.
Thank you!

-=Doug


Quick Reply
Message:
Thread Tools