void nui_DepthFrameReady(object sender, ImageFrameReadyEventArgs e) { PlanarImage Image = e.ImageFrame.Image; byte[] convertedDepthFrame = convertDepthFrame(e.ImageFrame); depthWidth = Image.Width; depthHeight = Image.Height; //An interopBitmap is a WPF construct that enables resetting the Bits of the image. //This is more efficient than doing a BitmapSource.Create call every frame. if (imageHelper == null) { imageHelper = new InteropBitmapHelper(Image.Width, Image.Height, convertedDepthFrame); kinectDepthImage.Source = imageHelper.InteropBitmap; } else { imageHelper.UpdateBits(convertedDepthFrame); } }