108 lines
3.2 KiB
Java
108 lines
3.2 KiB
Java
package com.rubenvandeven.emotionhero;
|
|
|
|
import com.affectiva.android.affdex.sdk.detector.Face;
|
|
|
|
/**
|
|
* Created by ruben on 02/09/16.
|
|
*
|
|
* Strictly not all expression variables, but they all are floats...
|
|
*/
|
|
|
|
public enum Expression {
|
|
ROLL,
|
|
PITCH,
|
|
YAW,
|
|
INTER_OCULAR_DISTANCE,
|
|
MOUTH_OPEN,
|
|
LIP_PRESS,
|
|
BROW_RAISE,
|
|
NOSE_WRINKLER,
|
|
LIP_DEPRESSOR, //lip corner depressor
|
|
BROW_FURROW,
|
|
ATTENTION,
|
|
SMILE,
|
|
INNER_BROW_RAISER,
|
|
CHIN_RAISER,
|
|
SMIRK,
|
|
LIP_SUCK,
|
|
UPPER_LIP_RAISER,
|
|
LIP_PUCKER,
|
|
EYE_CLOSURE,
|
|
ENGAGEMENT,
|
|
VALENCE,
|
|
DIMPLER,
|
|
CHEEK_RAISE,
|
|
EYE_WIDEN,
|
|
JAW_DROP,
|
|
LID_TIGHTEN,
|
|
LIP_STRETCH;
|
|
|
|
public float getValueFromFace(Face face)
|
|
{
|
|
if(face == null)
|
|
return 0f;
|
|
|
|
switch (this) {
|
|
case ROLL:
|
|
return face.measurements.orientation.getRoll();
|
|
case PITCH:
|
|
return face.measurements.orientation.getPitch();
|
|
case YAW:
|
|
return face.measurements.orientation.getYaw();
|
|
case INTER_OCULAR_DISTANCE:
|
|
return face.measurements.getInterocularDistance();
|
|
case MOUTH_OPEN:
|
|
return face.expressions.getMouthOpen();
|
|
case LIP_PRESS:
|
|
return face.expressions.getLipPress();
|
|
case BROW_RAISE:
|
|
return face.expressions.getBrowRaise();
|
|
case NOSE_WRINKLER:
|
|
return face.expressions.getNoseWrinkle();
|
|
case LIP_DEPRESSOR:
|
|
return face.expressions.getLipCornerDepressor();
|
|
case BROW_FURROW:
|
|
return face.expressions.getBrowFurrow();
|
|
case ATTENTION:
|
|
return face.expressions.getAttention();
|
|
case SMILE:
|
|
return face.expressions.getSmile();
|
|
case INNER_BROW_RAISER:
|
|
return face.expressions.getBrowRaise();
|
|
case CHIN_RAISER:
|
|
return face.expressions.getChinRaise();
|
|
case SMIRK:
|
|
return face.expressions.getSmirk();
|
|
case LIP_SUCK:
|
|
return face.expressions.getLipSuck();
|
|
case UPPER_LIP_RAISER:
|
|
return face.expressions.getUpperLipRaise();
|
|
case LIP_PUCKER:
|
|
return face.expressions.getLipPucker();
|
|
case EYE_CLOSURE:
|
|
return face.expressions.getEyeClosure();
|
|
case ENGAGEMENT:
|
|
return face.emotions.getEngagement();
|
|
case VALENCE:
|
|
return face.emotions.getValence();
|
|
case DIMPLER:
|
|
return face.expressions.getDimpler();
|
|
case CHEEK_RAISE:
|
|
return face.expressions.getCheekRaise();
|
|
case EYE_WIDEN:
|
|
return face.expressions.getEyeWiden();
|
|
case JAW_DROP:
|
|
return face.expressions.getJawDrop();
|
|
case LID_TIGHTEN:
|
|
return face.expressions.getLidTighten();
|
|
case LIP_STRETCH:
|
|
return face.expressions.getLipStretch();
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
public String getDbName() {
|
|
return this.name().toLowerCase();
|
|
}
|
|
}
|