/gyroflow

[Legacy version] Video stabilization using IMU motion data from internal or external logs

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Gyroflow - Video stabilization using gyroscope data targeting drone footage

Gyroflow has been totally revamped and rewritten with release v1.0.0! Trailer/Video announcement

The new code is available at https://github.com/gyroflow/gyroflow. This repository contains the legacy Python version of Gyroflow.

Join the Gyroflow Discord server for discussion and support.

A program built around Python, OpenCV, and PySide2 for video stabilization using gyroscope data.

The project consists of three core parts: A utility for the generation of lens undistortion preset, a utility for stabilizing footage using gyro data, and a utility for stretching 4:3 video to 16:9 using non-linear horizontal stretching (similar to GoPro's superview).

The main goal of creating something that can stabilize footage based on blackbox gyro data has mostly been achieved. Moving forwards, more work will be done to improve the quality of the result.

The launcher containing all the utilities is available by executing gyroflow.py if all the dependencies are met. Otherwise a binary can be found over in releases. Also, check out the wiki where there's some more information about the camera calibration and video stabilization process.

Run using python and Poetry:

Note: Try the dev branch for the newest features.

  • Install poetry
  • Clone or download the files from this repo
  • Navigate to the folder using a commandline and install dependencies using poetry install
  • Run the application using poetry run python gyroflow.py

Other things to check out:

General recording tips

  • Use the settings that give the widest possible field of view (more data to work with). For a lot of cameras, this is in the 4:3 aspect ratio.
  • If using the main drone flight controller for logging, the camera should be hardmounted.
  • If using a secondary logger on the camera or internal camera logging, some soft mounting is preferred to isolate vibrations.

Status

Sample clips:

Working:

  • Videoplayer based on OpenCV and Pyside2
  • Gyro integration using quaternions
  • Non-linear stretch utility
  • Basic video import/export
  • Camera calibration utility with preset import/export
  • GoPro metadata import
  • Symmetrical slerp-based quaternion low-pass filter
  • Blackbox data import
  • Undistort and rotation perspective transform
  • Semi-automatic temporal gyro/video sync.
  • Blackbox orientation handling and wide interval sync.
  • Stabilization UI without video player
  • (Basic) gyro orientation presets for GoPro cameras
  • Frame blending timelapse/hyperlapse
  • Automatic determination of required crop
  • Native support for insta360 gyro
  • Support for high speed video
  • GoPro/Insta360 as gyro logger for cinema cameras.
  • Basic prores import/export through ffmpeg
  • Modular/improved smoothing methods
  • Support for non-square pixel aspect ratios
  • Incorporate acceleration data in orientation estimation for horizon lock
  • Audio handling
  • .gyroflow file with synced data