Apply face area check to cv2 face detection

This commit is contained in:
Nicolas Mowen 2025-05-12 07:32:30 -06:00
parent 1d77ddab88
commit 170688cc4c

View File

@ -221,6 +221,13 @@ class FaceRealTimeProcessor(RealTimeProcessorApi):
max(0, face_box[0]) : min(frame.shape[1], face_box[2]), max(0, face_box[0]) : min(frame.shape[1], face_box[2]),
] ]
# check that face is correct size
if area(face_box) < self.config.cameras[camera].face_recognition.min_area:
logger.debug(
f"Detected face that is smaller than the min_area {face} < {self.config.cameras[camera].face_recognition.min_area}"
)
return
try: try:
face_frame = cv2.cvtColor(face_frame, cv2.COLOR_RGB2BGR) face_frame = cv2.cvtColor(face_frame, cv2.COLOR_RGB2BGR)
except Exception: except Exception: