int main(int argc, char **argv) { int res; libusb_device_handle *dev; printf("Kinect camera test\n"); int i; for (i=0; i<2048; i++) { float v = i/2048.0; v = powf(v, 3)* 6; t_gamma[i] = v*6*256; } g_argc = argc; g_argv = argv; libusb_init(NULL); dev = libusb_open_device_with_vid_pid(NULL, 0x45e, 0x2ae); if (!dev) { printf("Could not open device\n"); return 1; } res = pthread_create(&gl_thread, NULL, gl_threadfunc, NULL); if (res) { printf("pthread_create failed\n"); return 1; } cams_init(dev, depthimg, rgbimg); while(!die && libusb_handle_events(NULL) == 0); pthread_exit(NULL); }
int main (int argc, char **argv) { ros::init (argc, argv, "kinect_node"); libusb_init(NULL); libusb_device_handle *dev = libusb_open_device_with_vid_pid(NULL, 0x45e, 0x2ae); if (!dev) { ROS_WARN("Could not open Kinect device, exiting"); return 1; } kinect = new Kinect(); // start acquisition cams_init(dev, depthimg, rgbimg); // ros loop while (ros::ok() && (libusb_handle_events(NULL) == 0)) ros::spinOnce(); return 0; }