Stabilizer Class¶
VidGear's Stabilizer in Action
(Video Credits @SIGGRAPH2013)
This video is transcoded with StreamGear API and hosted on GitHub Repository and served with raw.githack.com
Overview¶
Stabilizer is an auxiliary class that enables Video Stabilization for vidgear with minimalistic latency, and at the expense of little to no additional computational requirements.
The basic idea behind it is to track salient features between consecutive frames, accumulate their motion into a camera trajectory, smooth that trajectory, and warp each frame onto the smoothed path to cancel out perturbations. Two backends are available:
- Average Sliding-Window (ASW) (default): smooths the trajectory with a box filter over a queue of
smoothing_radiusframes. Relies on bounded fixed-size deques with memory capped atO(smoothing_radius), at the cost ofsmoothing_radiusframes of latency. - Kalman : smooths the trajectory online with a vectorized Kalman filter, so every frame is stabilized immediately — zero latency, no frame buffering,
O(1)memory. Ideal for live streams.
For more detailed information on Stabilizer working, See this blogpost âž¶
Architecture changes in v0.3.5
Starting with v0.3.5, the Stabilizer module follows a flexible, plugin-style design. Different stabilization methods can plug into a shared foundation for easier extensibility and future improvements.
The Stabilizer interface automatically selects the appropriate backend based on the mode parameter, keeping usage simple and consistent.
Available modes:
| Mode | Backend | Status |
|---|---|---|
StabilizerMode.ASW | ASWStabilizer — Average Sliding-Window | Default |
StabilizerMode.KALMAN | KalmanStabilizer — Zero-latency Kalman filter | Real-time |
The public Stabilizer API remains unchanged, so existing code continues to work as before while automatically using the default ASW backend.
Features¶
-
Real-time stabilization with low latency and no extra resources.
-
Zero-latency Kalman backend for live streams.
-
Works exceptionally well with low-frequency jitter.
-
Integrated with VideoGear, therefore, can be applied to any incoming stream.
-
Also seamlessly works standalone.
Important
-
The stabilizer may not perform well against High-frequency jitter in video. Use at your own risk!
-
The stabilizer might be slower for High-Quality videos-frames.
-
It is advised to enable logging on the first run for easily identifying any runtime errors.
Usage Examples¶
After going through Stabilizer Class Usage Examples, Checkout more of its advanced configurations here âž¶
Parameters¶
References¶
FAQs¶