Christopher Jones wrote: > With mode I images, the histogram method sometimes returns bin 255 > empty, counting the getextrema maximum value in bin 254 instead. Is this > a bug or is bin 255 treated in a special way, perhaps to count clipped > pixels?
what is the getextrema() when this happens? my guess is that it's a rounding error in the histogram code; it basically does scale = 255.0F / (max - min); for each pixel: i = (int) ((pixel-min)*scale); if (i >= 0 && i < 256) histogram[i]++; I don't have time to verify this right now, but I guess changing the index calculation to: i = (int) ((pixel-imin)*scale + 0.5); would take care of this. (the whole histogram-of-I/F approach feels a bit odd; not sure why it was done that way, really). </F> _______________________________________________ Image-SIG maillist - Image-SIG@python.org http://mail.python.org/mailman/listinfo/image-sig