-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_video.py
72 lines (60 loc) · 3.03 KB
/
test_video.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
59
60
61
62
63
64
65
66
67
68
69
70
import os
from tqdm import tqdm, trange
from utils.video2keypoints import video2keypoints
def test(input_dir,output_dir,static_hand = True,smoothing="OneEuroFilter"):
obj = os.scandir(input_dir)
for entry in tqdm(list(obj),desc=input_dir):
if entry.is_file() and entry.name.endswith('.mp4'):
name = entry.name.split('.')[0]
video2keypoints(input_path= os.path.join(input_dir,name+'.mp4'),
output_path= os.path.join(output_dir,name),
display_captured=False,
loop=False,
static_hand=static_hand,
smoothing=smoothing,
duration=2.0
)
def test2():
video2keypoints(input_path="./videos/1.mp4",
output_path="./output2/push_pull",
display_captured=False,
loop=False,
static_hand=False,
smoothing="MovingAverageFilter",
)
video2keypoints(input_path="./videos/2.mp4",
output_path="./output2/beckoned",
display_captured=False,
loop=False,
static_hand=True,
smoothing="OneEuroFilter",
)
video2keypoints(input_path="./videos/3.mp4",
output_path="./output2/rub_fingers",
display_captured=False,
loop=False,
static_hand=True,
smoothing="OneEuroFilter",
)
if __name__ == "__main__":
video2keypoints(input_path="./videos/1.mp4", # 输入视频路径
# output_path="./output2/push_pull", # 输出关键点路径
display_captured=True, # 显示坐标点转化GUI截面
loop=True, # 循环播放
static_hand=False, # 固定手部位置,减少抖动
smoothing="OneEuroFilter", # 选择滤波器
)
# test2()
# video2keypoints(input_path=0,display_captured=True,static_hand=False,smoothing="") # webcam visualization
# test('/media/rzy/76800D98800D5FCB/Codes/record/push_pull','./data/keypoints/push_pull/',static_hand=False, smoothing="MovingAverageFilter")
# # for filename in os.listdir('./data/keypoints/beckoned/'):
# # file_path = os.path.join('./data/keypoints/beckoned/', filename)
# # if os.path.isfile(file_path):
# # os.remove(file_path)
# test('/media/rzy/76800D98800D5FCB/Codes/record/beckoned','./data/keypoints/beckoned/')
# test('/media/rzy/76800D98800D5FCB/Codes/record/rub_finger','./data/keypoints/rub_finger/')
# for filename in os.listdir('./data/keypoints/test/'):
# file_path = os.path.join('./data/keypoints/test/', filename)
# if os.path.isfile(file_path):
# os.remove(file_path)
# test('/media/rzy/76800D98800D5FCB/Codes/record/test','./data/keypoints/test/')