issue 1123 resolved

for opencv and ssd, we were finding eyes from the detected faces. that is why,
eye coordinates were inccorrect with respect to the image itself. we added the
x and y coordinates of the detected face into the eye coordinates.
This commit is contained in:
Sefik Ilkin Serengil 2024-03-19 08:31:41 +00:00
parent 22eebc0a01
commit 2cbfc417a4
2 changed files with 11 additions and 0 deletions

View File

@ -53,6 +53,12 @@ class OpenCvClient(Detector):
for (x, y, w, h), confidence in zip(faces, scores): for (x, y, w, h), confidence in zip(faces, scores):
detected_face = img[int(y) : int(y + h), int(x) : int(x + w)] detected_face = img[int(y) : int(y + h), int(x) : int(x + w)]
left_eye, right_eye = self.find_eyes(img=detected_face) left_eye, right_eye = self.find_eyes(img=detected_face)
# eyes found in the detected face instead image itself
# detected face's coordinates should be added
left_eye = (x + left_eye[0], y + left_eye[1])
right_eye = (x + right_eye[0], y + right_eye[1])
facial_area = FacialAreaRegion( facial_area = FacialAreaRegion(
x=x, x=x,
y=y, y=y,

View File

@ -132,6 +132,11 @@ class SsdClient(Detector):
left_eye, right_eye = opencv_module.find_eyes(detected_face) left_eye, right_eye = opencv_module.find_eyes(detected_face)
# eyes found in the detected face instead image itself
# detected face's coordinates should be added
left_eye = (x + left_eye[0], y + left_eye[1])
right_eye = (x + right_eye[0], y + right_eye[1])
facial_area = FacialAreaRegion( facial_area = FacialAreaRegion(
x=x, x=x,
y=y, y=y,