예제 #1
0
        /// <summary>
        /// This function determines a double value which ranks the likelyhood a point is part of this tracker.
        /// Smaller numbers are more likely than larger ones.  Distributions need all the data in order to be normalised with respect to another.
        /// </summary>
        /// <param name="pInput"></param>
        /// <returns>A double word value which ranks the likelyhood of this input being part of this tracker.  Smaller is better.</returns>
        public double getClassificationRanking(SpatioTemporalInput pInput)
        {
            // TODO: TIME IS NOT TAKEN INTO ACCOUNT OF IN THESE EQUATIONS....

            // Compute the distance of the input point to the best and predicted.
            Vector vInput                 = pInput.Point;
            double fDistanceFromBest      = (Position - vInput).Length;
            double fDistanceFromPredicted = (PredictedNextPosition - vInput).Length;

            // Select the smallest of the two lengths (an optimistic algorythm).
            return(Math.Min(fDistanceFromBest, fDistanceFromPredicted));
        }
예제 #2
0
        /// <summary>
        /// Take an input which is gaurenteed to be part of this tracker.  Update the tracker based on the input.
        /// </summary>
        /// <param name="pInput">The input we wish to consume.</param>
        public void consumeInput(SpatioTemporalInput pInput)
        {
            // Add the point to the smoothing buffer.
            this.SmoothingBuffer.addValue(pInput.Point);

            // Compute the position as the newly smoothed value.
            Vector tLastPosition = this.Position;

            this.Position = this.SmoothingBuffer.getSmoothedValue();

            // Compute the forward as the difference between the two.
            Forward = new Vector(tLastPosition.X - this.Position.X, tLastPosition.Y - this.Position.Y);

            // Compute the radius as the length of the next predicted.
            //double fLength = Forward.Length * 10;
            //fLength = 100;// Math.Max(50, Math.Min(fLength, 500));
            //if (fLength == 0)
            //    fLength = 100.0f;

            // Compute the normalised forward vector.
            NormalForward = Forward;
            NormalForward.Normalize();

            // Now, if I were handling an adaptive radius, I would update it here to encompass the new predicted position.
            //PredictionScale = fLength;

            // If our tracker lock is 0 then it is sorta-safe to say we are the starting position.
            if (iTrackerLock == 0)
            {
                StartPosition = Position;
            }

            // Increment the tracker lock and reset the lost lock to 0.
            ++iTrackerLock;
            iTrackerLostLock = 0;
        }
예제 #3
0
 /// <summary>
 /// Construct a new process pair.  This will invoke 'getClassificationRanking' on the tracker.
 /// </summary>
 /// <param name="pTracker">The tracker to pair.</param>
 /// <param name="pInput">The input to pair.</param>
 public ProcessPair(SpatioTemporalTracker pTracker, SpatioTemporalInput pInput)
 {
     this.pInput   = pInput;
     this.pTracker = pTracker;
     this.fRanking = pTracker.getClassificationRanking(this.pInput);
 }