915485eea2d35d3146d19033666673330260a87f
[facial-landmarks-for-cubism.git] / config.txt
1 # Config file for FacialLandmarksForCubism
2
3 # The path of this config file should be passed to the constructor
4 # of the FacialLandmarkDetector.
5
6 # Comments are lines that start with a '#' and are ignored by the parser.
7 # Note that a line will be considered as a comment ONLY IF the '#' is the
8 # very first character of the line, i.e. without any preceeding whitespace.
9
10
11 ## Section 1: dlib face detection and webcam parameters
12
13 # Path to the dlib shape predictor trained dataset
14 predictorPath ./shape_predictor_68_face_landmarks.dat
15
16 # Value passed to the cv::VideoCapture() ctor
17 cvVideoCaptureId 0
18
19 # Number of milliseconds to wait after processing each video frame
20 # This value controls the frame rate, but the actual frame period
21 # is longer due to the time required to process each frame
22 cvWaitKeyMs 5
23
24 # If 1, show the webcam captured video on-screen; if 0, don't show
25 showWebcamVideo 1
26
27 # If 1, draw the detected facial landmarks on-screen; if 0, don't draw
28 renderLandmarksOnVideo 1
29
30 # If 1, laterally invert the image (create a mirror image); if 0, don't invert
31 lateralInversion 1
32
33
34 ## Section 2: Cubism params calculation control
35 #
36 # These values control how the facial landmarks are translated into
37 # parameters that control the Cubism model, and will vary from person
38 # to person. The following values seem to work OK for my face, but
39 # your milage may vary.
40
41 # Section 2.1: Face Y direction angle (head pointing up/down)
42 # The Y angle is calculated mainly based on the angle formed
43 # by the corners and the tip of the nose (hereafter referred
44 # to as the "nose angle").
45
46 # This applies an offset (in degrees).
47 # If you have a webcam at the top of your monitor, then it is likely
48 # that when you look at the centre of your monitor, the captured image
49 # will have you looking downwards. This offset shifts the angle upwards,
50 # so that the resulting avatar will still be looking straight ahead.
51 faceYAngleCorrection 10
52
53 # This is the baseline value for the nose angle (in radians) when looking
54 # straight ahead...
55 faceYAngleZeroValue 1.8
56
57 # ... and this is when you are looking up...
58 faceYAngleUpThreshold 1.3
59
60 # ... and when looking down.
61 faceYAngleDownThreshold 2.3
62
63 # This is an additional multiplication factor applied per degree of rotation
64 # in the X direction (left/right) - since the nose angle reduces when
65 # turning your head left/right.
66 faceYAngleXRotCorrection 0.15
67
68 # This is the multiplication factor to reduce by when smiling or laughing -
69 # the nose angle increases in such cases.
70 faceYAngleSmileCorrection 0.075
71
72
73 # Section 2.2: Eye control
74 # This is mainly calculated based on the eye aspect ratio (eye height
75 # divided by eye width). Note that currently an average of the values
76 # of both eyes is applied - mainly due to two reasons: (1) the dlib
77 # dataset I'm using fails to detect winks for me, and (2) if this is
78 # not done, I frequently get asynchronous blinks which just looks ugly.
79
80 # Maximum eye aspect ratio when the eye is closed
81 eyeClosedThreshold 0.2
82
83 # Minimum eye aspect ratio when the eye is open
84 eyeOpenThreshold 0.25
85
86 # Max eye aspect ratio to switch to a closed "smiley eye"
87 eyeSmileEyeOpenThreshold 0.6
88
89 # Min "mouth form" value to switch to a closed "smiley eye"
90 # "Mouth form" is 1 when fully smiling / laughing, and 0 when normal
91 eyeSmileMouthFormThreshold 0.75
92
93 # Min "mouth open" value to switch to a closed "smiley eye"
94 # "Mouth open" is 1 when fully open, and 0 when closed
95 eyeSmileMouthOpenThreshold 0.5
96
97
98 # Section 2.3: Mouth control
99 # Two parameters are passed to Cubism to control the mouth:
100 #  - mouth form: Controls smiles / laughs
101 #  - mouth openness: How widely open the mouth is
102 # Mouth form is calculated by the ratio between the mouth width
103 # and the eye separation (distance between the two eyes).
104 # Mouth openness is calculated by the ratio between the lip separation
105 # (distance between upper and lower lips) and the mouth width.
106
107 # Max mouth-width-to-eye-separation ratio to have a normal resting mouth
108 mouthNormalThreshold 0.75
109
110 # Min mouth-width-to-eye-separation ratio to have a fully smiling
111 # or laughing mouth
112 mouthSmileThreshold 1.0
113
114 # Max lip-separation-to-mouth-width ratio to have a closed mouth
115 mouthClosedThreshold 0.1
116
117 # Min lip-separation-to-mouth-width ratio to have a fully opened mouth
118 mouthOpenThreshold 0.4
119
120 # Additional multiplication factor applied to the mouth openness parameter
121 # when the mouth is fully smiling / laughing, since doing so increases
122 # the mouth width
123 mouthOpenLaughCorrection 0.2
124
125
126 ## Section 3: Filtering parameters
127 # The facial landmark coordinates can be quite noisy, so I've applied
128 # a simple moving average filter to reduce noise. More taps would mean
129 # more samples to average over, hence smoother movements with less noise,
130 # but it will also cause more lag between your movement and the movement
131 # of the avatar, and quick movements (e.g. blinks) may be completely missed.
132
133 faceXAngleNumTaps 11
134 faceYAngleNumTaps 11
135 faceZAngleNumTaps 11
136 mouthFormNumTaps 3
137 mouthOpenNumTaps 3
138 leftEyeOpenNumTaps 3
139 rightEyeOpenNumTaps 3
140