Esempio n. 1
0
        /// <summary>
        /// Checks if the two movements correspond to the same by comparing each frame.
        /// </summary>
        public static bool match(SkeletonRecording original, SkeletonRecording imitation)
        {
            float             accumError    = 0;
            SkeletonRecording safeOriginal  = new SkeletonRecording(original);
            SkeletonRecording safeImitation = new SkeletonRecording(imitation);

            safeOriginal.restart();
            safeImitation.restart();

            while (!safeOriginal.finished())
            {
                Skeleton orig  = safeOriginal.next();
                Skeleton imit  = safeImitation.next();
                float    error = compareAngles(orig, imit);
                if (error > delta)
                {
                    return(false);
                }
                accumError += error;
                if (accumError > deltaAccum)
                {
                    return(false);
                }
            }
            return(accumError < deltaAccum);
        }
Esempio n. 2
0
 public void dataArrived(object data)
 {
     if (recorder.finished())
     {
         if (client != null)
         {
             client.unsubscribe(this);
             Application.Current.Dispatcher.BeginInvoke(new ThreadStart(() => DrawingUtils.deleteElements(skeletonCanvas, tag)));
             return;
         }
         else
         {
             recorder.restart();
         }
     }
     SkeletonUtils.redraw(skeletonCanvas, recorder.next(), tag, color);
 }
Esempio n. 3
0
        /// <summary>
        /// Calculates the difference between the two movements as the absolute sum of each frame error.
        /// </summary>
        public static float difference(SkeletonRecording original, SkeletonRecording imitation)
        {
            float accumError = 0;

            SkeletonRecording safeOriginal  = new SkeletonRecording(original);
            SkeletonRecording safeImitation = new SkeletonRecording(imitation);

            safeOriginal.restart();
            safeImitation.restart();
            while (!safeOriginal.finished())
            {
                Skeleton orig  = safeOriginal.next();
                Skeleton imit  = safeImitation.next();
                float    error = compareAngles(orig, imit);
                accumError += error;
            }
            return(accumError);
        }