Пример #1
0
        private static void UpdateFacePoint(TargetData faceBone, KinectDevice.FaceBone faceBoneId, Vector referencePoint)
        {
            Vector facePointPosition = faceBone.startPosition + KinectDevice.GetFacePoint(faceBoneId) - referencePoint;

            faceBone.position            = Filter(faceBone.position, facePointPosition);
            faceBone.confidence.position = 0.7F;
        }
Пример #2
0
        private void UpdateCheeks()
        {
            float confidence = 0.7F;

            Vector referencePoint = KinectDevice.GetFacePoint((int)HighDetailFacePoints.NoseBottom);
            Vector cheekPosition;

            cheekPosition                 = KinectDevice.GetFacePoint(KinectDevice.FaceBone.LeftCheek) - referencePoint;
            leftCheek.position            = Filter(leftCheek.position, leftCheek.startPosition + cheekPosition);
            leftCheek.confidence.position = confidence;

            cheekPosition                  = KinectDevice.GetFacePoint(KinectDevice.FaceBone.RightCheek) - referencePoint;
            rightCheek.position            = Filter(rightCheek.position, rightCheek.startPosition + cheekPosition);
            rightCheek.confidence.position = confidence;
        }
Пример #3
0
        private static void CalibrateEyeBrows()
        {
            Vector leftEyePositon = KinectDevice.GetFacePoint((int)HighDetailFacePoints.LefteyeMidbottom);

            for (int i = (int)FaceBone.LeftOuterBrow; i <= (int)FaceBone.LeftInnerBrow; i++)
            {
                faceBias[i] = leftEyePositon - GetFacePointRaw((FaceBone)i);
            }

            Vector rightEyePosition = KinectDevice.GetFacePoint((int)HighDetailFacePoints.RighteyeMidbottom);

            for (int i = (int)FaceBone.RightInnerBrow; i <= (int)FaceBone.RightOuterBrow; i++)
            {
                faceBias[i] = rightEyePosition - GetFacePointRaw((FaceBone)i);
            }
        }
Пример #4
0
        private void UpdateMouth()
        {
            float confidence = 0.7F;

            Vector referencePoint = KinectDevice.GetFacePoint((int)HighDetailFacePoints.NoseBottom);
            Vector lipPosition;

            lipPosition = mouth.upperLipLeft.startPosition + KinectDevice.GetFacePoint(KinectDevice.FaceBone.UpperLipLeft) - referencePoint;
            mouth.upperLipLeft.position            = Filter(mouth.upperLipLeft.position, lipPosition);
            mouth.upperLipLeft.confidence.position = confidence;

            lipPosition                        = mouth.upperLip.startPosition + KinectDevice.GetFacePoint(KinectDevice.FaceBone.UpperLip) - referencePoint;
            mouth.upperLip.position            = Filter(mouth.upperLip.position, lipPosition);
            mouth.upperLip.confidence.position = confidence;

            lipPosition = mouth.upperLipRight.startPosition + KinectDevice.GetFacePoint(KinectDevice.FaceBone.UpperLipRight) - referencePoint;
            mouth.upperLipRight.position            = Filter(mouth.upperLipRight.position, lipPosition);
            mouth.upperLipRight.confidence.position = confidence;


            lipPosition                       = mouth.lipLeft.startPosition + KinectDevice.GetFacePoint(KinectDevice.FaceBone.LipLeft) - referencePoint;
            lipPosition                      += (KinectDevice.GetFaceExpression(KinectDevice.FaceExpression.LipPucker)) * 0.01F * Vector.right;
            mouth.lipLeft.position            = Filter(mouth.lipLeft.position, lipPosition);
            mouth.lipLeft.confidence.position = confidence;

            lipPosition                        = mouth.lipRight.startPosition + KinectDevice.GetFacePoint(KinectDevice.FaceBone.LipRight) - referencePoint;
            lipPosition                       += (KinectDevice.GetFaceExpression(KinectDevice.FaceExpression.LipPucker)) * -0.01F * Vector.right;
            mouth.lipRight.position            = Filter(mouth.lipRight.position, lipPosition);
            mouth.lipRight.confidence.position = confidence;

            lipPosition = mouth.lowerLipLeft.startPosition + KinectDevice.GetFacePoint(KinectDevice.FaceBone.LowerLipLeft) - referencePoint;
            mouth.lowerLipLeft.position            = Filter(mouth.lowerLipLeft.position, lipPosition);
            mouth.lowerLipLeft.confidence.position = confidence;

            lipPosition                        = mouth.lowerLip.startPosition + KinectDevice.GetFacePoint(KinectDevice.FaceBone.LowerLip) - referencePoint;
            mouth.lowerLip.position            = Filter(mouth.lowerLip.position, lipPosition);
            mouth.lowerLip.confidence.position = confidence;

            lipPosition = mouth.lowerLipRight.startPosition + KinectDevice.GetFacePoint(KinectDevice.FaceBone.LowerLipRight) - referencePoint;
            mouth.lowerLipRight.position            = Filter(mouth.lowerLipRight.position, lipPosition);
            mouth.lowerLipRight.confidence.position = confidence;
        }
