private void LongExposureInfraredFrameReader_FrameArrived(LongExposureInfraredFrameReference longExposureInfraredFrameReference) { using (LongExposureInfraredFrame longExposureInfraredFrame = longExposureInfraredFrameReference.AcquireFrame()) { if (longExposureInfraredFrame != null) { FrameDescription longExposureInfraredFrameDescription = longExposureInfraredFrame.FrameDescription; using (KinectBuffer longExposureInfraredBuffer = longExposureInfraredFrame.LockImageBuffer()) { using (var dest = ImagePool.GetOrCreate(longExposureInfraredFrameDescription.Width, longExposureInfraredFrameDescription.Height, Imaging.PixelFormat.Gray_16bpp)) { longExposureInfraredFrame.CopyFrameDataToIntPtr(dest.Resource.ImageData, (uint)(longExposureInfraredFrameDescription.Width * longExposureInfraredFrameDescription.Height * 2)); var time = this.pipeline.GetCurrentTimeFromElapsedTicks(longExposureInfraredFrameReference.RelativeTime.Ticks); this.LongExposureInfraredImage.Post(dest, time); } } } } }
private void LongExposureInfraredReader_FrameArrived(object sender, LongExposureInfraredFrameArrivedEventArgs e) { if (this.processingLongExposureInfraredFrame) { return; } this.processingLongExposureInfraredFrame = true; bool longExposureInfraredFrameProcessed = false; using (LongExposureInfraredFrame longExposureInfraredFrame = e.FrameReference.AcquireFrame()) { if (longExposureInfraredFrame != null) { using (Microsoft.Kinect.KinectBuffer longExposureInfraredBuffer = longExposureInfraredFrame.LockImageBuffer()) { // verify data and write the color data to the display bitmap if (((this.longExposureInfraredFrameDescription.Width * this.longExposureInfraredFrameDescription.Height) == (longExposureInfraredBuffer.Size / this.longExposureInfraredFrameDescription.BytesPerPixel))) { this.ProcessLongExposureInfraredFrameData(longExposureInfraredBuffer.UnderlyingBuffer, longExposureInfraredBuffer.Size, this.longExposureInfraredFrameDescription.BytesPerPixel); longExposureInfraredFrameProcessed = true; } } } } if (longExposureInfraredFrameProcessed) { this.Rescale(this.longExposureInfraredPixels, this.truncatedLongExposureInfraredPixels); this.longExposureInfraredFrameCallback(this.truncatedLongExposureInfraredPixels); } this.processingLongExposureInfraredFrame = false; }