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()