Advertisement
Guest User

Untitled

a guest
Dec 1st, 2010
888
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.56 KB | None | 0 0
  1. // Be sure to link with -lfreenect_sync
  2. #include <opencv/cv.h>
  3. #include <opencv/highgui.h>
  4. #include <libfreenect/libfreenect_sync.h>
  5.  
  6. freenect_context *f_ctx;
  7. freenect_device *f_dev;
  8.  
  9. int main(int argc, char **argv)
  10. {  
  11.     IplImage *image = cvCreateImageHeader(cvSize(640,480), 8, 3);
  12.     while (cvWaitKey(10) < 0) {
  13.       char *data;
  14.       unsigned int timestamp;
  15.       freenect_sync_get_rgb(&data, &timestamp);
  16.       cvSetData(image, data, 640*3);
  17.       cvCvtColor(image, image, CV_RGB2BGR);
  18.       cvShowImage("RGB", image);
  19.       free(data);
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement