Exemple #1
0
    static void engine_ExpressivEmoStateUpdated(object sender, EmoStateUpdatedEventArgs e)
    {
        EmoState es = e.emoState;

        isBlink        = es.ExpressivIsBlink();
        isLeftWink     = es.ExpressivIsLeftWink();
        isRightWink    = es.ExpressivIsRightWink();
        isEyesOpen     = es.ExpressivIsEyesOpen();
        isLookingUp    = es.ExpressivIsLookingUp();
        isLookingDown  = es.ExpressivIsLookingDown();
        isLookingLeft  = es.ExpressivIsLookingLeft();
        isLookingRight = es.ExpressivIsLookingRight();
        es.ExpressivGetEyelidState(out eyelidStateLeft, out eyelidStateRight);
        es.ExpressivGetEyeLocation(out eyeLocationX, out eyeLocationY);
        eyebrowExtent   = es.ExpressivGetEyebrowExtent();
        smileExtent     = es.ExpressivGetSmileExtent();
        clenchExtent    = es.ExpressivGetClenchExtent();
        upperFaceAction = es.ExpressivGetUpperFaceAction();
        upperFacePower  = es.ExpressivGetUpperFaceActionPower();
        lowerFaceAction = es.ExpressivGetLowerFaceAction();
        lowerFacePower  = es.ExpressivGetLowerFaceActionPower();
        for (int i = 0; i < expAlgoList.Length; ++i)
        {
            isExpActiveList[i] = es.ExpressivIsActive(expAlgoList[i]);
        }
    }
Exemple #2
0
        //Event handler for Expressiv event
        void ExpressivEmoStateUpdated()
        {
            if (FEmoState[0] != null)
            {
                EmoState es = FEmoState[0];

                mIsBlink        = es.ExpressivIsBlink();
                mIsLeftWink     = es.ExpressivIsLeftWink();
                mIsRightWink    = es.ExpressivIsRightWink();
                mIsEyesOpen     = es.ExpressivIsEyesOpen();
                mIsLookingUp    = es.ExpressivIsLookingUp();
                mIsLookingDown  = es.ExpressivIsLookingDown();
                mIsLookingLeft  = es.ExpressivIsLookingLeft();
                mIsLookingRight = es.ExpressivIsLookingRight();
                mLeftEyelid     = 0.0F;
                mRightEyelid    = 0.0F;
                mX = 0.0F;
                mY = 0.0F;
                es.ExpressivGetEyelidState(out mLeftEyelid, out mRightEyelid);
                es.ExpressivGetEyeLocation(out mX, out mY);
                mEyebrowExtent   = es.ExpressivGetEyebrowExtent();
                mSmileExtent     = es.ExpressivGetSmileExtent();
                mClenchExtent    = es.ExpressivGetClenchExtent();
                mUpperFaceAction = es.ExpressivGetUpperFaceAction();
                mUpperFacePower  = es.ExpressivGetUpperFaceActionPower();
                mLowerFaceAction = es.ExpressivGetLowerFaceAction();
                mLowerFacePower  = es.ExpressivGetLowerFaceActionPower();
                for (int i = 0; i < mExpAlgoList.Length; ++i)
                {
                    mIsExpActiveList[i] = es.ExpressivIsActive(mExpAlgoList[i]);
                }
            }
        }
