vardanagarwal / Proctoring-AI

Creating a software for automatic monitoring in online proctoring
MIT License
540 stars 329 forks source link

Questions about eye_tracker #32

Closed cse0616 closed 3 years ago

cse0616 commented 3 years ago

def find_eyeball_position(end_points, cx, cy): """Find and return the eyeball positions, i.e. left or right or top or normal""" x_ratio = (end_points[0] - cx) / (cx - end_points[2]) y_ratio = (cy - end_points[1]) / (end_points[3] - cy) print(x_ratio, cx, cy) if x_ratio > 3: return 1 elif x_ratio < 0.33: return 2 elif y_ratio < 0.33: return 3 else: return 0

=========================================== Hi Your code is very helpful for me, but I am stuck with a problem.

  1. What are x_ratio and y_ratio?
  2. What is end_points?
  3. Why did you use 3 and 0.33? Do you have special reason?

Thank you so much.

vardanagarwal commented 3 years ago

CX and CY are the pupil's coordinates. The end_poiints represent the bounding box coordinates of the eye.

x_ratio and y_ratio would hence represent how far they are from the centre as can be seen by the formula. If pupil is exactly at center they would be 1. For left x_ratio would go less than 1 and for right greater than 1.

If do not lie within the threshold of 0.33 and 3 that means they are not looking straight. These values were manually taken and divine the eye into six portions with the last ones being the target ones. There was no exact special reason to them, it's just it performed well while testing, however you can set what you like.