@@ -83,7 +83,7 @@ void send_policy_file(int child){
8383if (psent == 0 ){
8484int n ;
8585char * str = "<?xml version='1.0'?><!DOCTYPE cross-domain-policy SYSTEM '/xml/dtds/cross-domain-policy.dtd'><cross-domain-policy><site-control permitted-cross-domain-policies='all'/><allow-access-from domain='*' to-ports='*'/></cross-domain-policy>\n" ;
86- n = write (child ,str , 237 );
86+ // n = write(child,str , 237);
8787if ( n < 0 || n != 237 )
8888{
8989fprintf (stderr , "Error on write() for depth (%d instead of %d)\n" ,n , 237 );
@@ -344,39 +344,39 @@ void depth_cb(freenect_device *dev, void *v_depth, uint32_t timestamp)
344344int lb = pval & 0xff ;
345345switch (pval >>8 ) {
346346case 0 :
347- buf_depth [4 * i + 0 ] = 255 ;
347+ buf_depth [4 * i + 2 ] = 255 ;
348348buf_depth [4 * i + 1 ] = 255 - lb ;
349- buf_depth [4 * i + 2 ] = 255 - lb ;
349+ buf_depth [4 * i + 0 ] = 255 - lb ;
350350break ;
351351case 1 :
352- buf_depth [4 * i + 0 ] = 255 ;
352+ buf_depth [4 * i + 2 ] = 255 ;
353353buf_depth [4 * i + 1 ] = lb ;
354- buf_depth [4 * i + 2 ] = 0 ;
354+ buf_depth [4 * i + 0 ] = 0 ;
355355break ;
356356case 2 :
357- buf_depth [4 * i + 0 ] = 255 - lb ;
357+ buf_depth [4 * i + 2 ] = 255 - lb ;
358358buf_depth [4 * i + 1 ] = 255 ;
359- buf_depth [4 * i + 2 ] = 0 ;
359+ buf_depth [4 * i + 0 ] = 0 ;
360360break ;
361361case 3 :
362- buf_depth [4 * i + 0 ] = 0 ;
362+ buf_depth [4 * i + 2 ] = 0 ;
363363buf_depth [4 * i + 1 ] = 255 ;
364- buf_depth [4 * i + 2 ] = lb ;
364+ buf_depth [4 * i + 0 ] = lb ;
365365break ;
366366case 4 :
367- buf_depth [4 * i + 0 ] = 0 ;
367+ buf_depth [4 * i + 2 ] = 0 ;
368368buf_depth [4 * i + 1 ] = 255 - lb ;
369- buf_depth [4 * i + 2 ] = 255 ;
369+ buf_depth [4 * i + 0 ] = 255 ;
370370break ;
371371case 5 :
372- buf_depth [4 * i + 0 ] = 0 ;
372+ buf_depth [4 * i + 2 ] = 0 ;
373373buf_depth [4 * i + 1 ] = 0 ;
374- buf_depth [4 * i + 2 ] = 255 - lb ;
374+ buf_depth [4 * i + 0 ] = 255 - lb ;
375375break ;
376376default :
377- buf_depth [4 * i + 0 ] = 0 ;
378- buf_depth [4 * i + 1 ] = 0 ;
379377buf_depth [4 * i + 2 ] = 0 ;
378+ buf_depth [4 * i + 1 ] = 0 ;
379+ buf_depth [4 * i + 0 ] = 0 ;
380380break ;
381381}
382382buf_depth [4 * i + 3 ] = 0x00 ;
@@ -406,9 +406,9 @@ void rgb_cb(freenect_device *dev, void *rgb, uint32_t timestamp)
406406//printf("size: %d", compressed_size);
407407int x ;
408408for (x = 0 ; x < 640 * 480 ; x ++ ) {
409- buf_rgb [4 * x + 0 ] = ((uint8_t * )rgb )[3 * x + 0 ];
409+ buf_rgb [4 * x + 0 ] = ((uint8_t * )rgb )[3 * x + 2 ];
410410buf_rgb [4 * x + 1 ] = ((uint8_t * )rgb )[3 * x + 1 ];
411- buf_rgb [4 * x + 2 ] = ((uint8_t * )rgb )[3 * x + 2 ];
411+ buf_rgb [4 * x + 2 ] = ((uint8_t * )rgb )[3 * x + 0 ];
412412buf_rgb [4 * x + 3 ] = 0x00 ;
413413}
414414printf ("rgb received\n " );
@@ -432,8 +432,8 @@ void *freenect_threadfunc(void *arg)
432432freenect_set_depth_callback (f_dev , depth_cb );
433433freenect_set_video_callback (f_dev , rgb_cb );
434434freenect_set_video_format (f_dev , FREENECT_VIDEO_RGB );
435- freenect_set_depth_format (f_dev , FREENECT_VIDEO_IR_10BIT );
436-
435+ freenect_set_depth_format (f_dev , FREENECT_DEPTH_11BIT );
436+
437437printf ("'w'-tilt up, 's'-level, 'x'-tilt down, '0'-'6'-select LED mode\n" );
438438if ( pthread_create (& data_in_thread , NULL , data_in , NULL ) )
439439{
0 commit comments