static void engine_EmoStateUpdated(object sender, EmoStateUpdatedEventArgs e) { EmoState es = e.emoState; isBlink = es.FacialExpressionIsBlink(); isLeftWink = es.FacialExpressionIsLeftWink(); isRightWink = es.FacialExpressionIsRightWink(); isEyesOpen = es.FacialExpressionIsEyesOpen(); isLookingUp = es.FacialExpressionIsLookingUp(); isLookingDown = es.FacialExpressionIsLookingDown(); isLookingLeft = es.FacialExpressionIsLookingLeft(); isLookingRight = es.FacialExpressionIsLookingRight(); es.FacialExpressionGetEyelidState(out eyelidStateLeft, out eyelidStateRight); es.FacialExpressionGetEyeLocation(out eyeLocationX, out eyeLocationY); eyebrowExtent = es.FacialExpressionGetEyebrowExtent(); smileExtent = es.FacialExpressionGetSmileExtent(); clenchExtent = es.FacialExpressionGetClenchExtent(); upperFaceAction = es.FacialExpressionGetUpperFaceAction(); upperFacePower = es.FacialExpressionGetUpperFaceActionPower(); lowerFaceAction = es.FacialExpressionGetLowerFaceAction(); lowerFacePower = es.FacialExpressionGetLowerFaceActionPower(); for (int i = 0; i < expAlgoList.Length; ++i) { isExpActiveList[i] = es.FacialExpressionIsActive(expAlgoList[i]); } }
/// <summary> /// Chequea si el evento que recibe es de alguno de los del tipo face /// en caso de serlo setea la propiedad del objeto _facialExpressionDto /// </summary> /// <param name="emoState">Evento recibido</param> /// <returns></returns> private bool CheckLowerFaceExpression(EmoState emoState) { var wasLowerExpression = false; var power = emoState.FacialExpressionGetLowerFaceActionPower(); if (emoState.FacialExpressionGetLowerFaceAction() == EdkDll.IEE_FacialExpressionAlgo_t.FE_SMILE) { wasLowerExpression = _facialExpressionDto.LowerFace.IsTheSameThanPrevious(_facialExpressionDto.LowerFace.Type, power); _facialExpressionDto.LowerFace.Change(LowerFaceEnum.Smile, power); } if (emoState.FacialExpressionGetLowerFaceAction() == EdkDll.IEE_FacialExpressionAlgo_t.FE_CLENCH) { wasLowerExpression = _facialExpressionDto.LowerFace.IsTheSameThanPrevious(_facialExpressionDto.LowerFace.Type, power);; _facialExpressionDto.LowerFace.Change(LowerFaceEnum.Clench, power); } if (emoState.FacialExpressionGetLowerFaceAction() == EdkDll.IEE_FacialExpressionAlgo_t.FE_LAUGH) { wasLowerExpression = _facialExpressionDto.LowerFace.IsTheSameThanPrevious(_facialExpressionDto.LowerFace.Type, power);; _facialExpressionDto.LowerFace.Change(LowerFaceEnum.Laugh, power); } if (emoState.FacialExpressionGetLowerFaceAction() == EdkDll.IEE_FacialExpressionAlgo_t.FE_SMIRK_LEFT) { wasLowerExpression = _facialExpressionDto.LowerFace.IsTheSameThanPrevious(_facialExpressionDto.LowerFace.Type, power);; _facialExpressionDto.LowerFace.Change(LowerFaceEnum.SmirkLeft, power); } if (emoState.FacialExpressionGetLowerFaceAction() == EdkDll.IEE_FacialExpressionAlgo_t.FE_SMIRK_RIGHT) { wasLowerExpression = _facialExpressionDto.LowerFace.IsTheSameThanPrevious(_facialExpressionDto.LowerFace.Type, power);; _facialExpressionDto.LowerFace.Change(LowerFaceEnum.SmirkRight, power); } return(wasLowerExpression); }
static void engine_FacialExpressionEmoStateUpdated(object sender, EmoStateUpdatedEventArgs e) { EmoState es = e.emoState; Single timeFromStart = es.GetTimeFromStart(); EdkDll.IEE_FacialExpressionAlgo_t[] expAlgoList = { EdkDll.IEE_FacialExpressionAlgo_t.FE_BLINK, EdkDll.IEE_FacialExpressionAlgo_t.FE_CLENCH, EdkDll.IEE_FacialExpressionAlgo_t.FE_SUPRISE, EdkDll.IEE_FacialExpressionAlgo_t.FE_FROWN, EdkDll.IEE_FacialExpressionAlgo_t.FE_HORIEYE, EdkDll.IEE_FacialExpressionAlgo_t.FE_NEUTRAL, EdkDll.IEE_FacialExpressionAlgo_t.FE_SMILE, EdkDll.IEE_FacialExpressionAlgo_t.FE_WINK_LEFT, EdkDll.IEE_FacialExpressionAlgo_t.FE_WINK_RIGHT }; Boolean[] isExpActiveList = new Boolean[expAlgoList.Length]; Boolean isBlink = es.FacialExpressionIsBlink(); Boolean isLeftWink = es.FacialExpressionIsLeftWink(); Boolean isRightWink = es.FacialExpressionIsRightWink(); Boolean isEyesOpen = es.FacialExpressionIsEyesOpen(); Boolean isLookingUp = es.FacialExpressionIsLookingUp(); Boolean isLookingDown = es.FacialExpressionIsLookingDown(); Single leftEye = 0.0F; Single rightEye = 0.0F; Single x = 0.0F; Single y = 0.0F; es.FacialExpressionGetEyelidState(out leftEye, out rightEye); es.FacialExpressionGetEyeLocation(out x, out y); Single eyebrowExtent = es.FacialExpressionGetEyebrowExtent(); Single smileExtent = es.FacialExpressionGetSmileExtent(); Single clenchExtent = es.FacialExpressionGetClenchExtent(); EdkDll.IEE_FacialExpressionAlgo_t upperFaceAction = es.FacialExpressionGetUpperFaceAction(); Single upperFacePower = es.FacialExpressionGetUpperFaceActionPower(); EdkDll.IEE_FacialExpressionAlgo_t lowerFaceAction = es.FacialExpressionGetLowerFaceAction(); Single lowerFacePower = es.FacialExpressionGetLowerFaceActionPower(); for (int i = 0; i < expAlgoList.Length; ++i) { isExpActiveList[i] = es.FacialExpressionIsActive(expAlgoList[i]); } expLog.Write( "{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},", timeFromStart, isBlink, isLeftWink, isRightWink, isEyesOpen, isLookingUp, isLookingDown, leftEye, rightEye, x, y, eyebrowExtent, smileExtent, upperFaceAction, upperFacePower, lowerFaceAction, lowerFacePower); for (int i = 0; i < expAlgoList.Length; ++i) { expLog.Write("{0},", isExpActiveList[i]); } expLog.WriteLine(""); expLog.Flush(); }