|
|
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)
|
|
|
|
|
|
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)
|
|
|
|
|
|
track_cursor(frames_dir, cursor_dir, os.path.join(annotations_dir, "cursor_positions.json"))
|
|
|
print("Pipeline complete.")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
run_pipeline()
|
|
|
|