Changeset 232

Show
Ignore:
Timestamp:
04/25/06 16:54:00 (3 years ago)
Author:
anthony_rowe
Message:

CMUcam2 omg...

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/cc3_ilp/cc3_ilp.c

    r212 r232  
    1010  uint32_t size_x, size_y; 
    1111  uint8_t *row = cc3_malloc_rows(1); 
     12  uint8_t num_channels = cc3_g_current_frame.coi == CC3_ALL ? 3 : 1; 
    1213 
    1314  cc3_set_led (1); 
     
    2728     
    2829    cc3_pixbuf_read_rows(row, 1); 
    29     for (x = 0; x < size_x * 3U; x++) { 
     30    for (x = 0; x < size_x * num_channels; x++) { 
    3031      uint8_t p = row[x]; 
    31       if (p < 14) { 
    32         p = 14; 
    33       } 
    3432      putchar (p); 
    3533    } 
  • trunk/projects/cmucam2/cmucam2.c

    r229 r232  
    7777 
    7878  while (1) { 
     79    cc3_channel_t old_coi; 
     80     
    7981    printf (":"); 
    8082    error = 0; 
     
    141143        break; 
    142144      case SEND_FRAME: 
    143         if (n == 1 && arg_list[0] > 4) { 
    144           error = 1; 
    145           break; 
    146         } 
     145        old_coi = cc3_g_current_frame.coi; 
     146        if (n == 1) { 
     147          if (arg_list[0] > 4) { 
     148            error = 1; 
     149            break; 
     150          } 
     151          cc3_pixbuf_set_coi(arg_list[0]); 
     152        } 
    147153        else if (n > 1) { 
    148154          error = 1; 
     
    152158          print_ACK (); 
    153159        cc3_send_image_direct (); 
     160        cc3_pixbuf_set_coi(old_coi); 
    154161        break; 
    155162      case CAMERA_REG: 
  • trunk/projects/viola-jones/main.c

    r231 r232  
    7272 
    7373          //      printf("writing to file %u \n\r", i); 
    74           fprintf(fp, "%d ", cc3_integral_image[i][0]); 
     74          //fprintf(fp, "%d ", cc3_integral_image[i][0]); 
    7575          //      printf("wrot to file %u \n\r", i); 
    7676           
     
    8181              cc3_integral_image[i][j] = pix_temp.channel[1]; // only green channel 
    8282              //  cc3_integral_image[i][j] = (3*pix_temp.channel[0]+6*pix_temp.channel[1]+pix_temp.channel[2])/10; // rgb->gray  
    83               fprintf( fp,"%d ",cc3_integral_image[i][j] ); 
     83              //fprintf( fp,"%d ",cc3_integral_image[i][j] ); 
    8484               
    8585              // compute cumulative sum across the row 
    8686              cc3_integral_image[i][j] += cc3_integral_image[i][j-1]; 
    8787            } 
    88           fprintf( fp, "\n" ); 
     88          //fprintf( fp, "\n" ); 
    8989        } 
    9090       
     
    123123      cc3_integral_image[newly_added_row][0] = pix_temp.channel[1]; 
    124124      //      cc3_integral_image[newly_added_row][0] = (3*pix_temp.channel[0]+6*pix_temp.channel[1]+pix_temp.channel[2])/10; // rgb->gray  
    125       fprintf( fp,"%d ",cc3_integral_image[newly_added_row][0] ); 
     125      //fprintf( fp,"%d ",cc3_integral_image[newly_added_row][0] ); 
    126126       
    127127      // read the row, from next pixel onward and compute cum sum across the row 
     
    131131          cc3_integral_image[newly_added_row][j] = pix_temp.channel[1]; 
    132132          //      cc3_integral_image[newly_added_row][j] = (3*pix_temp.channel[0] + 6*pix_temp.channel[1] + pix_temp.channel[2])/10; 
    133           fprintf( fp,"%d ",cc3_integral_image[newly_added_row][j] ); 
     133          //fprintf( fp,"%d ",cc3_integral_image[newly_added_row][j] ); 
    134134 
    135135          // compute cumulative sum across the row 
    136136          cc3_integral_image[newly_added_row][j] += cc3_integral_image[newly_added_row][j-1]; 
    137137        } 
    138        fprintf( fp, "\n" ); 
     138       //fprintf( fp, "\n" ); 
    139139 
    140140       //     printf("%s %d \n\r", "New Row...", cc3_row_counter_calc_ii); 
     
    294294 
    295295  int16_t val;  
     296  uint8_t blink; 
     297  blink=0; 
    296298  // don't know why its here...just dont feel like removing it...has been the sole variable that has stood the test of time...:-) 
    297299  // i feel bonded .... 
     
    352354        
    353355        
    354        printf(" New Frame...\n\r"); 
     356      // printf(" New Frame...\n\r"); 
     357       printf( "START\r" );  
     358       // new image 
     359       //sprintf(img_name, "%s%04d%s","c:/img",num_frames, ".pgm"); 
     360       //fp=fopen(img_name,"w" ); 
     361       //printf("%s %s\n\r", "Opened: ",img_name); 
    355362        
    356        // new image 
    357        sprintf(img_name, "%s%04d%s","c:/img",num_frames, ".pgm"); 
    358        fp=fopen(img_name,"w" ); 
    359        printf("%s %s\n\r", "Opened: ",img_name); 
    360         
    361        fprintf( fp, "P2\n%d %d\n255\n", cc3_g_current_frame.width, cc3_g_current_frame.height-top_offset-bottom_offset ); 
    362        sprintf(img_name, "%s%04d%s","c:/img",num_frames,".txt"); 
    363        fout = fopen(img_name, "w"); 
    364        printf("%s %s\n\r", "Opened: ",img_name); 
     363       //fprintf( fp, "P2\n%d %d\n255\n", cc3_g_current_frame.width, cc3_g_current_frame.height-top_offset-bottom_offset ); 
     364       //sprintf(img_name, "%s%04d%s","c:/img",num_frames,".txt"); 
     365       //fout = fopen(img_name, "w"); 
     366       //printf("%s %s\n\r", "Opened: ",img_name); 
    365367 
    366368       // This tells the camera to grab a new frame into the fifo and reset 
     
    410412                        if (x2 >= CC3_INTEGRAL_IMG_WIDTH )  
    411413                          { 
    412                             printf("Error....width outside limits!! \n\r"); 
     414                            printf("*Error....width outside limits!! \n\r"); 
    413415                          } 
    414416                         
     
    696698                                    if (face) 
    697699                                      { 
    698                                         fprintf(fout, "%d %d %d \n",curr_pos_x+1, cc3_row_counter_cropped_img+1, CC3_SCALES[curr_scale_idx]-1); 
     700                                        printf( "F %d %d %d\r",curr_pos_x+1, cc3_row_counter_cropped_img+1, CC3_SCALES[curr_scale_idx]-1); 
     701                                //      fprintf(fout, "%d %d %d \n",curr_pos_x+1, cc3_row_counter_cropped_img+1, CC3_SCALES[curr_scale_idx]-1); 
    699702                                        //              cc3_faces[cc3_num_detected_faces][0] = curr_pos_x; 
    700703                                        //cc3_faces[cc3_num_detected_faces][1] = cc3_row_counter_cropped_img; // + top_offset; 
     
    727730          } // end of iterating over all the rows in the actual image (upto bottom_offset) 
    728731         
    729         printf("No. of faces : %d \n\r", cc3_num_detected_faces);      
    730          
     732//      printf("No. of faces : %d \n\r", cc3_num_detected_faces);  
     733        if(cc3_num_detected_faces>0 ) cc3_set_led(2); 
     734        else cc3_clr_led(2);     
     735        printf( "END %d\r",cc3_num_detected_faces ); 
     736 
    731737        //      for (uint8_t i = 0; i < cc3_num_detected_faces; i++) 
    732738        //  printf ( " Face at x=%d, y=%d scale=%d \n\r",cc3_faces[i][0], cc3_faces[i][1], cc3_faces[i][2]); 
    733739 
    734       fprintf( fout, "%d %d %d \n",0,0,0); 
    735       fclose(fout); 
    736       fclose(fp); 
     740//    fprintf( fout, "%d %d %d \n",0,0,0); 
     741//    fclose(fout); 
     742//    fclose(fp); 
    737743 
    738744        num_frames++; 
    739745        //      break; 
    740          
     746 
     747        if(blink) 
     748        {        
    741749        cc3_clr_led (0); 
    742         cc3_set_led (2); 
    743          while(!cc3_read_button()); 
     750        } 
     751        else 
     752        { 
    744753         cc3_set_led (0); 
    745          cc3_clr_led (2); 
     754        } 
     755        blink=!blink; 
    746756          // wait for the button to be pressed for the next frame 
    747757 
     
    753763     
    754764    free(cc3_img_tmp.pix);  // don't forget to free! 
    755     printf( "You pressed %c to escape \n\r",fgetc(stdin) ); 
    756      
    757     // stdio actually works...  
    758     printf( "Type in a number followed by return to test scanf: " ); 
    759     scanf( "%d", &val ); 
    760     printf( "You typed %d\n",val ); 
    761      
    762     printf( "Good work, now try something on your own...\n" ); 
    763765    while(1); 
    764766