Exemple #3
0
    private static void engine_ExpressivEmoStateUpdated(object sender, EmoStateUpdatedEventArgs e)
    {
        EmoState emoState = e.emoState;

        EmoExpressiv.isBlink        = emoState.ExpressivIsBlink();
        EmoExpressiv.isLeftWink     = emoState.ExpressivIsLeftWink();
        EmoExpressiv.isRightWink    = emoState.ExpressivIsRightWink();
        EmoExpressiv.isEyesOpen     = emoState.ExpressivIsEyesOpen();
        EmoExpressiv.isLookingUp    = emoState.ExpressivIsLookingUp();
        EmoExpressiv.isLookingDown  = emoState.ExpressivIsLookingDown();
        EmoExpressiv.isLookingLeft  = emoState.ExpressivIsLookingLeft();
        EmoExpressiv.isLookingRight = emoState.ExpressivIsLookingRight();
        emoState.ExpressivGetEyelidState(out EmoExpressiv.eyelidStateLeft, out EmoExpressiv.eyelidStateRight);
        emoState.ExpressivGetEyeLocation(out EmoExpressiv.eyeLocationX, out EmoExpressiv.eyeLocationY);
        EmoExpressiv.eyebrowExtent   = emoState.ExpressivGetEyebrowExtent();
        EmoExpressiv.smileExtent     = emoState.ExpressivGetSmileExtent();
        EmoExpressiv.clenchExtent    = emoState.ExpressivGetClenchExtent();
        EmoExpressiv.upperFaceAction = emoState.ExpressivGetUpperFaceAction();
        EmoExpressiv.upperFacePower  = emoState.ExpressivGetUpperFaceActionPower();
        EmoExpressiv.lowerFaceAction = emoState.ExpressivGetLowerFaceAction();
        EmoExpressiv.lowerFacePower  = emoState.ExpressivGetLowerFaceActionPower();
        for (int i = 0; i < EmoExpressiv.expAlgoList.Length; i++)
        {
            EmoExpressiv.isExpActiveList[i] = emoState.ExpressivIsActive(EmoExpressiv.expAlgoList[i]);
        }
    }
Exemple #4
0
        void engine_EmoStateUpdated(object sender, EmoStateUpdatedEventArgs e)
        {
            EmotivUser = e.userId;
            // enable data aquisition for this user.
            engine.DataAcquisitionEnable(e.userId, true);

            // ask for up to 1 second of buffered data
            engine.EE_DataSetBufferSizeInSec(1);



            EmoState es  = e.emoState;
            DateTime now = DateTime.Now;
            //int x,y;
            //engine.HeadsetGetGyroDelta(e.userId, out x, out y);

            //values["GyroDeltaX"] = (float)x;
            //values["GyroDeltaY"] = (float)y;
            Dictionary <string, float> values = new Dictionary <string, float>();

            values["AffectivGetExcitementShortTermScore"] = es.AffectivGetExcitementShortTermScore();
            values["AffectivGetExcitementLongTermScore"]  = es.AffectivGetExcitementLongTermScore();
            values["AffectivGetEngagementBoredomScore"]   = es.AffectivGetEngagementBoredomScore();
            values["AffectivGetMeditationScore"]          = es.AffectivGetMeditationScore();
            values["AffectivGetFrustrationScore"]         = es.AffectivGetFrustrationScore();
            float leftEye, rightEye;

            es.ExpressivGetEyelidState(out leftEye, out rightEye);
            values["ExpressivGetEyelidStateLeft"]  = leftEye;
            values["ExpressivGetEyelidStateRight"] = rightEye;
            es.ExpressivGetEyeLocation(out leftEye, out rightEye);
            values["ExpressivGetEyeLocationLeft"]      = leftEye;
            values["ExpressivGetEyeLocationRight"]     = rightEye;
            values["ExpressivGetClenchExtent"]         = es.ExpressivGetClenchExtent();
            values["ExpressivGetEyebrowExtent"]        = es.ExpressivGetEyebrowExtent();
            values["ExpressivGetLowerFaceActionPower"] = es.ExpressivGetLowerFaceActionPower();
            values["ExpressivGetSmileExtent"]          = es.ExpressivGetSmileExtent();
            values["ExpressivGetUpperFaceActionPower"] = es.ExpressivGetUpperFaceActionPower();
            values["ExpressivIsBlink"]        = bool2float(es.ExpressivIsBlink());
            values["ExpressivIsEyesOpen"]     = bool2float(es.ExpressivIsEyesOpen());
            values["ExpressivIsLeftWink"]     = bool2float(es.ExpressivIsLeftWink());
            values["ExpressivIsLookingDown"]  = bool2float(es.ExpressivIsLookingDown());
            values["ExpressivIsLookingLeft"]  = bool2float(es.ExpressivIsLookingLeft());
            values["ExpressivIsLookingRight"] = bool2float(es.ExpressivIsLookingRight());
            values["ExpressivIsLookingUp"]    = bool2float(es.ExpressivIsLookingUp());
            values["ExpressivIsRightWink"]    = bool2float(es.ExpressivIsRightWink());

            Sender.uploadEmotivEvent(user, now, values);
        }
        private void epressiveStateUdpate(object sender, EmoStateUpdatedEventArgs e)
        {
            if (e.userId == userID)
            {
                EmoState es = e.emoState;
                ExpressivOSC.ExpressivState exprState = new ExpressivOSC.ExpressivState();

                exprState.emotivTimeStamp = es.GetTimeFromStart();

                EdkDll.EE_ExpressivAlgo_t asd;
                int abc = (int)es.ExpressivGetLowerFaceAction();

                string lower = "" + es.ExpressivGetLowerFaceAction();
                exprState.lowerFaceAction      = lower;
                exprState.lowerFaceActionPower = es.ExpressivGetLowerFaceActionPower();

                string upper = "" + es.ExpressivGetUpperFaceAction();
                exprState.upperFaceAction      = upper;
                exprState.upperFaceActionPower = es.ExpressivGetUpperFaceActionPower();

                // EYES
                float x, y;
                es.ExpressivGetEyelidState(out x, out y);
                exprState.xEyelidState = x;
                exprState.yEyelidState = y;

                float posX, posY;
                es.ExpressivGetEyeLocation(out posX, out posY);
                exprState.posXEyeLocation = posX;
                exprState.posYEyeLocation = posY;

                exprState.isBlink     = es.ExpressivIsBlink();
                exprState.areEyesOpen = es.ExpressivIsEyesOpen();

                exprState.isLeftWink  = es.ExpressivIsLeftWink();
                exprState.isRightWink = es.ExpressivIsRightWink();

                exprState.isLookingLeft  = es.ExpressivIsLookingLeft();
                exprState.isLookingRight = es.ExpressivIsLookingRight();
                exprState.isLookingDown  = es.ExpressivIsLookingDown();
                exprState.isLookingUp    = es.ExpressivIsLookingUp();

                expressivOSC.sendExpressivOSC(exprState, false);

                Console.WriteLine("Received Expressive State Update");
            }
        }
