Upload app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import json
|
| 3 |
+
from scripts.extract_frames import extract_frames
|
| 4 |
+
from scripts.cursor_tracker import track_cursor
|
| 5 |
+
|
| 6 |
+
def run_pipeline():
|
| 7 |
+
video_dir = "videos"
|
| 8 |
+
frames_dir = "frames"
|
| 9 |
+
cursor_dir = "cursors"
|
| 10 |
+
annotations_dir = "annotations"
|
| 11 |
+
os.makedirs(frames_dir, exist_ok=True)
|
| 12 |
+
os.makedirs(cursor_dir, exist_ok=True)
|
| 13 |
+
os.makedirs(annotations_dir, exist_ok=True)
|
| 14 |
+
# Step 1: Extract frames
|
| 15 |
+
for video_file in os.listdir(video_dir):
|
| 16 |
+
if video_file.lower().endswith(('.mp4', '.avi', '.mov')):
|
| 17 |
+
extract_frames(os.path.join(video_dir, video_file), frames_dir)
|
| 18 |
+
# Step 2: Track cursor
|
| 19 |
+
track_cursor(frames_dir, cursor_dir, os.path.join(annotations_dir, "cursor_positions.json"))
|
| 20 |
+
print("Pipeline complete.")
|
| 21 |
+
|
| 22 |
+
if __name__ == "__main__":
|
| 23 |
+
run_pipeline()
|