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]);
        }
    }
        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 #5
0
 /// <summary>
 /// Main update event for EXPRESSION data
 /// </summary>
 private void engine_ExpressivEmoStateUpdated(object sender, EmoStateUpdatedEventArgs e)
 {
     label4.Text = _es.ExpressivGetLowerFaceAction().ToString();
 }
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();
        }
Exemple #8
0
        private void engine_EmoStateUpdated(object sender, EmoStateUpdatedEventArgs e)  // update emotiv state and get channels statuses
        {
            es = e.emoState;
            if (e.userId == currentUser)
            {
                lock (_lockThis2)
                {
                    var    b1 = es.CognitivGetCurrentAction();
                    string c1 = b1.ToString();

                    var    b2 = es.ExpressivGetLowerFaceAction();
                    string c2 = b2.ToString();

                    var    b3 = es.ExpressivGetUpperFaceAction();
                    string c3 = b3.ToString();

                    EdkDll.EE_SignalStrength_t b4  = es.GetWirelessSignalStatus();              // emotiv wireless signal Status
                    int getWirelessSignalStatusInt = -1;
                    if (b4 == EdkDll.EE_SignalStrength_t.NO_SIGNAL)                             // emotiv wireless signal Status = NO_SIGNAL
                    {
                        getWirelessSignalStatusInt = 0;
                    }
                    else if (b4 == EdkDll.EE_SignalStrength_t.BAD_SIGNAL)                       // emotiv wireless signal Status = BAD_SIGNAL
                    {
                        getWirelessSignalStatusInt = 1;
                    }
                    else if (b4 == EdkDll.EE_SignalStrength_t.GOOD_SIGNAL)                      // emotiv wireless signal Status = GOOD_SIGNAL
                    {
                        getWirelessSignalStatusInt = 2;
                    }

                    bool Connected = false;
                    if (getWirelessSignalStatusInt != 0)
                    {
                        Connected = true;
                    }
                    //New_emotivConnected = Connected;
                    //New_emotiv_wireless_signal_status = getWirelessSignalStatusInt;

                    int batteryChargeLevel;                                                     // emotiv battery level
                    int maxChargeLevel;                                                         // emotiv max battery level
                    es.GetBatteryChargeLevel(out batteryChargeLevel, out maxChargeLevel);       // get emotiv battery level
                    float bat = ((float)batteryChargeLevel) / ((float)maxChargeLevel);          // bat = % current's user emotiv battery level
                    //New_emotiv_battery_level = bat;                                                 // % current's user emotiv battery level

                    EdkDll.EE_EEG_ContactQuality_t[] CQTable = new EdkDll.EE_EEG_ContactQuality_t[15];  // emotiv Contact Quality for all channels
                    int[]  CQTableInt = new int[15];
                    string cq         = "";
                    for (int i = 0; i < 14; i++)
                    {
                        CQTable[i] = es.GetContactQuality(i + 3);                               // emotiv Contact Quality for i channels
                        if (CQTable[i] == EdkDll.EE_EEG_ContactQuality_t.EEG_CQ_NO_SIGNAL)      // if emotiv Contact Quality for i channels = NO_SIGNAL
                        {
                            CQTableInt[i] = 0;
                        }
                        else if (CQTable[i] == EdkDll.EE_EEG_ContactQuality_t.EEG_CQ_VERY_BAD)  // if emotiv Contact Quality for i channels = VERY_BAD
                        {
                            CQTableInt[i] = 1;
                        }
                        else if (CQTable[i] == EdkDll.EE_EEG_ContactQuality_t.EEG_CQ_POOR)      // if emotiv Contact Quality for i channels = POOR
                        {
                            CQTableInt[i] = 2;
                        }
                        else if (CQTable[i] == EdkDll.EE_EEG_ContactQuality_t.EEG_CQ_FAIR)      // if emotiv Contact Quality for i channels = FAIR
                        {
                            CQTableInt[i] = 3;
                        }
                        else if (CQTable[i] == EdkDll.EE_EEG_ContactQuality_t.EEG_CQ_GOOD)      // if emotiv Contact Quality for i channels = GOOD
                        {
                            CQTableInt[i] = 4;
                        }
                        else
                        {
                            CQTableInt[i] = -1;
                        }
                        cq = cq + CQTableInt[i].ToString() + ",";
                    }

                    cq = cq.Remove(cq.Length - 1); // remove the invalid character

                    New_emotivConnected = Connected;
                    New_emotiv_wireless_signal_status = getWirelessSignalStatusInt;
                    New_emotiv_battery_level          = bat;                                        // % current's user emotiv battery level
                    New_emotiv_contacts_quality       = cq;
                }
            }
        }