Update() private method

private Update ( ) : void
return void
Ejemplo n.º 1
0
        public bool Update(Frame frame)
        {
            if (IsFinalized)
            {
                return(true);
            }

            CurrentFPS = frame.CurrentFramesPerSecond;

            var hand = frame.Hand(Id);

            if (!hand.IsValid)
            {
                // Our hand is not in this frame,
                // but we won't give up for 25ms.
                if (frame.Timestamp - CurrentHandTime < 25000)
                {
                    return(true);
                }

                // Our hand is truly gone...
                FinalHand                = CurrentHand;
                DetectedHand             = Hand.Invalid;
                StabilizedHand           = Hand.Invalid;
                CurrentHand              = Hand.Invalid;
                _Stabilized.CurrentValue = false;
                Id = 0;
                return(true);
            }

            // We still exist in this frame, update current
            CurrentHand     = hand;
            CurrentHandTime = frame.Timestamp;

            if (!IsStabilized)
            {
                // Check for stabilization complete
                if (_Stabilized.Update(frame))
                {
                    StabilizedHand = hand;
                }
            }

            _Velocity.Update(frame);
            _X.Update(frame);
            _Y.Update(frame);
            _Z.Update(frame);
            if (_Velocity.CurrentValue < 300)
            {
                _Pitch.Update(frame);
                _Roll.Update(frame);
                _Yaw.Update(frame);
            }
            _FingerCount.Update(frame);
            HandTracker.Update(frame);
            FingerTracker.Update(frame);

            return(true);
        }