protected virtual void OnNewData(NewDataEventArgs e) { if (NewData != null) { NewData(this, e); } }
private void newKinectData(object sender, NewDataEventArgs e) { // Visualize the points if we are not playing currently if (gmt.ready()) { if (kinectPointsId != -1) { gmt.removePoints(kinectPointsId); } if (kinect_vis) { kinectPointsId = gmt.showPoints(arrayToList(e.data)); } } // And save them if we are recording if (recording) currentRecordingSequence.Add(new RecordingPoint(stopwatch.ElapsedMilliseconds, e.data)); }
private void OnNewData(NewDataEventArgs newDataEventArgs) { if (NewData != null) NewData(this, newDataEventArgs); }
private void newKinectData(object sender, NewDataEventArgs e) { if (NewData != null) NewData(sender, e); }
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; } } } }