Giter Site home page Giter Site logo

rfonod / stabilo Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 461 KB

Stabilo is a Python package for stabilizing video frames or object trajectories using advanced transformation techniques. It supports user-defined masks to exclude specific areas, making it ideal for dynamic scenes with moving objects. Unlike traditional stabilization, it stabilizes content relative to a chosen reference frame.

License: MIT License

Python 100.00%
computer-vision feature-extraction feature-matching homography-estimation image-processing image-registration opencv-python ransac video-processing video-stabilization

stabilo's Introduction

Stabilo

DOI GitHub Release License GitHub

๐Ÿšง Development Notice ๐Ÿšง

โš ๏ธ IMPORTANT: Stabilo is currently in its preliminary stages and under active development. Not all features are complete, and significant changes may occur. It is recommended for experimental use only. Please report any issues you encounter, and feel free to contribute to the project.

Stabilo is a Python package for stabilizing video frames or tracked object trajectories in videos using homography or affine transformations, with optional user-provided masks that define areas to ignore during stabilization. It is optimized for use in environments where accurate, frame-by-frame alignment is crucial, such as video surveillance and research applications. For instance, Stabilo can be integrated with object detection and tracking algorithms to stabilize trajectories, enhancing the performance of such systems. See for example this project. The package offers flexibility through a variety of transformation and enhancement options, including the ability to handle different types of feature detection and masking techniques.

Features

  • Video Stabilization: Align video frames to a selected reference using homography or affine transformations.
  • Trajectory Stabilization: Apply stabilization to object trajectories using homography or affine transformations.
  • User-Defined Masks: Allow users to specify areas to ignore during stabilization, such as bounding boxes of moving objects or regions of no interest.
  • Wide Range of Algorithms: Support for various feature detectors (e.g., ORB, (R)SIFT, BRISK, (A)KAZE), matchers (e.g., BF, FLANN), RANSAC algorithms, transformation types, and pre-processing options.
  • Customizable Parameters: Fine-tune the stabilization process by adjusting parameters such as the number of keypoints, RANSAC and matching thresholds, and downsampling factors.
  • Visualization Tools: Generate visualizations of the stabilization process, including frame-by-frame comparisons.
  • Threshold Analysis: Analyze the relationship between detection thresholds and keypoint counts for BRISK, KAZE, and AKAZE feature detectors.
๐Ÿš€ Planned Enhancements
  • Benchmarking and Tuning Tools: Develop tools to benchmark and tune the performance of the stabilization algorithms.
  • Trajectory Stabilization Script: Create a script to stabilize object trajectories in videos.
  • Custom Mask Encoding: Support for more generic types of custom mask encodings.
  • Custom Reference Frame Selection: Allow users to select a custom reference frame for stabilization.
  • GPU Acceleration: Utilize GPU acceleration for faster processing.
  • Documentation: Provide detailed documentation and examples for ease of use.
  • Unit Tests: Implement comprehensive unit tests to ensure the stability and reliability of the package.
  • Deployment to PyPI: Publish the package on PyPI for easy installation and distribution.

Installation

First, create a Python Virtual Environment (Python >= 3.9) using e.g., Miniconda3:

conda create -n stabilo python=3.9 -y
conda activate stabilo

Then, install the package using one of the following methods:

Option 1: Install from PyPI

You can install the package from PyPI (not available yet):

pip install stabilo

Option 2: Install from Source (recommended)

You can install the package directly from the repository:

pip install git+https://github.com/rfonod/stabilo.git

Option 3: Install from Local Source

Clone the repository and install the package:

git clone https://github.com/rfonod/stabilo.git
cd stabilo
pip install .

If you want the changes you make in the repo to be reflected in your install, use pip install -e . instead of pip install ..

Example Usage

from stabilo import Stabilizer 

# Create an instance of the Stabilizer class with default parameters
stabilizer = Stabilizer() 

# Set a reference frame with optional mask (e.g., bounding boxes)
stabilizer.set_ref_frame(ref_frame, ref_mask)

# Stabilize any consecutive frame with optional mask
stabilizer.stabilize(frame, mask)

# Get the stabilized (warped to the reference frame) frame  
stabilized_frame = stabilizer.warp_cur_frame()

# Get the transformed bounding boxes (if mask was provided)
stabilized_boxes = stabilizer.transform_cur_boxes()

Additional Scripts

Utility scripts are provided to demonstrate the functionality of the Stabilo package. These scripts can be found in the scripts directory.

Stabilization Examples

  • stabilize_video.py: Demonstrates video stabilization relative to a reference frame.
  • stabilize_boxes.py: Shows how to stabilize bounding boxes relative to a reference frame.

Threshold Analysis

The find_threshold_models.py script is designed to model the relationship between detection thresholds for BRISK, KAZE, and AKAZE feature detectors and their average keypoint counts. It outputs regression models, saves pertinent data, and generates plots for visual analysis.

To run this script, install the optional dependencies pip install .[extras] (or pip install '.[extras]' if you use zsh).

Citing This Work

If you use this project in your academic research, commercial products, or any published material, please acknowledge its use by citing it. For the correct citation, refer to the DOI badge above, which links to the appropriate version of the release on Zenodo. Ensure you reference the version you actually used. A formatted citation can also be obtained from the top right of the GitHub repository.

@software{Fonod_Stabilo_2024,
author = {Fonod, Robert},
license = {MIT},
month = jun,
title = {{Stabilo}},
url = {https://github.com/rfonod/stabilo},
doi = {10.5281/zenodo.12117092},
version = {0.1.0},
year = {2024}
}

Contributing

Contributions are welcome! If you encounter any issues or have suggestions for improvements, please open a GitHub Issue or submit a pull request. Your contributions are greatly appreciated!

License

This project is licensed under the MIT License, an OSI-approved open-source license, which allows for both academic and commercial use. By citing this project, you help support its development and acknowledge the effort that went into creating it. For more details, see the LICENSE file. Thank you!

stabilo's People

Contributors

rfonod avatar

Watchers

Kostas Georgiou avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.