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:
|
||||
s444409 marked this conversation as resolved
Outdated
|
||||
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
s444409
commented
`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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user
Tutaj ta jedna linia powinna zostać - PEP mówi, że w global scope funkcje powinny być oddzielone dwoma pustymi liniami
PEP 8: E302 expected 2 blank lines, found 1