public void Loop(LoopObjects loopObjects)
        {
            PXCMFaceData.Face face     = loopObjects.Get <PXCMFaceData.Face>();
            PXCMFaceData      faceData = loopObjects.Get <PXCMFaceData>();

            var rdata  = face.QueryRecognition();
            var userId = rdata.QueryUserID();

            switch (_recognitionState)
            {
            case RecognitionState.Idle:
                break;

            case RecognitionState.Requested:
                rdata.RegisterUser();
                _recognitionState = RecognitionState.Working;
                break;

            case RecognitionState.Working:
                if (userId > 0)
                {
                    _recognitionState = RecognitionState.Done;
                }
                break;

            case RecognitionState.Done:
                SaveDatabase(faceData);
                _recognitionState = RecognitionState.Idle;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            _camera.Face.UserId = userId;
        }
Example #2
0
        private void TrackFingers(Hand hand, PXCMHandData.AccessOrderType label, LoopObjects loopObjects)
        {
            var handInfo = loopObjects.Get <PXCMHandData.IHand>(label.ToString());

            if (handInfo == null)
            {
                return;
            }
            TrackIndex(hand.Index, handInfo);
            TrackMiddle(hand.Middle, handInfo);
            TrackRing(hand.Ring, handInfo);
            TrackPinky(hand.Pinky, handInfo);
            TrackThumb(hand.Thumb, handInfo);
        }
 public void Loop(LoopObjects loopObjects)
 {
     PXCMFaceData.Face            face = loopObjects.Get <PXCMFaceData.Face>();
     PXCMFaceData.ExpressionsData data = face?.QueryExpressions();
     if (data == null)
     {
         return;
     }
     _camera.Face.Mouth.IsSmiling = CheckFaceExpression(data, FaceExpression.EXPRESSION_SMILE, SmileThreshold);
     _camera.Face.Mouth.IsOpen    = CheckFaceExpression(data, FaceExpression.EXPRESSION_MOUTH_OPEN, MonthOpenThreshold);
     _camera.Face.LeftEye.IsOpen  = !CheckFaceExpression(data, FaceExpression.EXPRESSION_EYES_CLOSED_LEFT, EyesClosedThreshold);
     _camera.Face.RightEye.IsOpen = !CheckFaceExpression(data, FaceExpression.EXPRESSION_EYES_CLOSED_RIGHT, EyesClosedThreshold);
     _camera.Face.EyesDirection   = GetEyesDirection(data);
 }