INNER CODE UNIT · Python
t
vardanagarwal/Proctoring-AI · eye_tracker.py:38
t = (points[1][1]+points[2][1])//2
r = points[3][0]
b = (points[4][1]+points[5][1])//2
return mask, [l, t, r, b]
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)
if x_ratio > 3:
return 1
elif x_ratio < 0.33:
return 2
elif y_ratio < 0.33:
return 3
else:
return 0