void ProcessCustomFrame(MediaFrameReference frame)
        {
            if ((this.PoseFrameArrived != null) &&
                (this.colorCoordinateSystem != null))
            {
                var trackingFrame = PoseTrackingFrame.Create(frame);
                var eventArgs     = new mtPoseTrackingFrameEventArgs();

                if (trackingFrame.Status == PoseTrackingFrameCreationStatus.Success)
                {
                    // Which of the entities here are actually tracked?
                    var trackedEntities =
                        trackingFrame.Frame.Entities.Where(e => e.IsTracked).ToArray();

                    var trackedCount = trackedEntities.Count();

                    if (trackedCount > 0)
                    {
                        eventArgs.PoseEntries =
                            trackedEntities
                            .Select(entity =>
                                    mtPoseTrackingDetails.FromPoseTrackingEntity(entity, this.colorIntrinsics, this.depthColorTransform.Value))
                            .ToArray();
                    }
                    this.PoseFrameArrived(this, eventArgs);
                }
            }
        }
Beispiel #2
0
 void OnPoseFrameArrived(object sender, mtPoseTrackingFrameEventArgs e)
 {
     // NB: we do not invalidate the control here but, instead, just keep
     // this frame around (maybe) until the colour frame redraws which will
     // (depending on race conditions) pick up this frame and draw it
     // too.
     this.lastPoseEventArgs = e;
 }