Antialiasing.AntialiasingMain.SensorAllFramesReady C# (CSharp) Метод

SensorAllFramesReady() приватный Метод

Event handler for Kinect sensor's DepthFrameReady event
private SensorAllFramesReady ( object sender, AllFramesReadyEventArgs e ) : void
sender object object sending the event
e AllFramesReadyEventArgs event arguments
Результат void
        private void SensorAllFramesReady(object sender, AllFramesReadyEventArgs e)
        {
            // in the middle of shutting down, so nothing to do
            if (null == this.sensor)
            {
                return;
            }

            bool depthReceived = false;
            bool colorReceived = false;

            using (DepthImageFrame depthFrame = e.OpenDepthImageFrame())
            {
                if (null != depthFrame)
                {
                    // Copy the pixel data from the image to a temporary array
                    depthFrame.CopyDepthImagePixelDataTo(this.depthPixels);

                    depthReceived = true;
                }
            }

            using (ColorImageFrame colorFrame = e.OpenColorImageFrame())
            {
                if (null != colorFrame)
                {
                    // Copy the pixel data from the image to a temporary array
                    colorFrame.CopyPixelDataTo(this.colorPixels);

                    colorReceived = true;
                }
            }

            // do our processing outside of the using block
            // so that we return resources to the kinect as soon as possible

            // do our processing outside of the using block
            // so that we return resources to the kinect as soon as possible
            if (depthReceived && colorReceived)
            {
                GreenScreen.RenderImageData(depthPixels, colorPixels);
            }
        }