Kinect Project

We are trying to develop some interesting projects with recent Microsoft Kinect Sensor.

We release the alpha code for saving the depth data (based on OpenKinect and OpenCV) and transforming them into 3D data for the usage in Matlab and Meshlab. Note that it is an alpha version and very unstable, we are still working on it.

This code is based on OpenKinect and modified by Zhaoyin. It is successfully compiled and run on Windows 7 64 bit/Visual Studio 2010/Matlab 2010a. The code is to capture the Kinect depth and color image, and read from matlab and render in meshlab. It uses the method introduced in this page by Nicolas Burrus.

1. Download and install OpenKinect and OpenCV 2.2

2. Download the Visual studio solution (.sln) and Matlab script (.m) from here and here. You will get a zip file. Please unzip the file and open "KinectOpenCV.sln" first.

3. Try to add necessary dependence (should be already added) opencv_core220d.lib opencv_highgui220d.lib opencv_video220d.lib opencv_ml220d.lib opencv_legacy220d.lib opencv_imgproc220d.lib freenect.lib freenect_sync.lib pthreadVC2.lib

4. Make sure you have a "KinectData" folder with "KinectOpenCV.cpp" file. Run the code, and press "Enter", it will save the depth and color image into the KinectData folder with the file format: kd_mmdd_hhmmss_dep/img.png

5. Run matlab code

mat3d=GetPlyFromDImg_vd1(png_img_file_name,png_file_folder,0)

Note that folder should have a back slash "/" at the end. Also the input is the COLOR image, NOT the DEPTH image. One example is:

mat=GetPlyFromDImg_vd1('kd_0203_191812_img.png','data_0203/',0);

6. The mat variable stores the 3D information as the following format:

x, y, z, color_r, color_g, color_b

Also it outputs a .ply file. You can view the render result by using meshlab.

There is a pair of sample kinect data in the "KinectData" folder, and a ply file for rendering result. Note that for color image alignment, you might want to calibrate your kinect camera. If you have any question or fail to compile the code, you can send me an e-mail along with your system platform and error message.