scan the frame on startup

This commit is contained in:
Blake Blackshear 2022-02-05 07:10:00 -06:00
parent db369a5b7f
commit f1ddd0e6f7

View File

@ -470,6 +470,8 @@ def process_frames(
fps_tracker = EventsPerSecond() fps_tracker = EventsPerSecond()
fps_tracker.start() fps_tracker.start()
startup_scan_counter = 0
while not stop_event.is_set(): while not stop_event.is_set():
if exit_on_empty and frame_queue.empty(): if exit_on_empty and frame_queue.empty():
logger.info(f"Exiting track_objects...") logger.info(f"Exiting track_objects...")
@ -553,6 +555,19 @@ def process_frames(
for a in reduce_boxes(regions, 0.4) for a in reduce_boxes(regions, 0.4)
] ]
# if starting up, get the next startup scan region
if startup_scan_counter < 9 and len(regions) == 0:
ymin = int(frame_shape[0] / 3 * startup_scan_counter / 3)
ymax = int(frame_shape[0] / 3 + ymin)
xmin = int(frame_shape[1] / 3 * startup_scan_counter / 3)
xmax = int(frame_shape[1] / 3 + xmin)
regions.append(
calculate_region(
frame_shape, xmin, ymin, xmax, ymax, region_min_size, multiplier=1.2
)
)
startup_scan_counter += 1
# resize regions and detect # resize regions and detect
# seed with stationary objects # seed with stationary objects
detections = [ detections = [