Upload api.py
Browse files
api.py
CHANGED
|
@@ -281,7 +281,10 @@ def process_video_job(job_id: str):
|
|
| 281 |
facial_area = det.get('facial_area', {})
|
| 282 |
if facial_area:
|
| 283 |
x, y, w, h = facial_area.get('x', 0), facial_area.get('y', 0), facial_area.get('w', 0), facial_area.get('h', 0)
|
| 284 |
-
|
|
|
|
|
|
|
|
|
|
| 285 |
top, left, bottom, right = max(0, y), max(0, x), min(frame.shape[0], y+h), min(frame.shape[1], x+w)
|
| 286 |
boxes_haar.append((top, right, bottom, left))
|
| 287 |
tmp_detect.unlink(missing_ok=True)
|
|
|
|
| 281 |
facial_area = det.get('facial_area', {})
|
| 282 |
if facial_area:
|
| 283 |
x, y, w, h = facial_area.get('x', 0), facial_area.get('y', 0), facial_area.get('w', 0), facial_area.get('h', 0)
|
| 284 |
+
# Validar que es un bbox real, no el frame completo
|
| 285 |
+
# Si el bbox es prácticamente el frame completo, descartarlo
|
| 286 |
+
is_full_frame = (x <= 5 and y <= 5 and w >= frame.shape[1] - 10 and h >= frame.shape[0] - 10)
|
| 287 |
+
if w > 30 and h > 30 and not is_full_frame:
|
| 288 |
top, left, bottom, right = max(0, y), max(0, x), min(frame.shape[0], y+h), min(frame.shape[1], x+w)
|
| 289 |
boxes_haar.append((top, right, bottom, left))
|
| 290 |
tmp_detect.unlink(missing_ok=True)
|