CU1 / scripts /pipeline.py
Fred808's picture
Upload 13 files
cb91e74 verified
raw
history blame contribute delete
831 Bytes
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()