Exemple #6
0
        private static void epressiveStateUdpate(object sender, EmoStateUpdatedEventArgs e)
        {
            EmoState es = e.emoState;

            if (e.userId == userID)
            {
                string header = "EmoState_Timestamp;" +
                                "LowerFaceAction;LowerFaceActionPower;UpperFaceAction;UpperFaceActionPower;" +
                                " ExpressivEyelidStateX;ExpressivEyelidStateY;ExpressivEyeLocationX;ExpressivEyeLocationY;" +
                                "IsBlink;AreEyesOpen;IsLeftWink;IsRightWink;IsLookingLeft;IsLookingRight;IsLookingDown;IsLookingUp";
                // Wr;ite the data to a file
                TextWriter file = new StreamWriter(filename, true);

                file.Write(es.GetTimeFromStart());
                file.Write(";");

                EdkDll.EE_ExpressivAlgo_t lowerFaceAction = es.ExpressivGetLowerFaceAction();
                float lowerFaceActionPower = es.ExpressivGetLowerFaceActionPower();

                EdkDll.EE_ExpressivAlgo_t upperFaceAction = es.ExpressivGetUpperFaceAction();
                float upperFaceActionPower = es.ExpressivGetUpperFaceActionPower();

                file.Write(lowerFaceAction);
                file.Write(";");
                file.Write(lowerFaceActionPower);
                file.Write(";");

                file.Write(upperFaceAction);
                file.Write(";");
                file.Write(upperFaceActionPower);
                file.Write(";");

                // EYES
                float x, y;
                es.ExpressivGetEyelidState(out x, out y);

                file.Write(x);
                file.Write(";");
                file.Write(y);
                file.Write(";");



                float posX, posY;
                es.ExpressivGetEyeLocation(out posX, out posY);

                file.Write(posX);
                file.Write(";");
                file.Write(posY);
                file.Write(";");

                bool isBlink = es.ExpressivIsBlink();
                file.Write(isBlink);
                file.Write(";");

                bool areEyesOpen = es.ExpressivIsEyesOpen();
                file.Write(areEyesOpen);
                file.Write(";");

                bool isLeftWink  = es.ExpressivIsLeftWink();
                bool isRightWink = es.ExpressivIsRightWink();
                file.Write(isLeftWink);
                file.Write(";");
                file.Write(isRightWink);
                file.Write(";");



                bool isLookingLeft  = es.ExpressivIsLookingLeft();
                bool isLookingRight = es.ExpressivIsLookingRight();
                bool isLookingDown  = es.ExpressivIsLookingDown();
                bool isLookingUp    = es.ExpressivIsLookingUp();
                file.Write(isLookingLeft);
                file.Write(";");
                file.Write(isLookingRight);
                file.Write(";");
                file.Write(isLookingDown);
                file.Write(";");
                file.Write(isLookingUp);
                file.Write(";");

                file.WriteLine("");
                file.Close();
            }
        }
