MCPcopy Create free account
hub / github.com/AggieSportsAnalytics/CourtCheck / sampled_frames

Function sampled_frames

backend/tests/test_player_tracking.py:52–66  ·  view source on GitHub ↗

Read sampled frames from the test video, resized to 1280x720.

()

Source from the content-addressed store, hash-verified

50
51@pytest.fixture(scope="module")
52def sampled_frames():
53 """Read sampled frames from the test video, resized to 1280x720."""
54 cap = cv2.VideoCapture(VIDEO_PATH)
55 assert cap.isOpened(), f"Cannot open video: {VIDEO_PATH}"
56 total = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
57 indices = list(range(0, total, SAMPLE_STEP))
58 frames = []
59 for idx in indices:
60 cap.set(cv2.CAP_PROP_POS_FRAMES, idx)
61 ret, frame = cap.read()
62 if ret:
63 frames.append((idx, cv2.resize(frame, TARGET_SIZE)))
64 cap.release()
65 assert len(frames) > 10, f"Too few frames sampled: {len(frames)}"
66 return frames
67
68
69@pytest.fixture(scope="module")

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected