-
Notifications
You must be signed in to change notification settings - Fork 5
/
face_model.py
53 lines (43 loc) · 1.51 KB
/
face_model.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# -----------------------------------------------------------------------------------
# Company: TensorSense
# Project: LaserGaze
# File: face_model.py
# Description: A universal face model used for creating a head coordinate space. This
# module contains definitions of key facial points and is used for
# calculations within the context of head movement recognition and
# analysis.
# Author: Sergey Kuldin
# -----------------------------------------------------------------------------------
import numpy as np
INTERNAL_EYES_CORNERS_MODEL = np.array([
[-0.035, -0.05, 0],
[0.035, -0.05, 0]
])
OUTER_EYES_CORNERS_MODEL = np.array([
[-0.09, -0.057, 0.01],
[0.09, -0.057, 0.01]
])
OUTER_HEAD_POINTS_MODEL = np.array([
[-0.145, -0.1, 0.1],
[0.145, -0.1, 0.1]
])
NOSE_BRIDGE_MODEL = np.array([
[0, -0.0319, -0.0432]
])
NOSE_TIP_MODEL = np.array([
[0, 0.088, -0.071]
])
BASE_FACE_MODEL = np.vstack((
INTERNAL_EYES_CORNERS_MODEL,
OUTER_EYES_CORNERS_MODEL,
OUTER_HEAD_POINTS_MODEL,
NOSE_BRIDGE_MODEL,
NOSE_TIP_MODEL
))
DEFAULT_LEFT_EYE_CENTER_MODEL = (np.array(INTERNAL_EYES_CORNERS_MODEL[0]) + np.array(OUTER_EYES_CORNERS_MODEL[0])) * 0.5
DEFAULT_LEFT_EYE_CENTER_MODEL[1] -= 0.009
DEFAULT_LEFT_EYE_CENTER_MODEL[2] = 0.02
DEFAULT_RIGHT_EYE_CENTER_MODEL = (np.array(INTERNAL_EYES_CORNERS_MODEL[1]) + np.array(OUTER_EYES_CORNERS_MODEL[1])) * 0.5
DEFAULT_RIGHT_EYE_CENTER_MODEL[1] -= 0.009
DEFAULT_RIGHT_EYE_CENTER_MODEL[2] = 0.02
DEFAULT_EYE_RADIUS = 0.02