Update() public method

Creates a new PixelData array.
public Update ( Kinect.Toolbox.Record.ReplayDepthImageFrame frame ) : void
frame Kinect.Toolbox.Record.ReplayDepthImageFrame
return void
        void kinectSensor_DepthFrameReady(object sender, DepthImageFrameReadyEventArgs e)
        {
            if (replay != null && !replay.IsFinished)
            {
                return;
            }

            using (var frame = e.OpenDepthImageFrame())
            {
                if (frame == null)
                {
                    return;
                }

                if (recorder != null && ((recorder.Options & KinectRecordOptions.Depth) != 0))
                {
                    recorder.Record(frame);
                }

                if (!displayDepth)
                {
                    return;
                }

                depthManager.Update(frame);
            }
        }
Beispiel #2
0
        void kinectRuntime_AllFrameReady(object sender, AllFramesReadyEventArgs e)
        {
            // If replaying, bypass this.
            if (replay != null && !replay.IsFinished)
            {
                return;
            }

            using (var cf = e.OpenColorImageFrame())
                using (var df = e.OpenDepthImageFrame())
                    using (var sf = e.OpenSkeletonFrame()) {
                        try {
                            if (recorder != null && sf != null && df != null && cf != null)
                            {
                                recorder.Record(sf, df, cf);
                            }
                        } catch (ObjectDisposedException) { }

                        if (cf != null)
                        {
                            colorManager.Update(cf, !displayDebug);
                        }

                        if (df != null)
                        {
                            depthFrameNumber = df.FrameNumber;
                            depthManager.Update(df);
                        }

                        if (sf != null)
                        {
                            UpdateSkeletonDisplay(sf);
                            if (handTracker != null && recogEngine != null)
                            {
                                var result = handTracker.Update(depthManager.PixelData, colorManager.PixelData,
                                                                SkeletonUtil.FirstTrackedSkeleton(sf.GetSkeletons()));
                                var gesture = recogEngine.Update(result);
                                lock (inputServer)
                                    inputServer.Send(gesture);
                                UpdateDisplay(result);
                                textGestureEvent.Text = gesture;
                                fpsCounter.LogFPS();
                            }
                        }
                    }
        }