AdamSpannbauer / python_video_stab

A Python package to stabilize videos using OpenCV
https://adamspannbauer.github.io/python_video_stab/html/index.html
MIT License
682 stars 118 forks source link

make apply transforms easier #62

Closed AdamSpannbauer closed 5 years ago

AdamSpannbauer commented 5 years ago

Makes process for applying transforms with a fresh instance of VidStab.

Example of new process for apply transforms from file:

import numpy as np
from vidstab import VidStab

# Read in csv transform data, of form (delta x, delta y, delta angle):
# -9.249733913760086068e+01,2.953221378387767970e+01,-2.875918912994855636e-02
# -8.801434576214279559e+01,2.741942225927152776e+01,-2.715232319470826938e-02
transforms = np.loadtxt(TRANSFORMATIONS_PATH, delimiter=',')

# Create stabilizer and supply numpy array of transforms
stabilizer = VidStab()
stabilizer.transforms = transforms

# Apply stabilizing transforms to INPUT_VIDEO_PATH and save to OUTPUT_VIDEO_PATH
# Using auto border sizing feature:
#    * Attempts to choose tightest border possible without cutting off frame
stabilizer.apply_transforms(INPUT_VIDEO_PATH,
                            OUTPUT_VIDEO_PATH,
                            border_size='auto')
codeclimate[bot] commented 5 years ago

Code Climate has analyzed commit 8dd311b2 and detected 0 issues on this pull request.

View more on Code Climate.

codecov[bot] commented 5 years ago

Codecov Report

Merging #62 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #62   +/-   ##
=======================================
  Coverage   88.37%   88.37%           
=======================================
  Files          14       14           
  Lines         473      473           
=======================================
  Hits          418      418           
  Misses         55       55
Impacted Files Coverage Δ
vidstab/VidStab.py 88.35% <100%> (ø) :arrow_up:
vidstab/version.py 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 553f7bc...8dd311b. Read the comment docs.