From 7a1989703d55c6da528f70e099eae1bf2a8cc281 Mon Sep 17 00:00:00 2001 From: dksslq <1578756762@qq.com> Date: Wed, 31 Jan 2024 21:07:57 +0800 Subject: [PATCH] Drop first 20 frames before mse compare. --- examples/capture_motion.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/capture_motion.py b/examples/capture_motion.py index bbb6c490..69a489c6 100755 --- a/examples/capture_motion.py +++ b/examples/capture_motion.py @@ -20,11 +20,13 @@ prev = None encoding = False ltime = 0 +cnt = 0 while True: cur = picam2.capture_buffer("lores") cur = cur[:w * h].reshape(h, w) - if prev is not None: + cnt += 1 + if prev is not None and cnt >= 20: # Measure pixels differences between current and # previous frame mse = np.square(np.subtract(cur, prev)).mean()