Skip to main content
. 2024 Apr 4;24(7):2298. doi: 10.3390/s24072298
Algorithm 1
1. Result: Face attention binary value, ear value
2. Inputs: Facial landmarks X-Y coordinates
3. horizontal_left_distance = Euclidean distance between landmarks 2 and 31
4. horizontal_right_distance = Euclidean distance between landmarks 31 and 16
5. yaw = absolute value of the division between horizontal_left_distance and horizontal_right_distance
6. If yaw is greater than 1, then yaw = the reciprocal of yaw
7. yaw_attention_threshold = 0.4
8. If yaw is less than yaw_attention_threshold, face_attention = 0, otherwise face_attention = 1
9. horizontal_distance_pitch = Euclidean distance between landmarks 28 and 31
10. vertical_distance_pitch = Euclidean distance between landmarks 37 and 40 (if not null) or 43 and 46
11. pitch = absolute value of the division between horizontal_distance_pitch and vertical_distance_pitch
12. pitch_attention_threshold = 5
13. If pitch is less than pitch_attention_threshold, face_attention = 1, otherwise face_attention = 0
14. ear_attention_threshold = 0.10
15. If ear is less than ear_attention_threshold AND pitch is greater than pitch_attention_threshold, face_attention = 0