Example #1
0
        private void UpdateFace()
        {
            smile  = RealsenseDevice.GetFaceExpression(RealsenseDevice.FaceExpression.Smile);
            pucker = RealsenseDevice.GetFaceExpression(RealsenseDevice.FaceExpression.Kiss);
            frown  = (RealsenseDevice.GetFaceExpression(RealsenseDevice.FaceExpression.BrowLowererLeft) +
                      RealsenseDevice.GetFaceExpression(RealsenseDevice.FaceExpression.BrowLowererLeft)) / 2;

            UpdateEyeBrows();
            UpdateEyeLids();

            UpdateNose();
            UpdateMouth();
            //UpdateJaw();
        }
Example #2
0
        private static void UpdateFacePoint(TargetData faceBone, FaceBone faceBoneId, Vector referencePoint)
        {
            Vector facePointPosition;

            if (RealsenseDevice.GetFacePoint(faceBoneId, out facePointPosition))
            {
                facePointPosition            = faceBone.startPosition + facePointPosition - referencePoint;
                faceBone.position            = Filter(faceBone.position, facePointPosition);
                faceBone.confidence.position = 0.7F;
            }
            else
            {
                faceBone.confidence.position = 0;
            }
        }
Example #3
0
        public override Status Update()
        {
            if (RealsenseDevice.GetFaceTargetConfidence() <= 0)
            {
                status = RealsenseDevice.present ? Status.Present : Status.Unavailable;
                return(status);
            }

            status = Status.Tracking;

            if (faceTracking)
            {
                UpdateFace();
            }

            return(status);
        }
Example #4
0
        private void UpdateEyeBrows()
        {
            Vector leftEyePositon;

            if (RealsenseDevice.GetFacePoint(76, out leftEyePositon))
            {
                UpdateFacePoint(leftBrow.outer, FaceBone.LeftOuterBrow, leftEyePositon);
                UpdateFacePoint(leftBrow.center, FaceBone.LeftBrow, leftEyePositon);
                UpdateFacePoint(leftBrow.inner, FaceBone.LeftInnerBrow, leftEyePositon);
            }

            Vector rightEyePositon;

            if (RealsenseDevice.GetFacePoint(77, out rightEyePositon))
            {
                UpdateFacePoint(rightBrow.inner, FaceBone.RightInnerBrow, rightEyePositon);
                UpdateFacePoint(rightBrow.center, FaceBone.RightBrow, rightEyePositon);
                UpdateFacePoint(rightBrow.outer, FaceBone.RightOuterBrow, rightEyePositon);
            }
        }
Example #5
0
 private void UpdateEyeLids()
 {
     leftEye.closed  = RealsenseDevice.GetFaceExpression(RealsenseDevice.FaceExpression.EyeClosedLeft);
     rightEye.closed = RealsenseDevice.GetFaceExpression(RealsenseDevice.FaceExpression.EyeClosedRight);
 }