Skip to content

Commit

Permalink
Merge pull request #1138 from serengil/feat-task-2403-dlib-eye-locations
Browse files Browse the repository at this point in the history
get the centers of right and left eye
  • Loading branch information
serengil authored Mar 24, 2024
2 parents a3f04e6 + 97459d0 commit ad80a31
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions deepface/detectors/Dlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,15 @@ def detect_faces(self, img: np.ndarray) -> List[FacialAreaRegion]:
w = int(min(right, img.shape[1]) - x)

shape = self.model["sp"](img, detection)
left_eye = (shape.part(2).x, shape.part(2).y)
right_eye = (shape.part(0).x, shape.part(0).y)

left_eye = (
int((shape.part(2).x + shape.part(3).x) // 2),
int((shape.part(2).y + shape.part(3).y) // 2),
)
right_eye = (
int((shape.part(0).x + shape.part(1).x) // 2),
int((shape.part(0).y + shape.part(1).y) // 2),
)

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

0 comments on commit ad80a31

Please sign in to comment.