int main(int argc, char **argv) { int res; depth_mid = (uint8_t*)malloc(640*480*3); depth_front = (uint8_t*)malloc(640*480*3); rgb_back = (uint8_t*)malloc(640*480*3); rgb_mid = (uint8_t*)malloc(640*480*3); rgb_front = (uint8_t*)malloc(640*480*3); 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; if (freenect_init(&f_ctx, NULL) < 0) { printf("freenect_init() failed\n"); return 1; } freenect_set_log_level(f_ctx, FREENECT_LOG_DEBUG); freenect_select_subdevices(f_ctx, (freenect_device_flags)(FREENECT_DEVICE_MOTOR | FREENECT_DEVICE_CAMERA)); int nr_devices = freenect_num_devices (f_ctx); printf ("Number of devices found: %d\n", nr_devices); int user_device_number = 0; if (argc > 1) user_device_number = atoi(argv[1]); if (nr_devices < 1) { freenect_shutdown(f_ctx); return 1; } if (freenect_open_device(f_ctx, &f_dev, user_device_number) < 0) { printf("Could not open device\n"); freenect_shutdown(f_ctx); return 1; } res = pthread_create(&freenect_thread, NULL, freenect_threadfunc, NULL); if (res) { printf("pthread_create failed\n"); freenect_shutdown(f_ctx); return 1; } // OS X requires GLUT to run on the main thread gl_threadfunc(NULL); return 0; }
int main( int argc, char **argv ) { //depth_gl = (uint8_t*)malloc(640*480*3); if( freenect_init( &f_context, NULL ) < 0 ) { printf( "Freenect initialization failed.\n" ); return 1; } freenect_set_log_level( f_context, FREENECT_LOG_DEBUG ); freenect_select_subdevices( f_context, ( freenect_device_flags )( FREENECT_DEVICE_MOTOR | FREENECT_DEVICE_CAMERA ) ); if( freenect_num_devices ( f_context ) < 1 ) { printf( "No devices found. Shutting down...\n" ); freenect_shutdown( f_context ); return 1; } if( freenect_open_device( f_context, &f_device, 0 ) <0 ) { printf( "Couldn't open device. Shutting down...\n" ); freenect_shutdown( f_context ); return 1; } if( pthread_create( &f_thread, NULL, f_threadfunc, NULL ) ) { printf( "Thread creation failed. Shutting down...\n" ); freenect_shutdown( f_context ); return 1; } glutInit( &argc, argv ); gl_threadfunc( NULL ); return 0; }
int main(int argc, char **argv) { int res; 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; if (freenect_init(&f_ctx, NULL) < 0) { printf("freenect_init() failed\n"); return 1; } freenect_set_log_level(f_ctx, FREENECT_LOG_DEBUG); int nr_devices = freenect_num_devices (f_ctx); printf ("Number of devices found: %d\n", nr_devices); int user_device_number = 0; if (argc > 1) user_device_number = atoi(argv[1]); if (nr_devices < 1) return 1; if (freenect_open_device(f_ctx, &f_dev, user_device_number) < 0) { printf("Could not open device\n"); return 1; } res = pthread_create(&freenect_thread, NULL, freenect_threadfunc, NULL); if (res) { printf("pthread_create failed\n"); return 1; } // OS X requires GLUT to run on the main thread gl_threadfunc(NULL); return 0; }
int main(int argc, char **argv) { int res; //initGPIO(); bool pin = pollGPIO(); printf("GPIO pin = %d\n", pin); int data_dir_number = 0; sprintf(data_dir, "%s/%d", DATA_DIR, data_dir_number); struct stat st; while(stat(data_dir,&st) == 0){ data_dir_number++; sprintf(data_dir, "%s/%d", DATA_DIR, data_dir_number); } mkdir(data_dir, S_IREAD | S_IWRITE | S_IEXEC); printf("Data dir is: %s\n", data_dir); depth_back = malloc(640*480*2); depth_mid = malloc(640*480*2); depth_front = malloc(640*480*2); rgb_back = malloc(640*480*3); rgb_mid = malloc(640*480*3); rgb_front = malloc(640*480*3); 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; if (freenect_init(&f_ctx, NULL) < 0) { printf("freenect_init() failed\n"); return 1; } freenect_set_log_level(f_ctx, FREENECT_LOG_FATAL); int nr_devices = freenect_num_devices (f_ctx); printf ("Number of devices found: %d\n", nr_devices); int user_device_number = 0; if (argc > 1) user_device_number = atoi(argv[1]); if (nr_devices < 1) return 1; if (freenect_open_device(f_ctx, &f_dev, user_device_number) < 0) { printf("Could not open device\n"); return 1; } res = pthread_create(&freenect_thread, NULL, freenect_threadfunc, NULL); if (res) { printf("pthread_create failed\n"); return 1; } // OS X requires GLUT to run on the main thread gl_threadfunc(NULL); //closeGPIO(); return 0; }