@@ -254,22 +254,23 @@ def preprocess_output(self, inference_results, image, show_bbox=False):
254254 flattened_predictions = np .vstack (inference_results ).ravel ()
255255 eyes_coords = flattened_predictions [:4 ]
256256 h , w = image .shape [:2 ]
257+ eye_size = 10
257258
258259 left_eye_x_coord = int (eyes_coords [0 ] * w )
259- left_eye_xmin = left_eye_x_coord - 10
260- left_eye_xmax = left_eye_x_coord + 10
260+ left_eye_xmin = left_eye_x_coord - eye_size
261+ left_eye_xmax = left_eye_x_coord + eye_size
261262
262263 left_eye_y_coord = int (eyes_coords [1 ] * h )
263- left_eye_ymin = left_eye_y_coord - 10
264- left_eye_ymax = left_eye_y_coord + 10
264+ left_eye_ymin = left_eye_y_coord - eye_size
265+ left_eye_ymax = left_eye_y_coord + eye_size
265266
266267 right_eye_x_coord = int (eyes_coords [2 ] * w )
267- right_eye_xmin = right_eye_x_coord - 10
268- right_eye_xmax = right_eye_x_coord + 10
268+ right_eye_xmin = right_eye_x_coord - eye_size
269+ right_eye_xmax = right_eye_x_coord + eye_size
269270
270271 right_eye_y_coord = int (eyes_coords [3 ] * h )
271- right_eye_ymin = right_eye_y_coord - 10
272- right_eye_ymax = right_eye_y_coord + 10
272+ right_eye_ymin = right_eye_y_coord - eye_size
273+ right_eye_ymax = right_eye_y_coord + eye_size
273274
274275 eyes_coords = {
275276 "left_eye_point" : (left_eye_x_coord , left_eye_y_coord ),
@@ -286,7 +287,7 @@ def preprocess_output(self, inference_results, image, show_bbox=False):
286287 return eyes_coords , image
287288
288289 @staticmethod
289- def draw_output (image , eyes_coords , radius = 10 , color = (0 , 0 , 255 ), thickness = 2 ):
290+ def draw_output (image , eyes_coords , radius = 20 , color = (0 , 0 , 255 ), thickness = 2 ):
290291 """Draw a circle around ROI"""
291292 for eye , coords in eyes_coords .items ():
292293 if "point" in eye :
@@ -445,12 +446,11 @@ def preprocess_output(self, inference_results, image, show_bbox, **kwargs):
445446 def draw_output (coords , image , ** kwargs ):
446447 left_eye_point = kwargs ["eyes_coords" ]["left_eye_point" ]
447448 right_eye_point = kwargs ["eyes_coords" ]["right_eye_point" ]
448- print (left_eye_point )
449449 cv2 .arrowedLine (
450450 image ,
451451 (
452452 left_eye_point [0 ] + int (coords ["x" ] * 500 ),
453- left_eye_point [1 ] + int (- coords ["y" ] * 500 ),
453+ left_eye_point [1 ] - int (coords ["y" ] * 500 ),
454454 ),
455455 (left_eye_point [0 ], left_eye_point [1 ]),
456456 color = (0 , 0 , 255 ),
@@ -461,7 +461,7 @@ def draw_output(coords, image, **kwargs):
461461 image ,
462462 (
463463 right_eye_point [0 ] + int (coords ["x" ] * 500 ),
464- right_eye_point [1 ] + int (- coords ["y" ] * 500 ),
464+ right_eye_point [1 ] - int (coords ["y" ] * 500 ),
465465 ),
466466 (right_eye_point [0 ], right_eye_point [1 ]),
467467 color = (0 , 0 , 255 ),
0 commit comments