File size: 975 Bytes
586fccb
cf92dec
 
 
9e2567f
 
586fccb
9e2567f
 
 
586fccb
9e2567f
 
 
 
586fccb
 
 
 
 
 
 
 
9e2567f
94d52e2
 
 
 
 
 
 
 
9e2567f
 
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
import subprocess, sys, os
import tyro
from pixel3dmm import env_paths

def run_and_check(cmd, cwd=None):
    print(f"> {' '.join(cmd)}  (in {cwd or os.getcwd()})")
    # stream logs live
    result = subprocess.run(
        cmd,
        cwd=cwd,
        check=True,
    )
    return result

def main(video_or_images_path: str):
    vid_name = (
        os.path.basename(video_or_images_path)
        if os.path.isdir(video_or_images_path)
        else os.path.splitext(os.path.basename(video_or_images_path))[0]
    )

    SCRIPTS = os.path.join(env_paths.CODE_BASE, "scripts")
    MICA    = os.path.join(env_paths.CODE_BASE, "src", "pixel3dmm", "preprocessing", "MICA")

    run_and_check(
        [sys.executable, "-u", "run_cropping.py", "--video_or_images_path", video_or_images_path],
        cwd=SCRIPTS,
    )
    run_and_check(
        [sys.executable, "-u", "demo.py", "-video_name", vid_name],
        cwd=MICA,
    )
if __name__ == "__main__":
    tyro.cli(main)