Add class variable and update in process_frames

This commit is contained in:
Josh Hawkins 2022-04-15 09:00:11 -05:00
parent 8fd8eaa270
commit e072788f35
2 changed files with 6 additions and 3 deletions

View File

@ -24,8 +24,9 @@ class MotionDetector:
) )
self.mask = np.where(resized_mask == [0]) self.mask = np.where(resized_mask == [0])
self.save_images = False self.save_images = False
self.improve_contrast = self.config.improve_contrast
def detect(self, frame, improve_contrast): def detect(self, frame):
motion_boxes = [] motion_boxes = []
gray = frame[0 : self.frame_shape[0], 0 : self.frame_shape[1]] gray = frame[0 : self.frame_shape[0], 0 : self.frame_shape[1]]
@ -38,7 +39,7 @@ class MotionDetector:
) )
# Improve contrast # Improve contrast
if improve_contrast: if self.improve_contrast:
minval = np.percentile(resized_frame, 4) minval = np.percentile(resized_frame, 4)
maxval = np.percentile(resized_frame, 96) maxval = np.percentile(resized_frame, 96)
# don't adjust if the image is a single color # don't adjust if the image is a single color

View File

@ -494,8 +494,10 @@ def process_frames(
logger.info(f"{camera_name}: frame {frame_time} is not in memory store.") logger.info(f"{camera_name}: frame {frame_time} is not in memory store.")
continue continue
motion_detector.improve_contrast = improve_contrast_enabled.value
# look for motion # look for motion
motion_boxes = motion_detector.detect(frame, improve_contrast_enabled.value) motion_boxes = motion_detector.detect(frame)
regions = [] regions = []