forked from zju3dv/OnePose
-
Notifications
You must be signed in to change notification settings - Fork 0
/
video2img.py
29 lines (21 loc) · 879 Bytes
/
video2img.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
import os.path as osp
from argparse import ArgumentParser
from pathlib import Path
from src.utils.data_utils import video2img
def main():
parser = ArgumentParser()
parser.add_argument("--input", required=True, help="The video file or directory to be parsed")
parser.add_argument("--downsample", default=1, type=int)
args = parser.parse_args()
input = args.input
if osp.isdir(input): # in case of directory which contains video file
video_file = osp.join(input, 'Frames.m4v')
else: # in case of video file
video_file = input
assert osp.exists(video_file), "Please input an valid video file!"
data_dir = osp.dirname(video_file)
out_dir = osp.join(data_dir, 'color_full')
Path(out_dir).mkdir(exist_ok=True, parents=True)
video2img(video_file, out_dir, args.downsample)
if __name__ == "__main__":
main()