__/ [ tirzan ] on Monday 27 March 2006 11:08 \__
> hi NG,
>
> anybody can explain me what are histogram bins? I have some guesses, but
> I'm not sure!
You can look up a precise description by searching the Web. In short,
histogram bins involve taking the pixels whose values lie within a given
range (say 0..255) and then partitioning that range into smaller chunks
(bins or 'buckets'). You could, for example, have a bin that contains all
pixels whose (grey-level) value is between 1 and 10.
> suppose I have a BW image, and I have to create 5 histogram bins, how can
> I do?
> I think something like:
>
> bin [0] = number of gray values < 255/5
> bin [1] = 1*255/5 < number of gray values < 2*255/5
> bin [2] = 2*255/5 < number of gray values < 3*255/5
> bin [3] = 3*255/5 < number of gray values < 4*255/5
> bin [4] = 4*255/5 < number of gray values < 5*255/5
This seems acceptable for practical use, but from the point-of-view of
design, this might be flawed.
> to be more clear, in c++ i should be something like:
>
> //where max and min are the max and min gray value on the image
> float position;
> int absMin = abs(min);
>
> for (int x = 0; x < image.X; ++x){
> for (int y = 0; y < image.Y; ++y){
> position = ((image(x,y) + absMin)/(max - min)) * nrbins;
> if (position>=0 && position < nrbins)
> h[(int)floor(position)]++;
> }
> }
>
> is it correct?
What are "min" and "max"? This seems okay, but why not use many of the
existing implementation, which could be /far/ more efficient?
> thanks,
> tirzan
Hope it helps,
Roy
--
Roy S. Schestowitz
http://Schestowitz.com | SuSE Linux ¦ PGP-Key: 0x74572E8E
1:45pm up 19 days 3:30, 8 users, load average: 1.10, 1.09, 1.16
http://iuron.com - help build a non-profit search engine
|
|