Show
Ignore:
Timestamp:
01/21/07 22:19:45 (4 years ago)
Author:
anthony_rowe
Message:

polly update

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/projects/polly/polly.c

    r343 r349  
    77#include <cc3.h> 
    88#include <cc3_ilp.h> 
     9#include <cc3_conv.h> 
    910#include "polly.h" 
    10 #include "conv.h" 
    11 #include "lreg.h" 
    1211 
    1312#define MMC_DEBUG 
    1413 
     14ccr_config_t g_cc_conf; 
    1515 
    1616// Constants for connected component blob reduce 
     
    3030  uint32_t last_time, val,i; 
    3131  char c; 
    32   filter_t blur; 
     32  cc3_kernel_t blur; 
    3333  cc3_pixel_t p; 
    3434  cc3_image_t polly_img; 
    3535  cc3_image_t img; 
    36   uint8_t *range; 
    37   uint8_t *x_axis; 
     36   
    3837  cc3_pixel_t mid_pix; 
    3938  cc3_pixel_t right_pix; 
    4039  cc3_pixel_t down_pix; 
    41   reg_data_t reg_line; 
     40  
    4241 
    4342 // limit the recursive depth 
     
    7473        return 0; 
    7574   
    76   range = malloc(polly_img.width); 
    77   if(range==NULL) 
     75  if(config.histogram==NULL) 
    7876        return 0; 
    7977 
     
    108106        blur.mat[1][0]=1; blur.mat[1][1]=1; blur.mat[1][2]=1; 
    109107        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); 
    111110        if(val==0) 
    112111                { 
     
    149148    matrix_to_pgm (&polly_img); 
    150149#endif 
    151     generate_polly_histogram (&polly_img, range); 
     150    generate_polly_histogram (&polly_img, config.histogram); 
    152151   
    153     x_axis = malloc(polly_img.width); 
     152    /*x_axis = malloc(polly_img.width); 
    154153    for(i=0; i<polly_img.width; i++ ) 
    155154        x_axis[i]=i; 
    156155     
    157156 
    158      lreg(x_axis, range, polly_img.width,&reg_line); 
     157     lreg(x_axis, config.histogram, polly_img.width,&reg_line); 
    159158 
    160159     printf( "a=%f\n",reg_line.a );      
     
    166165     printf( "distance = %f\n",distance );  
    167166     
    168     convert_histogram_to_ppm (&polly_img, range); 
     167    convert_histogram_to_ppm (&polly_img, config.histogram); 
    169168 
    170169 
     
    176175    printf( "H " ); 
    177176    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] ); 
    179178    printf( "\r" ); 
    180  
     179*/ 
    181180 
    182181  free (img.pix);               // don't forget to free! 
    183182  free (polly_img.pix);                
    184   free (x_axis);              
    185   free (range);                
     183 // free (x_axis);              
    186184 
    187185} 
     
    406404      break; 
    407405  } 
     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} 
    408421/* 
    409   // Downsample Histogram  
    410   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  
    427422void convert_histogram_to_ppm (cc3_image_t * img, uint8_t * hist) 
    428423{ 
     
    448443  } 
    449444} 
    450  
     445*/ 
    451446 
    452447