void StopColorImage() { if (_colorImageStream != null) { _colorImageStream.Dispose(); _colorImageStream = null; } }
void CreateColorImageStream(KinectImageResolution resolution) { StopColorImage(); if (resolution == KinectImageResolution.None) { return; } _colorImageStream = new V2ImageStream(Sensor); }
public MainWindow() { var sensor = V2Sensor.GetDefault(); _sensor = sensor; #if true { // setup depth stream var depthStream = new V2DepthStream(sensor.Sensor); // create the bitmap to display _depthSource = new WriteableBitmap( depthStream.Resolution.Width(), depthStream.Resolution.Height(), 96.0, 96.0, PixelFormats.Gray16, null); var depthWaitHandle = new ManualResetEvent(false); depthWaitHandle.SafeWaitHandle = new Microsoft.Win32.SafeHandles.SafeWaitHandle( depthStream.CreateWaitHandle(), false); StartUpdating(depthWaitHandle, depthStream); } #endif #if false { // setup image stream var imageStream = new V2ImageStream(sensor.Sensor); // create the bitmap to display DepthSource = new WriteableBitmap( imageStream.Width, imageStream.Height, 96.0, 96.0, PixelFormats.Bgr32, null); var waitHandle = new ManualResetEvent(false); waitHandle.SafeWaitHandle = new Microsoft.Win32.SafeHandles.SafeWaitHandle( imageStream.CreateWaitHandle(), false); StartUpdating(waitHandle, imageStream); } #endif InitializeComponent(); }