fix: numpy typing error

This commit is contained in:
Dowon
2024-05-19 23:36:20 +09:00
parent fb5401e22b
commit 9d1b6bf64a

View File

@@ -98,7 +98,9 @@ def mediapipe_face_mesh(image: Image.Image, confidence: float = 0.3) -> PredictO
connection_drawing_spec=drawing_styles.get_default_face_mesh_tesselation_style(),
)
points = np.intp([(land.x * w, land.y * h) for land in landmarks.landmark])
points = np.array(
[[land.x * w, land.y * h] for land in landmarks.landmark], dtype=int
)
outline = cv2.convexHull(points).reshape(-1).tolist()
mask = Image.new("L", image.size, "black")
@@ -136,7 +138,9 @@ def mediapipe_face_mesh_eyes_only(
masks = []
for landmarks in pred.multi_face_landmarks:
points = np.intp([(land.x * w, land.y * h) for land in landmarks.landmark])
points = np.array(
[[land.x * w, land.y * h] for land in landmarks.landmark], dtype=int
)
left_eyes = points[left_idx]
right_eyes = points[right_idx]
left_outline = cv2.convexHull(left_eyes).reshape(-1).tolist()