Skip to content

NVR with realtime local object detection for IP cameras

Draw motion mask first (#11598)

James Tanner-McLeodc95758580fe7
diff --git a/frigate/object_processing.py b/frigate/object_processing.py
index 676c175ecd..7ac0b7276c 100644
--- a/frigate/object_processing.py
+++ b/frigate/object_processing.py
@@ -498,6 +498,10 @@ class CameraState:
frame_copy = cv2.cvtColor(frame_copy, cv2.COLOR_YUV2BGR_I420)
# draw on the frame
+ if draw_options.get("mask"):
+ mask_overlay = np.where(self.camera_config.motion.mask == [0])
+ frame_copy[mask_overlay] = [0, 0, 0]
+
if draw_options.get("bounding_boxes"):
# draw the bounding boxes on the frame
for obj in tracked_objects.values():
@@ -622,10 +626,6 @@ class CameraState:
)
cv2.drawContours(frame_copy, [zone.contour], -1, zone.color, thickness)
- if draw_options.get("mask"):
- mask_overlay = np.where(self.camera_config.motion.mask == [0])
- frame_copy[mask_overlay] = [0, 0, 0]
-
if draw_options.get("motion_boxes"):
for m_box in motion_boxes:
cv2.rectangle(