@@ -34,7 +34,7 @@ public static class EyeTrackingParams
3434 #region Dilation
3535
3636 new EParam ( "EyesDilation" , exp => exp . Eye . Combined ( ) . PupilDiameter_MM ) ,
37- new EParam ( "EyesPupilDiameter" , exp => ( exp . Eye . Left . PupilDiameter_MM + exp . Eye . Left . PupilDiameter_MM ) / 2.0f ) ,
37+ new EParam ( "EyesPupilDiameter" , exp => ( exp . Eye . Left . PupilDiameter_MM + exp . Eye . Right . PupilDiameter_MM ) * .5f ) ,
3838
3939 #endregion
4040
@@ -50,8 +50,10 @@ public static class EyeTrackingParams
5050
5151 new EParam ( "LeftEyeLidExpanded" , exp => exp . Shapes [ ( int ) UnifiedExpressions . EyeWideLeft ] . Weight * 0.2f + exp . Eye . Left . Openness * 0.8f , 0.5f , true ) ,
5252 new EParam ( "RightEyeLidExpanded" , exp => exp . Shapes [ ( int ) UnifiedExpressions . EyeWideRight ] . Weight * 0.2f + exp . Eye . Right . Openness * 0.8f , 0.5f , true ) ,
53- new EParam ( "EyeLidExpanded" , exp => ( ( exp . Shapes [ ( int ) UnifiedExpressions . EyeWideLeft ] . Weight + exp . Shapes [ ( int ) UnifiedExpressions . EyeWideRight ] . Weight ) / 2.0f ) * 0.2f +
54- ( exp . Eye . Right . Openness + exp . Eye . Right . Openness ) / 2.0f * 0.8f , 0.5f , true ) ,
53+ new EParam ( "EyeLidExpanded" , exp =>
54+ ( exp . Shapes [ ( int ) UnifiedExpressions . EyeWideLeft ] . Weight +
55+ exp . Shapes [ ( int ) UnifiedExpressions . EyeWideRight ] . Weight ) * .1f +
56+ ( exp . Eye . Left . Openness + exp . Eye . Right . Openness ) * .4f , 0.5f , true ) ,
5557
5658 #endregion
5759
@@ -64,9 +66,10 @@ public static class EyeTrackingParams
6466 exp . Shapes [ ( int ) UnifiedExpressions . EyeWideRight ] . Weight * .2f + exp . Eye . Right . Openness * .8f -
6567 Squeeze ( exp , 1 ) , 0.5f , true ) ,
6668 new EParam ( "EyeLidExpandedSqueeze" , exp =>
67- ( ( ( exp . Shapes [ ( int ) UnifiedExpressions . EyeWideLeft ] . Weight * .2f + exp . Eye . Left . Openness * .8f ) +
68- ( exp . Shapes [ ( int ) UnifiedExpressions . EyeWideLeft ] . Weight * .2f + exp . Eye . Left . Openness * .8f ) ) / 2.0f ) -
69- Squeeze ( exp , 2 ) , 0.5f , true ) ,
69+ ( ( exp . Shapes [ ( int ) UnifiedExpressions . EyeWideLeft ] . Weight +
70+ exp . Shapes [ ( int ) UnifiedExpressions . EyeWideRight ] . Weight ) * .2f +
71+ ( exp . Eye . Left . Openness + exp . Eye . Right . Openness ) * .8f -
72+ Squeeze ( exp , 0 ) - Squeeze ( exp , 1 ) ) * .5f , 0.5f , true ) ,
7073
7174 #endregion
7275
@@ -120,14 +123,19 @@ public static class EyeTrackingParams
120123
121124 new BinaryBaseParameter ( "CombinedEyeLidExpandedSqueeze" , exp =>
122125 {
123- var eyeLid = ( ( ( exp . Shapes [ ( int ) UnifiedExpressions . EyeWideLeft ] . Weight * .2f + exp . Eye . Left . Openness * .8f ) +
124- ( exp . Shapes [ ( int ) UnifiedExpressions . EyeWideLeft ] . Weight * .2f + exp . Eye . Left . Openness * .8f ) ) / 2.0f ) -
125- Squeeze ( exp , 2 ) ;
126- if ( eyeLid > .8f )
127- return ( exp . Shapes [ ( int ) UnifiedExpressions . EyeWideRight ] . Weight + exp . Shapes [ ( int ) UnifiedExpressions . EyeWideLeft ] . Weight ) / 2.0f ;
128- if ( eyeLid >= 0 )
129- return exp . Eye . Combined ( ) . Openness ;
130- return Squeeze ( exp , 1 ) ;
126+ var eyeLid = (
127+ ( exp . Shapes [ ( int ) UnifiedExpressions . EyeWideLeft ] . Weight +
128+ exp . Shapes [ ( int ) UnifiedExpressions . EyeWideRight ] . Weight ) * .2f +
129+ ( exp . Eye . Left . Openness + exp . Eye . Right . Openness ) * .8f -
130+ Squeeze ( exp , 0 ) - Squeeze ( exp , 1 ) ) * .5f ;
131+
132+ return eyeLid switch
133+ {
134+ > .8f => ( exp . Shapes [ ( int ) UnifiedExpressions . EyeWideRight ] . Weight +
135+ exp . Shapes [ ( int ) UnifiedExpressions . EyeWideLeft ] . Weight ) * .5f ,
136+ >= 0 => exp . Eye . Combined ( ) . Openness ,
137+ _ => ( Squeeze ( exp , 0 ) + Squeeze ( exp , 1 ) ) * .5f
138+ } ;
131139 } ) ,
132140
133141 #endregion
@@ -211,21 +219,20 @@ public static class EyeTrackingParams
211219 new EParam ( "NoseSneerLeft" , exp => exp . Shapes [ ( int ) UnifiedExpressions . NoseSneerLeft ] . Weight ) ,
212220 new EParam ( "NoseSneerRight" , exp => exp . Shapes [ ( int ) UnifiedExpressions . NoseSneerRight ] . Weight ) ,
213221
214- new EParam ( "BrowDownLeft" , exp => ( exp . Shapes [ ( int ) UnifiedExpressions . BrowPinchLeft ] . Weight + exp . Shapes [ ( int ) UnifiedExpressions . BrowLowererLeft ] . Weight ) / 2.0f ) ,
215- new EParam ( "BrowDownRight" , exp => ( exp . Shapes [ ( int ) UnifiedExpressions . BrowPinchRight ] . Weight + exp . Shapes [ ( int ) UnifiedExpressions . BrowLowererRight ] . Weight ) / 2.0f )
216-
217222 #endregion
218223 } ;
219224
220- // Brain Hurty
221- private static float NormalizeFloat ( float minInput , float maxInput , float minOutput , float maxOutput ,
222- float value ) => ( maxOutput - minOutput ) / ( maxInput - minInput ) * ( value - maxInput ) + maxOutput ;
225+ // eyeIndex: 0 == Left, 1 == Right
226+ private static float Squeeze ( UnifiedTrackingData data , int eyeIndex )
227+ {
228+ if ( eyeIndex == 0 )
229+ {
230+ return ( float ) ( 1.0f - Math . Pow ( data . Eye . Left . Openness , .15 ) ) *
231+ data . Shapes [ ( int ) UnifiedExpressions . EyeSquintLeft ] . Weight ;
232+ }
223233
224- // eyeIndex: 0 == Left, 1 == Right, 2 == avg Both
225- private static float Squeeze ( UnifiedTrackingData data , int eyeIndex ) =>
226- eyeIndex == 0 ? ( float ) ( 1.0f - Math . Pow ( data . Eye . Left . Openness , .15 ) ) * data . Shapes [ ( int ) UnifiedExpressions . EyeSquintLeft ] . Weight
227- : eyeIndex == 1 ? ( float ) ( 1.0f - Math . Pow ( data . Eye . Right . Openness , .15 ) ) * data . Shapes [ ( int ) UnifiedExpressions . EyeSquintRight ] . Weight
228- : eyeIndex == 2 ? ( float ) ( 1.0f - Math . Pow ( data . Eye . Combined ( ) . Openness , .15 ) ) * ( data . Shapes [ ( int ) UnifiedExpressions . EyeSquintLeft ] . Weight + data . Shapes [ ( int ) UnifiedExpressions . EyeSquintRight ] . Weight ) / 2.0f
229- : 0.0f ;
234+ return ( float ) ( 1.0f - Math . Pow ( data . Eye . Right . Openness , .15 ) ) *
235+ data . Shapes [ ( int ) UnifiedExpressions . EyeSquintRight ] . Weight ;
236+ }
230237 }
231238}
0 commit comments