enhanced cropping of detected faces

This commit is contained in:
sotirismos 2022-01-18 22:33:22 +02:00
parent 549e74ad0d
commit 4e2f8aba88

View File

@ -55,7 +55,7 @@ def detect_face(detector, img, align = True):
for idx, d in enumerate(detections):
left = d.left(); right = d.right()
top = d.top(); bottom = d.bottom()
detected_face = img[top:bottom, left:right]
detected_face = img[max(0, top): min(bottom, img.shape[0]), max(0, left): min(right, img.shape[1])]
img_region = [left, top, right - left, bottom - top]
if align: