Close Window

Video Stabilization

This example uses the Video and Image Processing Blockset to remove the effect of camera motion from a video stream. In the first video frame, the model defines the target to track. In this case, it is the back of a car and the license plate. It also establishes a dynamic search region, whose position is determined by the last known target location. The model only searches for the target within this search region, which reduces the number of computations required to find the target. In each subsequent video frame, the model determines how much the target has moved relative to the previous frame. It uses this information to remove unwanted translational camera motions and generate a stabilized video.

Contents

Example Model

The following figure shows the Video Stabilization model:

Estimate Motion Subsystem

The model uses the SAD block to move the target over the search region and computes the sum of absolute differences (SAD) at each location. The location with the lowest SAD value corresponds to the location of the target in the video frame. Based on the location information, the model computes the displacement vector between the target and its original location. The Translate block in the Stabilization subsystem uses this vector to shift each frame so that the camera motion is removed from the video stream.

Display Results Subsystem

The model uses the Resize, Compositing, and Insert Text blocks to embed the enlarged target and its displacement vector on the original video.

Video Stabilization Results

The figure on the left shows the original video. The figure on the right shows the stabilized video.





About this video

The above video was created using the Write AVI File block. When running this Simulink model, you can see the resulting video using a Video Viewer or To Video Display block. You can connect these viewers to any signal in the model, adjust model parameters, and view the results in real time.


Additional Information

For more information about the Video and Image Processing Blockset, see the Video and Image Processing Blockset product information page. From here you can download a free 30-day trial, read the documentation and user stories, request more information, and get pricing information.

Also, see the other product examples that illustrate key features of the Video and Image Processing Blockset.