Пример #5
0
        private void UpdateEyeBrows()
        {
            float  confidence = 0.7F;
            Vector browPosition;

            Vector leftEyePositon = KinectDevice.GetFacePoint((int)HighDetailFacePoints.LefteyeMidbottom);

            Vector browExpressionPosition = Vector.zero;   // (KinectDevice.GetFaceExpression(KinectDevice.FaceExpression.BrowLowererLeft) - 0.75F) * 0.01F * Vector.up;

            // This is very unstable

            browPosition                       = KinectDevice.GetFacePoint(KinectDevice.FaceBone.LeftOuterBrow) - leftEyePositon;
            browPosition                      -= browExpressionPosition;
            leftBrow.outer.position            = Filter(leftBrow.outer.position, leftBrow.outer.startPosition + browPosition);
            leftBrow.outer.confidence.position = confidence;

            browPosition                        = KinectDevice.GetFacePoint(KinectDevice.FaceBone.LeftBrow) - leftEyePositon;
            browPosition                       -= browExpressionPosition;
            leftBrow.center.position            = Filter(leftBrow.center.position, leftBrow.center.startPosition + browPosition);
            leftBrow.center.confidence.position = confidence;

            browPosition                       = KinectDevice.GetFacePoint(KinectDevice.FaceBone.LeftInnerBrow) - leftEyePositon;
            browPosition                      -= browExpressionPosition;
            leftBrow.inner.position            = Filter(leftBrow.inner.position, leftBrow.inner.startPosition + browPosition);
            leftBrow.inner.confidence.position = confidence;

            Vector rightEyePosition = KinectDevice.GetFacePoint((int)HighDetailFacePoints.RighteyeMidbottom);

            browPosition                        = KinectDevice.GetFacePoint(KinectDevice.FaceBone.RightInnerBrow) - rightEyePosition;
            rightBrow.inner.position            = Filter(rightBrow.inner.position, rightBrow.inner.startPosition + browPosition);
            rightBrow.inner.confidence.position = confidence;

            browPosition = KinectDevice.GetFacePoint(KinectDevice.FaceBone.RightBrow) - rightEyePosition;
            rightBrow.center.position            = Filter(rightBrow.center.position, rightBrow.center.startPosition + browPosition);
            rightBrow.center.confidence.position = confidence;

            browPosition                        = KinectDevice.GetFacePoint(KinectDevice.FaceBone.RightOuterBrow) - rightEyePosition;
            rightBrow.outer.position            = Filter(rightBrow.outer.position, rightBrow.outer.startPosition + browPosition);
            rightBrow.outer.confidence.position = confidence;
        }
Пример #6
0
        private void UpdateNose()
        {
            float confidence = 0.7F;

            // We could also use NoseTip as reference point...
            Vector referencePoint = KinectDevice.GetFacePoint((int)HighDetailFacePoints.NoseBottom);
            Vector nosePosition;

            nosePosition                 = KinectDevice.GetFacePoint(KinectDevice.FaceBone.NoseTop) - referencePoint;
            nose.top.position            = Filter(nose.top.position, nose.top.startPosition + nosePosition);
            nose.top.confidence.position = confidence;

            nosePosition                     = KinectDevice.GetFacePoint(KinectDevice.FaceBone.NoseTopLeft) - referencePoint;
            nose.topLeft.position            = Filter(nose.topLeft.position, nose.topLeft.startPosition + nosePosition);
            nose.topLeft.confidence.position = confidence;

            nosePosition                      = KinectDevice.GetFacePoint(KinectDevice.FaceBone.NoseTopRight) - referencePoint;
            nose.topRight.position            = Filter(nose.topRight.position, nose.topRight.startPosition + nosePosition);
            nose.topRight.confidence.position = confidence;

            nosePosition                 = KinectDevice.GetFacePoint(KinectDevice.FaceBone.NoseTip) - referencePoint;
            nose.tip.position            = Filter(nose.tip.position, nose.tip.startPosition + nosePosition);
            nose.tip.confidence.position = confidence;

            nosePosition                        = KinectDevice.GetFacePoint(KinectDevice.FaceBone.NoseBottomLeft) - referencePoint;
            nose.bottomLeft.position            = Filter(nose.bottomLeft.position, nose.bottomLeft.startPosition + nosePosition);
            nose.bottomLeft.confidence.position = confidence;

            nosePosition                    = KinectDevice.GetFacePoint(KinectDevice.FaceBone.NoseBottom) - referencePoint;
            nose.bottom.position            = Filter(nose.bottom.position, nose.bottom.startPosition + nosePosition);
            nose.bottom.confidence.position = confidence;

            nosePosition = KinectDevice.GetFacePoint(KinectDevice.FaceBone.NoseBottomRight) - referencePoint;
            nose.bottomRight.position            = Filter(nose.bottomRight.position, nose.bottomRight.startPosition + nosePosition);
            nose.bottomRight.confidence.position = confidence;
        }