Changeset 349 for trunk/projects/polly/polly.c
- Timestamp:
- 01/21/07 22:19:45 (4 years ago)
- Files:
-
- 1 modified
-
trunk/projects/polly/polly.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/projects/polly/polly.c
r343 r349 7 7 #include <cc3.h> 8 8 #include <cc3_ilp.h> 9 #include <cc3_conv.h> 9 10 #include "polly.h" 10 #include "conv.h"11 #include "lreg.h"12 11 13 12 #define MMC_DEBUG 14 13 14 ccr_config_t g_cc_conf; 15 15 16 16 // Constants for connected component blob reduce … … 30 30 uint32_t last_time, val,i; 31 31 char c; 32 filter_t blur;32 cc3_kernel_t blur; 33 33 cc3_pixel_t p; 34 34 cc3_image_t polly_img; 35 35 cc3_image_t img; 36 uint8_t *range; 37 uint8_t *x_axis; 36 38 37 cc3_pixel_t mid_pix; 39 38 cc3_pixel_t right_pix; 40 39 cc3_pixel_t down_pix; 41 reg_data_t reg_line;40 42 41 43 42 // limit the recursive depth … … 74 73 return 0; 75 74 76 range = malloc(polly_img.width); 77 if(range==NULL) 75 if(config.histogram==NULL) 78 76 return 0; 79 77 … … 108 106 blur.mat[1][0]=1; blur.mat[1][1]=1; blur.mat[1][2]=1; 109 107 blur.mat[2][0]=1; blur.mat[2][1]=1; blur.mat[2][2]=1; 110 val=convolve(img,blur); 108 blur.divisor=9; 109 val=cc3_convolve_img(img,blur); 111 110 if(val==0) 112 111 { … … 149 148 matrix_to_pgm (&polly_img); 150 149 #endif 151 generate_polly_histogram (&polly_img, range);150 generate_polly_histogram (&polly_img, config.histogram); 152 151 153 x_axis = malloc(polly_img.width);152 /*x_axis = malloc(polly_img.width); 154 153 for(i=0; i<polly_img.width; i++ ) 155 154 x_axis[i]=i; 156 155 157 156 158 lreg(x_axis, range, polly_img.width,®_line);157 lreg(x_axis, config.histogram, polly_img.width,®_line); 159 158 160 159 printf( "a=%f\n",reg_line.a ); … … 166 165 printf( "distance = %f\n",distance ); 167 166 168 convert_histogram_to_ppm (&polly_img, range);167 convert_histogram_to_ppm (&polly_img, config.histogram); 169 168 170 169 … … 176 175 printf( "H " ); 177 176 for(int i=5; i<polly_img.width; i+=5) 178 printf( "%d ",polly_img.height- range[i] );177 printf( "%d ",polly_img.height-config.histogram[i] ); 179 178 printf( "\r" ); 180 179 */ 181 180 182 181 free (img.pix); // don't forget to free! 183 182 free (polly_img.pix); 184 free (x_axis); 185 free (range); 183 // free (x_axis); 186 184 187 185 } … … 406 404 break; 407 405 } 406 407 // Downsample Histogram 408 // for (x = 0; x < width - 5; x += 5) { 409 // int min; 410 // min = 100; 411 // for (int i = 0; i < 5; i++) { 412 // if (hist[x + i] < min) 413 // min = hist[x + i]; 414 // } 415 // for (int i = 0; i < 5; i++) 416 // hist[x + i] = min; 417 // } 418 419 420 } 408 421 /* 409 // Downsample Histogram410 for (x = 0; x < width - 5; x += 5) {411 int min;412 min = 100;413 for (int i = 0; i < 5; i++) {414 if (hist[x + i] < min)415 min = hist[x + i];416 }417 for (int i = 0; i < 5; i++)418 hist[x + i] = min;419 }420 */421 422 423 424 425 }426 427 422 void convert_histogram_to_ppm (cc3_image_t * img, uint8_t * hist) 428 423 { … … 448 443 } 449 444 } 450 445 */ 451 446 452 447
