Video source for Microsoft Kinect's depth sensor.

The video source captures depth data from Microsoft Kinect depth sensor, which is aimed originally as a gaming device for XBox 360 platform.

Prior to using the class, make sure you've installed Kinect's drivers as described on Open Kinect project's page.

In order to run correctly the class requires freenect.dll library to be put into solution's output folder. This can be found within the AForge.NET framework's distribution in Externals folder.

Sample usage:

// create video source KinectDepthCamera videoSource = new KinectDepthCamera( 0 ); // set NewFrame event handler videoSource.NewFrame += new NewFrameEventHandler( video_NewFrame ); // start the video source videoSource.Start( ); // ... private void video_NewFrame( object sender, NewFrameEventArgs eventArgs ) { // get new frame Bitmap bitmap = eventArgs.Frame; // process the frame }
Inheritance: IVideoSource
Ejemplo n.º 1
0
        private void btnSelectCamera_Click(object sender, EventArgs e)
        {
            VideoCaptureDeviceForm form = new VideoCaptureDeviceForm();

            if (form.ShowDialog() == DialogResult.OK)
            {
                int deviceId = form.DeviceId;

                kinectDevice = Kinect.GetDevice(deviceId);

                if (videoCamera == null)
                {
                    videoCamera = kinectDevice.GetVideoCamera();
                    videoCamera.CameraMode = VideoCameraMode.Color;

                    controller.Device = videoCamera;
                    controller.Start();
                    controller.NewFrame += new NewFrameEventHandler(controller_NewFrame);
                }

                if (depthCamera == null)
                {
                    //depthCamera = kinectDevice.GetDepthCamera();
                    depthCamera = new KinectDepthCamera(deviceId, CameraResolution.Medium, true);

                    videoSourcePlayer1.VideoSource = depthCamera;
                    videoSourcePlayer1.Start();
                }


                toolStripStatusLabel1.Text = "Initializing...";
            }
        }