Skip to content

Stabilizer Class

Abhishek Thakur edited this page Apr 24, 2020 · 32 revisions

VidGear Logo

Stabilizer Class API

This is an auxiliary class that enables Real-time Video Stabilization for vidgear with minimalistic latency and at the expense of little to no additional computational requirement.

The basic idea behind it is to tracks and save the salient feature array for the given number of frames and then uses these anchor point to cancel out all perturbations relative to it for the incoming frames in the queue. This class relies heavily on Threaded Queue mode for error-free, ultrafast frame handling.

 

Features :

  • Real-time stabilization with low latency and no extra resources.

  • Works exceptionally well with low-frequency jitter.

  • Compatible with any vidgear's videocapture streams.

  • Works both standalone and with VidGear Multi-Threaded Classes.

 


Important Information: ⚠️

  • The stabilizer may not perform well against High-frequency jitter in video. Use at your own risk!

  • It is advised to enable logging (logging = True) on the first run, to easily identify any runtime errors.


 

 

Table of Contents:

 

 

Importing:

You can import this class as follows:

from vidgear.stabilizer import Stabilizer

 

 

Usage: 🔨

1. Using VideoGear Class with stabilization activated

See here for details and complete example ➶

2. Using Stabilizer Class Directly with OpenCV

See here for details and complete example ➶

3. Real-Time Stabilization with other VidGear Multi-Threaded Gears

See here for details and complete example ➶

 

 

Attributes and Parameters: 🔧

  • smoothing_radius (integer) : to alter averaging window size. It basically handles the quality of stabilization at the expense of latency and sudden panning. Larger its value, less will be panning, more will be latency and vice-versa. Its default value is 25.

  • border_size (integer) : enables the feature to extend border size that compensates for stabilized output video frames motions. Its default value is 0(no borders).

  • crop_n_zoom (boolean) : enables the feature where it crops and zooms frames(to original size) to reduce the black borders from stabilization being too noticeable (similar to the Stabilized, cropped and Auto-Scaled feature available in Adobe AfterEffects). It simply works in conjunction with the BORDER_SIZE attribute, i.e. when this attribute is enabled, BORDER_SIZE will be used for cropping border instead of extending them. Its default value is False.

  • border_type (string) : to change the extended border style. Valid border types are 'black', 'reflect', 'reflect_101', 'replicate' and 'wrap', learn more about it here. Its default value is 'black'.

    ⚠️ Altering border_type parameter is disabled while crop_n_zoom is enabled!

  • logging (boolean) : set this flag to enable/disable error logging essential for debugging. Its default value is False.

 

Clone this wiki locally