Skip to content

btxviny/Trajectory-Optimization-and-Parametric-filtering-based-Video-Stabilization

Repository files navigation

Trajectory Optimization and Parametric filtering based Video Stabilization

This repository consists of various video stabilization methods using different motion models.1)Homography transformations between consecutive frames. 2) Sparse vertex grid motion. 3) Dense optical flow fields.

drawn.

Feature based stabilization.

The camera path is constructed by matching features between consecutive frames and the unwanted motion is removed with low-pass filtering.

python  scripts/stabilize_features.py --in_path unstable_video_path --out_path result_path
  • Replace unstable_video_path with the path to your input unstable video.
  • Replace result_path with the desired path for the stabilized output video.

Sparse vertex grid motion optimization.

I provide my implementation ofMeshFlow. I provide my own gradient-based optimization method using PyTorch with a simple smoothness loss function. For each algorithm I provide two different warping methods. A mosaic warping method as well as a method based on PCA-Flow which does not introduce any black borders.

python  scripts/stabilize_meshflow.py --in_path unstable_video_path --out_path result_path
python  scripts/stabilize_meshflow_pca.py --in_path unstable_video_path --out_path result_path
python  scripts/stabilize_sparse_mosaic.py --in_path unstable_video_path --out_path result_path
python  scripts/stabilize_sparse_pca.py --in_path unstable_video_path --out_path result_path
  • Replace unstable_video_path with the path to your input unstable video.
  • Replace result_path with the desired path for the stabilized output video.

Dense Optical Flow/ Pixel profile smoothing.

I provide a pixel profile gradient based optimization method and a parametric filtering approach.

python  scripts/stabilize_pixel_profiles_optim.py --in_path unstable_video_path --out_path result_path
python  scripts/stabilize_pixel_profiles_filtering.py --in_path unstable_video_path --out_path result_path
  • Replace unstable_video_path with the path to your input unstable video.
  • Replace result_path with the desired path for the stabilized output video.

plot.

Evaluation

For method evaluation and comparison I will use non-reference metrics commonly used among researchers. These metrics include: 1) cropping ratio 2) global distortion 3) pixel loss and 4) stability. We will interpret them as scores, and a good result should have a value close to 1. These metrics except the pixel loss were defined in Bundled Camera Paths for Video Stabilization. For my evaluation dataset we will use the one provided in Bundled Camera Paths for Video Stabilization. We take 5 videos from different categories of camera motion and scene layouts. These categories include parallax, quick rotation, zooming, crowd and regular unstable videos. The average score in each category will be used to compare methods. The results are: scores

The evaluation dataset can be downloaded here and the results were generated using the evaluation_all.ipynb notebook.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published