예제 #1
0
        internal void ChangeDepthResolution(KinectBase.DepthImageFormat newResolution)
        {
            kinect.DepthStream.Disable();
            if (newResolution != KinectBase.DepthImageFormat.Undefined)
            {
                kinect.DepthStream.Enable(convertDepthImageFormat(newResolution));

                //Get the size, in bytes, of the new image array and reset the image pool
                int size = 0;
                if (newResolution == KinectBase.DepthImageFormat.Resolution640x480Fps30)
                {
                    size = 640 * 480 * 4;
                }
                else if (newResolution == KinectBase.DepthImageFormat.Resolution320x240Fps30)
                {
                    size = 320 * 240 * 4;
                }
                else
                {
                    size = 80 * 60 * 4;
                }
                depthImagePool.ResetPool(() => new byte[size]);

                isDepthStreamOn = true;
            }
            else
            {
                isDepthStreamOn = false;
            }
        }
        private void depthResComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            KinectBase.DepthImageFormat newFormat = KinectBase.DepthImageFormat.Undefined;

            switch (depthResComboBox.SelectedIndex)
            {
            case (0):
            {
                newFormat = KinectBase.DepthImageFormat.Resolution640x480Fps30;
                break;
            }

            case (1):
            {
                newFormat = KinectBase.DepthImageFormat.Resolution320x240Fps30;
                break;
            }

            case (2):
            {
                newFormat = KinectBase.DepthImageFormat.Resolution80x60Fps30;
                break;
            }

            case (3):
            {
                //Note: This case should never be hit.  In order for skeleton tracking to work, we must have the depth image so turning it off is currently not available from the GUI
                newFormat = KinectBase.DepthImageFormat.Undefined;
                break;
            }
            }

            kinectSettings.depthImageMode = newFormat;

            kinectCore.ChangeDepthResolution(newFormat);
        }
예제 #3
0
 private DepthImageFormat convertDepthImageFormat(KinectBase.DepthImageFormat format)
 {
     //The depth formats are all numbered the same for the Kienct v1, so we can do a straight cast
     return((DepthImageFormat)format);
 }