MCPcopy Create free account
hub / github.com/Breakthrough/PySceneDetect / calculate_frame_delta

Function calculate_frame_delta

tests/test_video_stream.py:50–55  ·  view source on GitHub ↗
(frame_a, frame_b, roi=None)

Source from the content-addressed store, hash-verified

48
49
50def calculate_frame_delta(frame_a, frame_b, roi=None) -> float:
51 if roi:
52 raise RuntimeError("TODO")
53 assert frame_a.shape == frame_b.shape
54 num_pixels = frame_a.shape[0] * frame_a.shape[1]
55 return numpy.sum(numpy.abs(frame_b - frame_a)) / num_pixels
56
57
58# TODO: Reduce code duplication here and in `conftest.py`

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected