mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-02 17:25:22 +03:00
Use object processing instead of passing mqtt client around
This commit is contained in:
parent
657b59f39f
commit
f5b1f96164
@ -879,6 +879,12 @@ class TrackedObjectProcessor(threading.Thread):
|
|||||||
frame_time, current_tracked_objects, motion_boxes, regions
|
frame_time, current_tracked_objects, motion_boxes, regions
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self.client.publish(
|
||||||
|
f"{self.topic_prefix}/{camera}/motion/detected",
|
||||||
|
True if motion_boxes else False,
|
||||||
|
retain=False
|
||||||
|
)
|
||||||
|
|
||||||
tracked_objects = [
|
tracked_objects = [
|
||||||
o.to_dict() for o in camera_state.tracked_objects.values()
|
o.to_dict() for o in camera_state.tracked_objects.values()
|
||||||
]
|
]
|
||||||
|
|||||||
@ -340,8 +340,6 @@ def capture_camera(name, config: CameraConfig, process_info):
|
|||||||
def track_camera(
|
def track_camera(
|
||||||
name,
|
name,
|
||||||
config: CameraConfig,
|
config: CameraConfig,
|
||||||
mqtt_client,
|
|
||||||
mqtt_prefix,
|
|
||||||
model_shape,
|
model_shape,
|
||||||
labelmap,
|
labelmap,
|
||||||
detection_queue,
|
detection_queue,
|
||||||
@ -383,8 +381,6 @@ def track_camera(
|
|||||||
|
|
||||||
process_frames(
|
process_frames(
|
||||||
name,
|
name,
|
||||||
mqtt_client,
|
|
||||||
mqtt_prefix,
|
|
||||||
frame_queue,
|
frame_queue,
|
||||||
frame_shape,
|
frame_shape,
|
||||||
model_shape,
|
model_shape,
|
||||||
@ -472,8 +468,6 @@ def detect(
|
|||||||
|
|
||||||
def process_frames(
|
def process_frames(
|
||||||
camera_name: str,
|
camera_name: str,
|
||||||
mqtt_client,
|
|
||||||
mqtt_prefix,
|
|
||||||
frame_queue: mp.Queue,
|
frame_queue: mp.Queue,
|
||||||
frame_shape,
|
frame_shape,
|
||||||
model_shape,
|
model_shape,
|
||||||
@ -524,9 +518,6 @@ def process_frames(
|
|||||||
# look for motion if enabled
|
# look for motion if enabled
|
||||||
motion_boxes = motion_detector.detect(frame) if motion_enabled.value else []
|
motion_boxes = motion_detector.detect(frame) if motion_enabled.value else []
|
||||||
|
|
||||||
if mqtt_client:
|
|
||||||
mqtt_client(f"{mqtt_prefix}/{camera_name}/motion/detected", True if motion_boxes else False, False)
|
|
||||||
|
|
||||||
regions = []
|
regions = []
|
||||||
|
|
||||||
# if detection is disabled
|
# if detection is disabled
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user