Exemple #7
0
        static void engine_ExpressivEmoStateUpdated(object sender, EmoStateUpdatedEventArgs e)
        {
            EmoState es = e.emoState;

            Single timeFromStart = es.GetTimeFromStart();

            EdkDll.EE_ExpressivAlgo_t[] expAlgoList =
            {
                EdkDll.EE_ExpressivAlgo_t.EXP_BLINK,
                EdkDll.EE_ExpressivAlgo_t.EXP_CLENCH,
                EdkDll.EE_ExpressivAlgo_t.EXP_EYEBROW,
                EdkDll.EE_ExpressivAlgo_t.EXP_FURROW,
                EdkDll.EE_ExpressivAlgo_t.EXP_HORIEYE,
                EdkDll.EE_ExpressivAlgo_t.EXP_LAUGH,
                EdkDll.EE_ExpressivAlgo_t.EXP_NEUTRAL,
                EdkDll.EE_ExpressivAlgo_t.EXP_SMILE,
                EdkDll.EE_ExpressivAlgo_t.EXP_SMIRK_LEFT,
                EdkDll.EE_ExpressivAlgo_t.EXP_SMIRK_RIGHT,
                EdkDll.EE_ExpressivAlgo_t.EXP_WINK_LEFT,
                EdkDll.EE_ExpressivAlgo_t.EXP_WINK_RIGHT
            };
            Boolean[] isExpActiveList = new Boolean[expAlgoList.Length];

            Boolean isBlink        = es.ExpressivIsBlink();
            Boolean isLeftWink     = es.ExpressivIsLeftWink();
            Boolean isRightWink    = es.ExpressivIsRightWink();
            Boolean isEyesOpen     = es.ExpressivIsEyesOpen();
            Boolean isLookingUp    = es.ExpressivIsLookingUp();
            Boolean isLookingDown  = es.ExpressivIsLookingDown();
            Boolean isLookingLeft  = es.ExpressivIsLookingLeft();
            Boolean isLookingRight = es.ExpressivIsLookingRight();
            Single  leftEye        = 0.0F;
            Single  rightEye       = 0.0F;
            Single  x = 0.0F;
            Single  y = 0.0F;

            es.ExpressivGetEyelidState(out leftEye, out rightEye);
            es.ExpressivGetEyeLocation(out x, out y);
            Single eyebrowExtent = es.ExpressivGetEyebrowExtent();
            Single smileExtent   = es.ExpressivGetSmileExtent();
            Single clenchExtent  = es.ExpressivGetClenchExtent();

            EdkDll.EE_ExpressivAlgo_t upperFaceAction = es.ExpressivGetUpperFaceAction();
            Single upperFacePower = es.ExpressivGetUpperFaceActionPower();

            EdkDll.EE_ExpressivAlgo_t lowerFaceAction = es.ExpressivGetLowerFaceAction();
            Single lowerFacePower = es.ExpressivGetLowerFaceActionPower();

            for (int i = 0; i < expAlgoList.Length; ++i)
            {
                isExpActiveList[i] = es.ExpressivIsActive(expAlgoList[i]);
            }

            expLog.Write(
                "{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},",
                timeFromStart,
                isBlink, isLeftWink, isRightWink, isEyesOpen, isLookingUp,
                isLookingDown, isLookingLeft, isLookingRight, 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();
        }