@@ -283,12 +283,12 @@ private void timer_Elapsed(object sender, ElapsedEventArgs e)
283
283
284
284
private void sensor_ColorFrameReady ( object sender , ColorImageFrameReadyEventArgs e )
285
285
{
286
- frameCount ++ ;
287
-
288
286
using ( ColorImageFrame colorFrame = e . OpenColorImageFrame ( ) )
289
287
{
290
288
if ( colorFrame != null )
291
289
{
290
+ frameCount ++ ;
291
+
292
292
using ( DrawingContext dc = this . drawingGroup . Open ( ) )
293
293
{
294
294
// Copy the pixel data from the image to a temporary array
@@ -330,7 +330,7 @@ private void sensor_ColorFrameReady(object sender, ColorImageFrameReadyEventArgs
330
330
GhostSkeleton skeleton = sequence . SavedSkeletons [ sequence . CurrentFrame ] ;
331
331
this . DrawBonesAndJoints ( skeleton , dc ) ;
332
332
333
- if ( frameCount % 4 == 0 )
333
+ if ( frameCount % 2 == 0 )
334
334
{
335
335
sequence . CurrentFrame ++ ;
336
336
}
@@ -355,25 +355,6 @@ private void sensor_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArg
355
355
}
356
356
}
357
357
358
- lock ( lockObj )
359
- {
360
- List < GhostSkeletonSequence > toRemove = new List < GhostSkeletonSequence > ( ) ;
361
- foreach ( GhostSkeletonSequence sequence in activeSequences )
362
- {
363
- if ( sequence . CurrentFrame >= sequence . SavedSkeletons . Count - 1 )
364
- {
365
- sequence . CurrentFrame = 0 ;
366
- toRemove . Add ( sequence ) ;
367
- continue ;
368
- }
369
-
370
- GhostSkeleton skeleton = sequence . SavedSkeletons [ sequence . CurrentFrame ] ;
371
- sequence . CurrentFrame ++ ;
372
- }
373
-
374
- toRemove . ForEach ( sequence => activeSequences . Remove ( sequence ) ) ;
375
- }
376
-
377
358
// Used to determine when skeletons move off the screen
378
359
List < int > unseenTrackingIDs = this . trackingIDsToSequences . Keys . ToList ( ) ;
379
360
@@ -400,8 +381,6 @@ private void sensor_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArg
400
381
401
382
sequence . AddSkeleton ( skel ) ;
402
383
}
403
-
404
- //this.DrawBonesAndJoints(skel, dc);
405
384
}
406
385
}
407
386
0 commit comments