def test_cli_stabilizer():
    """just tests that function runs"""
    tmp_dir = tempfile.TemporaryDirectory()
    truncated_ostrich_video = '{}/trunc_vid.avi'.format(tmp_dir.name)
    download_truncated_ostrich_video(truncated_ostrich_video)

    args = {
        'input': truncated_ostrich_video,
        'output': '{}/output.avi'.format(tmp_dir),
        'playback': False,
        'keyPointMethod': 'GFTT',
        'smoothWindow': 1,
        'maxFrames': -1,
        'borderType': 'black',
        'borderSize': 0,
        'layerFrames': False
    }

    utils.cli_stabilizer(args)
Esempio n. 2
0
from vidstab import VidStab
from vidstab.download_videos import download_ostrich_video, download_truncated_ostrich_video
from .pickled_transforms import download_pickled_transforms, pickle_test_transforms

# excluding non-free "SIFT" & "SURF" methods do to exclusion from opencv-contrib-python
# see: https://github.com/skvark/opencv-python/issues/126
kp_methods = [
    "GFTT", "BRISK", "DENSE", "FAST", "HARRIS", "MSER", "ORB", "STAR"
]

tmp_dir = tempfile.TemporaryDirectory()

truncated_ostrich_video = '{}/trunc_vid.avi'.format(tmp_dir.name)
ostrich_video = '{}/vid.avi'.format(tmp_dir.name)

download_truncated_ostrich_video(truncated_ostrich_video)
download_ostrich_video(ostrich_video)


# test that all keypoint detection methods load without error
def test_default_init():
    for kp in kp_methods:
        print('testing kp method {}'.format(kp))
        assert VidStab(kp_method=kp).kp_method == kp


def test_kp_options():
    stabilizer = VidStab(kp_method='FAST',
                         threshold=42,
                         nonmaxSuppression=False)
    assert not stabilizer.kp_detector.getNonmaxSuppression()
Esempio n. 3
0
from vidstab import VidStab
from vidstab.download_videos import download_ostrich_video, download_truncated_ostrich_video
from .pickled_transforms import download_pickled_transforms, pickle_test_transforms

# atol value to use when comparing results using np.allclose
NP_ALLCLOSE_ATOL = 1e-3

# excluding non-free 'SIFT' & 'SURF' methods do to exclusion from opencv-contrib-python
# see: https://github.com/skvark/opencv-python/issues/126
KP_METHODS = ['GFTT', 'BRISK', 'DENSE', 'FAST', 'HARRIS', 'MSER', 'ORB', 'STAR']

tmp_dir = tempfile.TemporaryDirectory()
TRUNCATED_OSTRICH_VIDEO = '{}/trunc_vid.avi'.format(tmp_dir.name)
OSTRICH_VIDEO = '{}/vid.avi'.format(tmp_dir.name)

download_truncated_ostrich_video(TRUNCATED_OSTRICH_VIDEO)
download_ostrich_video(OSTRICH_VIDEO)


# test that all keypoint detection methods load without error
def test_default_init():
    for kp in KP_METHODS:
        print('testing kp method {}'.format(kp))
        assert VidStab(kp_method=kp).kp_method == kp


def test_kp_options():
    stabilizer = VidStab(kp_method='FAST', threshold=42, nonmaxSuppression=False)
    assert not stabilizer.kp_detector.getNonmaxSuppression()
    assert stabilizer.kp_detector.getThreshold() == 42