Exemplo n.º 1
0
 public void showSkeleton(HumanSkeleton skel)
 {
     // Visualize the points if we are not playing currently
     if (gmt.ready())
     {
         if (kinectPointsId != -1)
         {
             gmt.removePoints(kinectPointsId);
         }
         kinectPointsId = gmt.showPoints(skel.JointPositions.ToList());
     }
 }
Exemplo n.º 2
0
 void kinect_NewData(object sender, NewDataEventArgs e)
 {
     HumanSkeleton skel = new HumanSkeleton(arrayToList(e.data));
     viz.showSkeleton(skel);
     lock (currentRecordingSequence)
     {
         if (currentRecordingSequence.Count == 0)
         {
             currentRecordingSequence.Add(Tuple.Create(stopwatch.ElapsedMilliseconds, skel));
         }
         else
         {
             long startMs = currentRecordingSequence[0].Item1;
             long endMs = stopwatch.ElapsedMilliseconds;
             long msDelta = (endMs - startMs);
             if (msDelta > maxTimeWindow)
             {
                 // We need to remove elements from the front until we are within the delta
                 while ((endMs - startMs) > maxTimeWindow && currentRecordingSequence.Count > 0)
                 {
                     currentRecordingSequence.RemoveAt(0);
                     if (currentRecordingSequence.Count > 0)
                         startMs = currentRecordingSequence[0].Item1;
                 }
             }
             currentRecordingSequence.Add(Tuple.Create(endMs, skel));
             startMs = currentRecordingSequence[0].Item1;
             msDelta = (endMs - startMs);
             if (msDelta > maxTimeWindow / 2 && currentRecordingSequence.Count > (maxTimeWindow / 30) / 2)
             {
                 // We have a valid capture if we have at least half our max time window
                 SequenceAvailable = true;
             }
         }
     }
 }
Exemplo n.º 3
0
 public AngleConverter(HumanSkeleton hk)
 {
     this.hk = hk;
     this.angles = new float[(int)NaoJointAngle.count];
     getArmAngles();
 }