Skip to content

Commit 97459d0

Browse files
committed
get the centers of right and left eye
1 parent a3f04e6 commit 97459d0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

deepface/detectors/Dlib.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,15 @@ def detect_faces(self, img: np.ndarray) -> List[FacialAreaRegion]:
8787
w = int(min(right, img.shape[1]) - x)
8888

8989
shape = self.model["sp"](img, detection)
90-
left_eye = (shape.part(2).x, shape.part(2).y)
91-
right_eye = (shape.part(0).x, shape.part(0).y)
90+
91+
left_eye = (
92+
int((shape.part(2).x + shape.part(3).x) // 2),
93+
int((shape.part(2).y + shape.part(3).y) // 2),
94+
)
95+
right_eye = (
96+
int((shape.part(0).x + shape.part(1).x) // 2),
97+
int((shape.part(0).y + shape.part(1).y) // 2),
98+
)
9299

93100
# never saw confidence higher than +3.5 github.com/davisking/dlib/issues/761
94101
confidence = scores[idx]

0 commit comments

Comments
 (0)