Exemple #1
0
        void kinectRuntime_ColorFrameReady(object sender, ColorImageFrameReadyEventArgs e)
        {
            if (replay != null && !replay.IsFinished)
            {
                return;
            }

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

                if (recorder != null && ((recorder.Options & KinectRecordOptions.Color) != 0))
                {
                    recorder.Record(frame);
                    Debug.WriteLine("Color Recorded");
                }

                //  if (displayDepth)
                //    return;

                colorManager.Update(frame);
            }
        }
        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);
            }
        }
Exemple #3
0
 private void OnAllFramesReady(object sender, AllFramesReadyEventArgs e)
 {
     if (Recording)
     {
         using (SkeletonFrame SkeletonFrame = e.OpenSkeletonFrame())
         {
             if (SkeletonFrame != null)
             {
                 KinectSkeletonRecorder.Record(SkeletonFrame);
             }
         }
         using (ColorImageFrame ColorImageFrame = e.OpenColorImageFrame())
         {
             if (ColorImageFrame != null)
             {
                 KinectColorRecorder.Record(ColorImageFrame);
             }
         }
         using (DepthImageFrame DepthImageFrame = e.OpenDepthImageFrame())
         {
             if (DepthImageFrame != null)
             {
                 KinectDepthRecorder.Record(DepthImageFrame);
             }
         }
     }
 }
Exemple #4
0
 public void Record(SkeletonFrame frame)
 {
     if (null != KinectRecorder && KinectRecorder.IsRecording)
     {
         KinectRecorder.Record(frame);
     }
 }
Exemple #5
0
 public void Record(DepthImageFrame frame)
 {
     if (null != KinectRecorder && KinectRecorder.IsRecording)
     {
         KinectRecorder.Record(frame);
     }
 }
Exemple #6
0
        void KinectSensorAllFramesReady(object sender, AllFramesReadyEventArgs e)
        {
            if (replay != null && !replay.IsFinished)
            {
                return;
            }

            using (var frame = e.OpenColorImageFrame())
            {
                if (frame != null)
                {
                    if (recorder != null)
                    {
                        recorder.Record(frame);
                    }
                    UpdateColorFrame(frame);
                }
            }

            using (var frame = e.OpenDepthImageFrame())
            {
                if (frame != null)
                {
                    if (recorder != null)
                    {
                        recorder.Record(frame);
                    }
                }
            }

            using (var frame = e.OpenSkeletonFrame())
            {
                if (frame != null)
                {
                    if (recorder != null)
                    {
                        recorder.Record(frame);
                    }
                    UpdateSkeletons(frame);
                }
            }
        }
        void KinectRuntimeColorFrameReady(object sender, ColorImageFrameReadyEventArgs e)
        {
            if (replay != null && !replay.IsFinished)
            {
                return;
            }

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

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

                colorManager.Update(frame);
            }
        }
Exemple #8
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();
                            }
                        }
                    }
        }