crop_face #1

Merged
s444409 merged 4 commits from crop_face into main 2023-01-29 21:15:22 +01:00
Showing only changes of commit 56eede6777 - Show all commits

View File

@ -8,6 +8,7 @@ import numpy as np
from source.cartoonize import Cartoonizer
def load_source(filename: str) -> np.ndarray:
return cv2.imread(filename)[...,::-1]
@ -17,7 +18,7 @@ def find_and_crop_face(data: np.ndarray) -> np.ndarray:
face_cascade = cv2.CascadeClassifier('haarcascades/haarcascade_frontalface_default.xml')
face = face_cascade.detectMultiScale(data_gray, 1.3, 4)
face = max(face, key=len)
s444409 marked this conversation as resolved
Review

x, y, w, h = face

`x, y, w, h = face`
(x, y, w, h) = face
x, y, w, h = face
face = data[y:y + h, x:x + w]
return face