Read sampled frames from the test video, resized to 1280x720.
()
| 50 | |
| 51 | @pytest.fixture(scope="module") |
| 52 | def 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") |
nothing calls this directly
no outgoing calls
no test coverage detected