/// <summary>
        /// Process Face Frames
        /// </summary>
        private void OnFaceFrameArrived(object sender, FaceFrameArrivedEventArgs e)
        {
            // Retrieve the face reference
            FaceFrameReference faceRef = e.FrameReference;

            if (faceRef == null)
            {
                return;
            }

            // Acquire the face frame
            using (FaceFrame faceFrame = faceRef.AcquireFrame())
            {
                if (faceFrame == null)
                {
                    return;
                }

                // Retrieve the face frame result
                FaceFrameResult frameResult = faceFrame.FaceFrameResult;

                if (frameResult != null)
                {
                    // Update trackers
                    UpdateTrackers(frameResult);
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Process the face frame
        /// </summary>
        private void OnFaceFrameArrived(object sender, FaceFrameArrivedEventArgs e)
        {
            // Retrieve the face reference
            FaceFrameReference faceRef = e.FrameReference;

            if (faceRef == null)
            {
                return;
            }

            // Acquire the face frame
            using (FaceFrame faceFrame = faceRef.AcquireFrame())
            {
                if (faceFrame == null)
                {
                    return;
                }

                // Retrieve the face frame result
                FaceFrameResult frameResult = faceFrame.FaceFrameResult;

                // Display the values
                HappyResult.Text       = frameResult.FaceProperties[FaceProperty.Happy].ToString();
                EngagedResult.Text     = frameResult.FaceProperties[FaceProperty.Engaged].ToString();
                GlassesResult.Text     = frameResult.FaceProperties[FaceProperty.WearingGlasses].ToString();
                LeftEyeResult.Text     = frameResult.FaceProperties[FaceProperty.LeftEyeClosed].ToString();
                RightEyeResult.Text    = frameResult.FaceProperties[FaceProperty.RightEyeClosed].ToString();
                MouthOpenResult.Text   = frameResult.FaceProperties[FaceProperty.MouthOpen].ToString();
                MouthMovedResult.Text  = frameResult.FaceProperties[FaceProperty.MouthMoved].ToString();
                LookingAwayResult.Text = frameResult.FaceProperties[FaceProperty.LookingAway].ToString();
            }
        }
Пример #3
0
    private void HdFaceReader_FrameArrived(object sender, FaceFrameArrivedEventArgs e)
    {    // Retrieve the face reference
        FaceFrameReference faceRef = e.FrameReference;

        if (faceRef == null)
        {
            return;
        }

        // Acquire the face frame
        using (FaceFrame faceFrame = faceRef.AcquireFrame())
        {
            if (faceFrame == null)
            {
                return;
            }

            // Retrieve the face frame result
            FaceFrameResult frameResult = faceFrame.FaceFrameResult;
            //	Debug.Log ("hui");

            // Display the values
            if (frameResult.FaceProperties [FaceProperty.LeftEyeClosed].ToString() == "Yes")
            {
                skinnedMeshRenderer.SetBlendShapeWeight(1, 100);
            }
            else
            {
                skinnedMeshRenderer.SetBlendShapeWeight(1, 0);
            }
            Debug.Log("hui");
            //	EngagedResult.Text = frameResult.FaceProperties[FaceProperty.Engaged].ToString();
            //GlassesResult.Text = frameResult.FaceProperties[FaceProperty.WearingGlasses].ToString();

            /*LeftEyeResult.Text = frameResult.FaceProperties[FaceProperty.LeftEyeClosed].ToString();
             * RightEyeResult.Text = frameResult.FaceProperties[FaceProperty.RightEyeClosed].ToString();
             * MouthOpenResult.Text = frameResult.FaceProperties[FaceProperty.MouthOpen].ToString();*/
            //	Debug.Log(MouthMovedResult.Text = frameResult.FaceProperties[FaceProperty.MouthMoved].ToString());
            //	LookingAwayResult.Text = frameResult.FaceProperties[FaceProperty.LookingAway].ToString();*/
        }
    }