-
Notifications
You must be signed in to change notification settings - Fork 121
/
visual_inspection_tests.py
58 lines (51 loc) · 1.98 KB
/
visual_inspection_tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"""Playback tests for visual inspection of output
PROFILING PIPELINE:
$ python -m cProfile -o temp.dat visual_inspection_tests.py
$ snakeviz temp.dat
"""
import tempfile
from vidstab import VidStab, layer_overlay
import vidstab.download_videos as dl
tmp_dir = tempfile.TemporaryDirectory()
##################################################################
# TEST APPLYING OSTRICH TRANSFORMS TO DIFFERENT VIDEO
##################################################################
# download_to_path = f'{tmp_dir.name}/test_video.mp4'
# dl.download_ostrich_video(download_to_path)
# stabilizer = VidStab()
# stabilizer.gen_transforms(download_to_path)
# download_to_path = f'{tmp_dir.name}/test_video.mp4'
# dl.download_skateline_video(download_to_path)
# stabilizer.apply_transforms(download_to_path,
# 'stable.avi',
# border_size='auto',
# playback=True)
##################################################################
# TEST TYPICAL STABILIZATION PROCESS
##################################################################
download_to_path = f'{tmp_dir.name}/test_video.mp4'
dl.download_ostrich_video(download_to_path)
# dl.download_skateline_video(download_to_path)
stabilizer = VidStab()
stabilizer.stabilize(download_to_path,
'stable.avi',
# max_frames=30,
border_type='black',
border_size='auto',
layer_func=layer_overlay,
playback=True)
##################################################################
# TEST PLOT OUTPUT
##################################################################
# import matplotlib.pyplot as plt
#
# download_to_path = f'{tmp_dir.name}/test_video.mp4'
# dl.download_ostrich_video(download_to_path)
# stabilizer = VidStab()
# stabilizer.gen_transforms(download_to_path)
#
# stabilizer.plot_transforms()
# plt.show()
#
# stabilizer.plot_transforms(radians=True)
# plt.show()