2026-05-18-21-20-13 改为逐帧生成结果视频
This commit is contained in:
@@ -80,6 +80,8 @@ def test_segment_video_and_compare_frame(tmp_path: Path):
|
||||
result_fps = float(result_capture.get(cv2.CAP_PROP_FPS) or 0)
|
||||
result_capture.set(cv2.CAP_PROP_POS_FRAMES, 1)
|
||||
ok, carried_overlay = result_capture.read()
|
||||
result_capture.set(cv2.CAP_PROP_POS_FRAMES, second_frame["frame_index"])
|
||||
ok_selected, selected_video_frame = result_capture.read()
|
||||
result_capture.release()
|
||||
assert result_frames == 18
|
||||
assert abs((result_frames / result_fps) - payload["duration"]) < 0.25
|
||||
@@ -90,6 +92,11 @@ def test_segment_video_and_compare_frame(tmp_path: Path):
|
||||
& (carried_overlay[:, :, 0] < 150)
|
||||
).sum()
|
||||
assert yellow_pixels > 0
|
||||
assert ok_selected
|
||||
selected_overlay = cv2.imread(str(ROOT / second_frame["overlay_url"].lstrip("/")))
|
||||
assert selected_overlay is not None
|
||||
selected_delta = cv2.absdiff(selected_video_frame, selected_overlay).mean()
|
||||
assert selected_delta < 20.0
|
||||
|
||||
with video_path.open("rb") as handle:
|
||||
compare = client.post(
|
||||
|
||||
Reference in New Issue
Block a user