crop_face #1
3
main.py
3
main.py
@ -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
|
||||
(x, y, w, h) = face
|
||||
x, y, w, h = face
|
||||
face = data[y:y + h, x:x + w]
|
||||
return face
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user
x, y, w, h = face