/// <summary>
        /// Hook up to the Kinectmanager to get data from the kinectSensor
        /// </summary>
        public void PollSkeleton(SkeletonFrameReadyEventArgs e)
        {
            //Get data from the current Frame
            using (var sensorData = e.OpenSkeletonFrame())
            {
                if (sensorData == null)
                {
                    Debug.Log(LogLevel.Error, "No sensor data available");
                    return;
                }

                //Copy data from the skeleton
                var skeletons = new Skeleton[sensorData.SkeletonArrayLength];
                sensorData.CopySkeletonDataTo(skeletons);

                //Find the tracked skeleton and return the current frame
                foreach (var frame in from skeleton in skeletons where skeleton.TrackingState == SkeletonTrackingState.Tracked select new KinectFrame(skeleton))
                {
                    //record the frame, filter out the bad frames in the recording itself
                    if (IsRecording)
                    {
                        Record(frame);
                        Debug.Log(LogLevel.Info, "Recording");
                    }
                    _frameDrawer.Draw(frame);
                }
            }
        }
Ejemplo n.º 2
0
        public void DrawFrame()
        {
            //Don't do anything if no recording
            if (_recording == null)
            {
                return;
            }

            //get the current frame from the recording
            var currFrame = _recording.GetFrame(CurrentFrameIndex);

            //draw it
            _frameDrawer.Draw(currFrame);
        }