Merge pull request #1138 from serengil/feat-task-2403-dlib-eye-locations

get the centers of right and left eye
This commit is contained in:
Sefik Ilkin Serengil 2024-03-24 16:01:07 +00:00 committed by GitHub
commit ad80a31807
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -87,8 +87,15 @@ class DlibClient(Detector):
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]