supplierdeeply

Histogram on powershot SX230HS

  • 0 Replies
  • 729 Views
Histogram on powershot SX230HS
« on: 01 / October / 2013, 05:08:27 »
Advertisements
Hi,

Please find below my function  shot_histogram_get_range(...), I return only rng.
I realise an histogram with that I get only 64 value equi-distributed on 0-1023. But this histogram does not match with the histogram calculate by canon or gimp. And this histogram means nothing for me. When the picture has a correct exposure histogram extract by lua script using (get_histo_range()) display a dark histogram!

I think the problem is  in build_shot_histogram() when chdk called get_raw_pixel(x,y). get_raw_pixel() is it safe?

Thanks,

Dav

/**
shot_histogram_get_range
**/
int shot_histogram_get_range(int histo_from, int histo_to)
// Examines the histogram, and returns the percentage of pixels that
// have luminance between histo_from and histo_to
{
 int x, tot, rng;
 tot=0;
 rng=0;
 
 if(!shot_histogram_isenabled()) // TODO we could return an error somehow
  return 0;
 for (x = 0 ; x < SHOT_HISTOGRAM_SAMPLES; x ++ ) 
 {
   tot += shot_histogram
  • ;

   if (x>=histo_from  && x <= histo_to) 
   {
      rng += shot_histogram
  • ;

   }    
 }
 // try
 return rng;
 
 // Default config
 // return (rng*100)/tot;
}

 

Related Topics