mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-02 17:25:22 +03:00
Pass to constructor
This commit is contained in:
parent
e072788f35
commit
e4852821ec
@ -5,7 +5,7 @@ from frigate.config import MotionConfig
|
|||||||
|
|
||||||
|
|
||||||
class MotionDetector:
|
class MotionDetector:
|
||||||
def __init__(self, frame_shape, config: MotionConfig):
|
def __init__(self, frame_shape, config: MotionConfig, improve_contrast_enabled):
|
||||||
self.config = config
|
self.config = config
|
||||||
self.frame_shape = frame_shape
|
self.frame_shape = frame_shape
|
||||||
self.resize_factor = frame_shape[0] / config.frame_height
|
self.resize_factor = frame_shape[0] / config.frame_height
|
||||||
@ -24,7 +24,7 @@ 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
|
self.improve_contrast = improve_contrast_enabled.value
|
||||||
|
|
||||||
def detect(self, frame):
|
def detect(self, frame):
|
||||||
motion_boxes = []
|
motion_boxes = []
|
||||||
|
|||||||
@ -354,7 +354,7 @@ def track_camera(
|
|||||||
objects_to_track = config.objects.track
|
objects_to_track = config.objects.track
|
||||||
object_filters = config.objects.filters
|
object_filters = config.objects.filters
|
||||||
|
|
||||||
motion_detector = MotionDetector(frame_shape, config.motion)
|
motion_detector = MotionDetector(frame_shape, config.motion, improve_contrast_enabled)
|
||||||
object_detector = RemoteObjectDetector(
|
object_detector = RemoteObjectDetector(
|
||||||
name, labelmap, detection_queue, result_connection, model_shape
|
name, labelmap, detection_queue, result_connection, model_shape
|
||||||
)
|
)
|
||||||
@ -494,8 +494,6 @@ 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)
|
motion_boxes = motion_detector.detect(frame)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user