Example #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;
            }
        }
Example #2
0
        internal void ChangeColorResolution(KinectBase.ColorImageFormat newResolution)
        {
            kinect.ColorStream.Disable();
            if (newResolution != KinectBase.ColorImageFormat.Undefined)
            {
                kinect.ColorStream.Enable(convertColorImageFormat(newResolution));

                //Get the size, in bytes, of the new image array and reset the image pool
                int size = 0;
                if (newResolution == KinectBase.ColorImageFormat.InfraredResolution640x480Fps30)
                {
                    size = 640 * 480 * 2;
                }
                else if (newResolution == KinectBase.ColorImageFormat.RawBayerResolution1280x960Fps12 || newResolution == KinectBase.ColorImageFormat.RgbResolution1280x960Fps12)
                {
                    size = 1280 * 960 * 4;
                }
                else
                {
                    size = 640 * 480 * 4;
                }
                colorImagePool.ResetPool(() => new byte[size]);

                isColorStreamOn = true;
            }
            else
            {
                isColorStreamOn = false;
            }
        }