Fast, very lightweight algorithm for camera motion detection?

Ertebolle picture Ertebolle · Dec 9, 2010 · Viewed 10.7k times · Source

I'm working on an augmented reality app for iPhone that involves a very processor-intensive object recognition algorithm (pushing the CPU at 100% it can get through maybe 5 frames per second), and in an effort to both save battery power and make the whole thing less "jittery" I'm trying to come up with a way to only run that object recognizer when the user is actually moving the camera around.

My first thought was to simply use the iPhone's accelerometers / gyroscope, but in testing I found that very often people would move the iPhone at a consistent enough attitude and velocity that there wouldn't be any way to tell that it was still in motion.

So that left the option of analyzing the actual video feed and detecting movement in that. I got OpenCV working and tried running their pyramidal Lucas-Kanade optical flow algorithm, which works well but seems to be almost as processor-intensive as my object recognizer - I can get it to an acceptable framerate if I lower the depth levels / downsample the image / track fewer points, but then accuracy suffers and it starts to miss some large movements and trigger on small hand-shaking-y ones.

So my question is, is there another optical flow algorithm that's faster than Lucas-Kanade if I just want to detect the overall magnitude of camera movement? I don't need to track individual objects, I don't even need to know which direction the camera is moving, all I really need is a way to feed something two frames of video and have it tell me how far apart they are.

Answer

Oded Ben Dov picture Oded Ben Dov · Jan 11, 2011

there's an open source (free for private use) project that utilizes FAST corner detection here: http://www.hatzlaha.co.il/150842/FAST-Corner-V2

It could be very useful for object detection, and has undergone serious optimizations to reach beautiful non-jittery results.

-- EDIT --

Now there's a Lucas-Kanade Optical Flow project as well - http://www.success-ware.com/150842/Lucas-Kanade-Detection-for-the-iPhone You can download the source code, and there's a link to the AppStore as well, so you can play around with it and see if it answers your needs.

HTH,

Oded.