Load from Kinect

Feb 28, 2011 by admin    No Comments    Posted under: Programming

Get video feed from Kinect, while all the libs are correctly installed!

 *      Author: Dimitrios Prodromou
 *      office@robotas.at
// Be sure to link with -lfreenect_sync
#include <stdlib.h>
#include <stdio.h>
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <libfreenect_sync.h>
int main()
 IplImage *image = cvCreateImageHeader(cvSize(640,480), 8, 3);
 while (cvWaitKey(10) < 0)
 char *data;
 unsigned int timestamp;
 freenect_sync_get_video((void**)(&data), &timestamp, 0, FREENECT_VIDEO_RGB);
 cvSetData(image, data, 640*3);
 cvCvtColor(image, image, CV_RGB2BGR);
 cvShowImage("RGB", image);

Got anything to say? Go ahead and leave a comment!

You must be logged in to post a comment.