File size: 831 Bytes
ba74f1a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import os
import json
from scripts.extract_frames import extract_frames
from scripts.cursor_tracker import track_cursor

def run_pipeline():
    video_dir = "videos"
    frames_dir = "frames"
    cursor_dir = "cursors"
    annotations_dir = "annotations"
    os.makedirs(frames_dir, exist_ok=True)
    os.makedirs(cursor_dir, exist_ok=True)
    os.makedirs(annotations_dir, exist_ok=True)
    # Step 1: Extract frames
    for video_file in os.listdir(video_dir):
        if video_file.lower().endswith(('.mp4', '.avi', '.mov')):
            extract_frames(os.path.join(video_dir, video_file), frames_dir)
    # Step 2: Track cursor
    track_cursor(frames_dir, cursor_dir, os.path.join(annotations_dir, "cursor_positions.json"))
    print("Pipeline complete.")

if __name__ == "__main__":
    run_pipeline()