P3d0r
P3d0r

Reputation: 1099

OpenCV: image stabilization

I am attempting to post process a video in OpenCV. Since my camera is not fixed (must be mobile), the resulting video is very jittery due to vibrations and panning. As such, every frame that I try to look at has blurs that will make my detection less accurate if it can even detect some of the blurry images.

I've searched online and there seem to be a lot of discussion on compensating for the camera motion with gyroscopes.

Are there any cameras that will help this out? I've been using a GoPro.

Are there any algorithms that could help process the video?

I have no background in image stabilization and don't know where to start. Would appreciate any recommendations.

Upvotes: 2

Views: 6997

Answers (1)

Kornel
Kornel

Reputation: 5354

Image stabilization algorithms usually works as follows:

  • Find the transformation from previous to current frame (often using optical flow for all frames). The transformation consists of some parameters such as dx (movement along the horizontal direction), dy (vertical), da (rotation angle). Basically it is a rigid Euclidean transform, with no scaling and no sharing.
  • Accumulate the transformations to get the “trajectory” for x, y, angle, at each frame.
  • Smooth out the trajectory using a sliding average window. The user defines the window radius, where the radius is the number of frames used for smoothing.
  • Create a new transformation such that new_transformation = transformation + (smoothed_trajectory – trajectory).
  • Apply the new transformation to the image sequence

Here you have two version of this idea:

Upvotes: 6

Related Questions