// gets the current frame and is triggered every new frame private void currentFrame(VideoStream vStream) { if (vStream.IsValid && vStream.IsFrameAvailable()) { using (OpenNIWrapper.VideoFrameRef frame = vStream.ReadFrame()) { if (frame.IsValid) { VideoFrameRef.CopyBitmapOptions options = VideoFrameRef.CopyBitmapOptions.None | VideoFrameRef.CopyBitmapOptions.Force24BitRgb; lock (this.m_Bitmap) { try { frame.UpdateBitmap(m_Bitmap, options); Image <Bgra, Byte> colorFrame = new Image <Bgra, Byte>(m_Bitmap); Image <Gray, Int32> xFrame = new Image <Gray, float>(m_Bitmap).Convert <Gray, Int32>(); CameraManager.Instance.SetImages(colorFrame, colorFrame, xFrame, xFrame); } catch (Exception exception) { Console.WriteLine("Exception occurred while updating frame."); Console.WriteLine(exception.Message); } } } } } }
void depthSensor_onNewFrame(VideoStream vStream) { if (!vStream.isValid || !vStream.isFrameAvailable()) return; VideoFrameRef frame = vStream.readFrame(); if (!frame.isValid) return; lock (depthMutex) { depthFrame = frame; } }
void colorSensor_onNewFrame(VideoStream vStream) { if (!vStream.isValid || !vStream.isFrameAvailable()) return; VideoFrameRef frame = vStream.readFrame(); if (!frame.isValid) return; lock (colorMutex) { colorFrame = frame; } }
private void ColorSensor_OnNewFrame(VideoStream vStream) { if (!vStream.IsValid || !vStream.IsFrameAvailable()) return; VideoFrameRef frame = vStream.ReadFrame(); if (!frame.IsValid) return; lock (colorMutex) { colorFrame = frame; } }