Update to Cubism SDK 4-r.2. Incompatible scaling changes.
[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.0: Live2D automatic functionality
42 # Set 1 to enable, 0 to disable.
43 # If these are set, the automatic functionality in Live2D will be enabled.
44 # Note: If you set auto blink, eye control will be disabled.
45 autoBlink 0
46 autoBreath 0
47 randomMotion 0
48
49 # Section 2.1: Face Y direction angle (head pointing up/down)
50 # The Y angle is calculated mainly based on the angle formed
51 # by the corners and the tip of the nose (hereafter referred
52 # to as the "nose angle").
53
54 # This applies an offset (in degrees).
55 # If you have a webcam at the top of your monitor, then it is likely
56 # that when you look at the centre of your monitor, the captured image
57 # will have you looking downwards. This offset shifts the angle upwards,
58 # so that the resulting avatar will still be looking straight ahead.
59 faceYAngleCorrection 10
60
61 # This is the baseline value for the nose angle (in radians) when looking
62 # straight ahead...
63 faceYAngleZeroValue 1.8
64
65 # ... and this is when you are looking up...
66 faceYAngleUpThreshold 1.3
67
68 # ... and when looking down.
69 faceYAngleDownThreshold 2.3
70
71 # This is an additional multiplication factor applied per degree of rotation
72 # in the X direction (left/right) - since the nose angle reduces when
73 # turning your head left/right.
74 faceYAngleXRotCorrection 0.15
75
76 # This is the multiplication factor to reduce by when smiling or laughing -
77 # the nose angle increases in such cases.
78 faceYAngleSmileCorrection 0.075
79
80
81 # Section 2.2: Eye control
82 # This is mainly calculated based on the eye aspect ratio (eye height
83 # divided by eye width). Note that currently an average of the values
84 # of both eyes is applied - mainly due to two reasons: (1) the dlib
85 # dataset I'm using fails to detect winks for me, and (2) if this is
86 # not done, I frequently get asynchronous blinks which just looks ugly.
87
88 # Maximum eye aspect ratio when the eye is closed
89 eyeClosedThreshold 0.2
90
91 # Minimum eye aspect ratio when the eye is open
92 eyeOpenThreshold 0.25
93
94 # Max eye aspect ratio to switch to a closed "smiley eye"
95 eyeSmileEyeOpenThreshold 0.6
96
97 # Min "mouth form" value to switch to a closed "smiley eye"
98 # "Mouth form" is 1 when fully smiling / laughing, and 0 when normal
99 eyeSmileMouthFormThreshold 0.75
100
101 # Min "mouth open" value to switch to a closed "smiley eye"
102 # "Mouth open" is 1 when fully open, and 0 when closed
103 eyeSmileMouthOpenThreshold 0.5
104
105
106 # Section 2.3: Mouth control
107 # Two parameters are passed to Cubism to control the mouth:
108 #  - mouth form: Controls smiles / laughs
109 #  - mouth openness: How widely open the mouth is
110 # Mouth form is calculated by the ratio between the mouth width
111 # and the eye separation (distance between the two eyes).
112 # Mouth openness is calculated by the ratio between the lip separation
113 # (distance between upper and lower lips) and the mouth width.
114
115 # Max mouth-width-to-eye-separation ratio to have a normal resting mouth
116 mouthNormalThreshold 0.75
117
118 # Min mouth-width-to-eye-separation ratio to have a fully smiling
119 # or laughing mouth
120 mouthSmileThreshold 1.0
121
122 # Max lip-separation-to-mouth-width ratio to have a closed mouth
123 mouthClosedThreshold 0.1
124
125 # Min lip-separation-to-mouth-width ratio to have a fully opened mouth
126 mouthOpenThreshold 0.4
127
128 # Additional multiplication factor applied to the mouth openness parameter
129 # when the mouth is fully smiling / laughing, since doing so increases
130 # the mouth width
131 mouthOpenLaughCorrection 0.2
132
133
134 ## Section 3: Filtering parameters
135 # The facial landmark coordinates can be quite noisy, so I've applied
136 # a simple moving average filter to reduce noise. More taps would mean
137 # more samples to average over, hence smoother movements with less noise,
138 # but it will also cause more lag between your movement and the movement
139 # of the avatar, and quick movements (e.g. blinks) may be completely missed.
140
141 faceXAngleNumTaps 11
142 faceYAngleNumTaps 11
143 faceZAngleNumTaps 11
144 mouthFormNumTaps 3
145 mouthOpenNumTaps 3
146 leftEyeOpenNumTaps 3
147 rightEyeOpenNumTaps 3
148