From 6bdacffa2e11af86d2b20a4bc3c69ab0bea1eb9f Mon Sep 17 00:00:00 2001 From: blakeblackshear Date: Sun, 10 Feb 2019 20:09:25 -0600 Subject: [PATCH] reduce the motion detection timeout to 5 seconds --- detect_objects.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/detect_objects.py b/detect_objects.py index fe5174376..b15ea95e7 100644 --- a/detect_objects.py +++ b/detect_objects.py @@ -387,7 +387,7 @@ def process_frames(shared_arr, shared_output_arr, shared_frame_time, shared_moti # copy the detected objects to the output array, filling the array when needed shared_output_arr[:] = objects + [0.0] * (60-len(objects)) -# do the actual object detection +# do the actual motion detection def detect_motion(shared_arr, shared_frame_time, ready_for_frame, shared_motion, frame_shape, region_size, region_x_offset, region_y_offset, min_motion_area): # shape shared input array into frame for processing arr = tonumpyarray(shared_arr).reshape(frame_shape) @@ -398,8 +398,8 @@ def detect_motion(shared_arr, shared_frame_time, ready_for_frame, shared_motion, frame_time = 0.0 while True: now = datetime.datetime.now().timestamp() - # if it has been 30 seconds since the last motion, clear the flag - if last_motion > 0 and (now - last_motion) > 30: + # if it has been long enough since the last motion, clear the flag + if last_motion > 0 and (now - last_motion) > 5: last_motion = -1 shared_motion.value = 0 # if there isnt a frame ready for processing