Simplest 20-lines OpenCV video stabilizer [w/ code]

Just sharing a simple recipe for a video stabilizer in OpenCV based on goodFeaturesToTrack() and calcOpticalFlowPyrLK().
Well... it's a bit more than 20 lines, but it is short. And it doesn't work for every kind of video (although the results are funny anyway! :).

Result

The original video is from Vimeo: http://vimeo.com/71719896
Under Creative Commons license, attribution goes to: Anton Withagen http://vimeo.com/user454264

Enjoy!
Roy.

Share
  • acidBurn

    Hello,

    Thank you for the code. I ran it on Visual Studio and it stops at a point where it detects only the features. Only the original window opens and is still. No movement. Tried it with different video formats. Your help is appreciated.

    Thanks