/// <summary> /// Constructor, object Initialize /// </summary> public KinectSensorPlus() { foreach (var potentialSensor in KinectSensor.KinectSensors) { if (potentialSensor.Status == KinectStatus.Connected) { this.sensor = potentialSensor; break; } } if (null != this.sensor) { this.detector = new FingerDetection(this.sensor); this.Fingers = new FingerIdentification(this.sensor); this.rectDepth3D = new PointDepth3D[rectWidth * rectHeight]; this.readyEvent = new KinectReadyEvent(); this.sensor.ColorFrameReady += new EventHandler <ColorImageFrameReadyEventArgs>(sensor_ColorFrameReady); this.sensor.DepthFrameReady += new EventHandler <DepthImageFrameReadyEventArgs>(sensor_DepthFrameReady); this.sensor.SkeletonFrameReady += new EventHandler <SkeletonFrameReadyEventArgs>(sensor_SkeletonFrameReady); this.colorPixels = new byte[this.sensor.ColorStream.FramePixelDataLength]; this.depthPixels = new DepthImagePixel[this.sensor.DepthStream.FramePixelDataLength]; this.depthColor = new byte[this.sensor.DepthStream.FramePixelDataLength * sizeof(int)]; this.colorBitmap = new WriteableBitmap(this.sensor.ColorStream.FrameWidth, this.sensor.ColorStream.FrameHeight, 96.0, 96.0, PixelFormats.Bgr32, null); this.depthBitmap = new WriteableBitmap(this.sensor.DepthStream.FrameWidth, this.sensor.DepthStream.FrameHeight, 96.0, 96.0, PixelFormats.Bgr32, null); this.DepthFrameWidth = this.sensor.DepthStream.FrameWidth; this.DepthFrameHeight = this.sensor.DepthStream.FrameHeight; } }
/// <summary> /// Constructor, object Initialize /// </summary> public KinectSensorPlus() { foreach (var potentialSensor in KinectSensor.KinectSensors) { if (potentialSensor.Status == KinectStatus.Connected) { this.sensor = potentialSensor; break; } } if (null != this.sensor) { this.detector = new FingerDetection(this.sensor); this.Fingers = new FingerIdentification(this.sensor); this.rectDepth3D = new PointDepth3D[rectWidth * rectHeight]; this.readyEvent = new KinectReadyEvent(); this.sensor.ColorFrameReady += new EventHandler<ColorImageFrameReadyEventArgs>(sensor_ColorFrameReady); this.sensor.DepthFrameReady += new EventHandler<DepthImageFrameReadyEventArgs>(sensor_DepthFrameReady); this.sensor.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(sensor_SkeletonFrameReady); this.colorPixels = new byte[this.sensor.ColorStream.FramePixelDataLength]; this.depthPixels = new DepthImagePixel[this.sensor.DepthStream.FramePixelDataLength]; this.depthColor = new byte[this.sensor.DepthStream.FramePixelDataLength * sizeof(int)]; this.colorBitmap = new WriteableBitmap(this.sensor.ColorStream.FrameWidth, this.sensor.ColorStream.FrameHeight, 96.0, 96.0, PixelFormats.Bgr32, null); this.depthBitmap = new WriteableBitmap(this.sensor.DepthStream.FrameWidth, this.sensor.DepthStream.FrameHeight, 96.0, 96.0, PixelFormats.Bgr32, null); this.DepthFrameWidth = this.sensor.DepthStream.FrameWidth; this.DepthFrameHeight = this.sensor.DepthStream.FrameHeight; } }