protected override void OnHandle(object sender, FrameEventArgs eventArgs)
        {
            var frame     = eventArgs.frame;
            var rightHand = frame.Hands.FirstOrDefault(hand => hand.IsRight);

            if (rightHand == null)
            {
                _eventAggregator
                .GetEvent <AfterFrameHandleEvent>()
                .Publish(
                    new AfterFrameHandleEventArgs()
                {
                    ErrorMessage = "Right hand is required!"
                });

                return;
            }

            var controllerOutput = _controllerOutputService.GetControllerOutput(rightHand);
            var decision         = _classifier.Decide(controllerOutput);

            _eventAggregator
            .GetEvent <AfterFrameHandleEvent>()
            .Publish(
                new AfterFrameHandleEventArgs()
            {
                OutputClass = (OutputClass)decision
            });

            Debug.WriteLine((OutputClass)decision);
        }
Exemple #2
0
        protected override void OnHandle(object sender, FrameEventArgs eventArgs)
        {
            var frame     = eventArgs.frame;
            var rightHand = frame.Hands.FirstOrDefault(hand => hand.IsRight);

            if (rightHand == null)
            {
                throw new ArgumentException("Right hand is required!");
            }
            if (rightHand.Confidence < 0.99)
            {
                throw new ArgumentException("Noised data!");
            }

            var controllerOutput = _controllerOutputService.GetControllerOutput(rightHand);

            _dataSetWrapper.Add(controllerOutput);

            Debug.WriteLine($"{controllerOutput.IndexMiddleAngle} {controllerOutput.MiddleRingAngle} {controllerOutput.ThumbIndexAngle} {controllerOutput.RingPinkyAngle}");
        }