Draw motion mask first (#11598)

This draws the motion mask before the other overlay elements (such as bounding boxes), so that they are still visible. Fixes #11592
This commit is contained in:
James Tanner-McLeod 2024-05-28 14:44:20 -04:00 committed by GitHub
parent ced5ab203f
commit c95758580f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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(