make the threshold configurable per region. fixes #31

This commit is contained in:
blakeblackshear
2019-05-11 07:39:27 -05:00
parent 6900e140d5
commit 3019b0218c
3 changed files with 14 additions and 3 deletions

View File

@@ -159,13 +159,19 @@ class Camera:
# for each region, create a separate thread to resize the region and prep for detection
self.detection_prep_threads = []
for region in self.config['regions']:
# set a default threshold of 0.5 if not defined
if not 'threshold' in region:
region['threshold'] = 0.5
if not isinstance(region['threshold'], float):
print('Threshold is not a float. Setting to 0.5 default.')
region['threshold'] = 0.5
self.detection_prep_threads.append(FramePrepper(
self.name,
self.shared_frame_np,
self.shared_frame_time,
self.frame_ready,
self.frame_lock,
region['size'], region['x_offset'], region['y_offset'],
region['size'], region['x_offset'], region['y_offset'], region['threshold'],
prepped_frame_queue
))