Changeset 232
- Timestamp:
- 04/25/06 16:54:00 (3 years ago)
- Files:
-
- trunk/lib/cc3_ilp/cc3_ilp.c (modified) (2 diffs)
- trunk/projects/cmucam2/cmucam2.c (modified) (3 diffs)
- trunk/projects/viola-jones/main.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/cc3_ilp/cc3_ilp.c
r212 r232 10 10 uint32_t size_x, size_y; 11 11 uint8_t *row = cc3_malloc_rows(1); 12 uint8_t num_channels = cc3_g_current_frame.coi == CC3_ALL ? 3 : 1; 12 13 13 14 cc3_set_led (1); … … 27 28 28 29 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++) { 30 31 uint8_t p = row[x]; 31 if (p < 14) {32 p = 14;33 }34 32 putchar (p); 35 33 } trunk/projects/cmucam2/cmucam2.c
r229 r232 77 77 78 78 while (1) { 79 cc3_channel_t old_coi; 80 79 81 printf (":"); 80 82 error = 0; … … 141 143 break; 142 144 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 } 147 153 else if (n > 1) { 148 154 error = 1; … … 152 158 print_ACK (); 153 159 cc3_send_image_direct (); 160 cc3_pixbuf_set_coi(old_coi); 154 161 break; 155 162 case CAMERA_REG: trunk/projects/viola-jones/main.c
r231 r232 72 72 73 73 // 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]); 75 75 // printf("wrot to file %u \n\r", i); 76 76 … … 81 81 cc3_integral_image[i][j] = pix_temp.channel[1]; // only green channel 82 82 // 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] ); 84 84 85 85 // compute cumulative sum across the row 86 86 cc3_integral_image[i][j] += cc3_integral_image[i][j-1]; 87 87 } 88 fprintf( fp, "\n" );88 //fprintf( fp, "\n" ); 89 89 } 90 90 … … 123 123 cc3_integral_image[newly_added_row][0] = pix_temp.channel[1]; 124 124 // 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] ); 126 126 127 127 // read the row, from next pixel onward and compute cum sum across the row … … 131 131 cc3_integral_image[newly_added_row][j] = pix_temp.channel[1]; 132 132 // 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] ); 134 134 135 135 // compute cumulative sum across the row 136 136 cc3_integral_image[newly_added_row][j] += cc3_integral_image[newly_added_row][j-1]; 137 137 } 138 fprintf( fp, "\n" );138 //fprintf( fp, "\n" ); 139 139 140 140 // printf("%s %d \n\r", "New Row...", cc3_row_counter_calc_ii); … … 294 294 295 295 int16_t val; 296 uint8_t blink; 297 blink=0; 296 298 // don't know why its here...just dont feel like removing it...has been the sole variable that has stood the test of time...:-) 297 299 // i feel bonded .... … … 352 354 353 355 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); 355 362 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); 365 367 366 368 // This tells the camera to grab a new frame into the fifo and reset … … 410 412 if (x2 >= CC3_INTEGRAL_IMG_WIDTH ) 411 413 { 412 printf(" Error....width outside limits!! \n\r");414 printf("*Error....width outside limits!! \n\r"); 413 415 } 414 416 … … 696 698 if (face) 697 699 { 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); 699 702 // cc3_faces[cc3_num_detected_faces][0] = curr_pos_x; 700 703 //cc3_faces[cc3_num_detected_faces][1] = cc3_row_counter_cropped_img; // + top_offset; … … 727 730 } // end of iterating over all the rows in the actual image (upto bottom_offset) 728 731 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 731 737 // for (uint8_t i = 0; i < cc3_num_detected_faces; i++) 732 738 // printf ( " Face at x=%d, y=%d scale=%d \n\r",cc3_faces[i][0], cc3_faces[i][1], cc3_faces[i][2]); 733 739 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); 737 743 738 744 num_frames++; 739 745 // break; 740 746 747 if(blink) 748 { 741 749 cc3_clr_led (0); 742 cc3_set_led (2); 743 while(!cc3_read_button()); 750 } 751 else 752 { 744 753 cc3_set_led (0); 745 cc3_clr_led (2); 754 } 755 blink=!blink; 746 756 // wait for the button to be pressed for the next frame 747 757 … … 753 763 754 764 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" );763 765 while(1); 764 766
