//[MethodImpl(MethodImplOptions.Synchronized)] public void addColorFrameListener(ColorFrameListener listener) { colorFrameListeners.Add(listener); if (colorFrameListeners.Count == 1) { kinectSensor.ColorStream.Enable(ColorImageFormat.RawYuvResolution640x480Fps15); kinectSensor.ColorFrameReady += OnColorFrameReady; } }
public void addColorFrameListener(ColorFrameListener listener) { colorFrameListeners.Add(listener); if (colorFrameListeners.Count == 1) { this.colorFrameDescription = this.kinectSensor.ColorFrameSource.CreateFrameDescription(ColorImageFormat.Bgra); this.colorPixelsWidth = colorFrameDescription.Width; this.colorPixelsHeight = colorFrameDescription.Height; this.colorPixelsLength = colorFrameDescription.Width * colorFrameDescription.Height; this.colorBytesLength = colorPixelsLength * colorFrameDescription.BytesPerPixel; colorPixels = new byte[colorBytesLength]; colorFrameReader = kinectSensor.ColorFrameSource.OpenReader(); colorFrameReader.FrameArrived += this.colorFrameArrived; } }