[Image-SIG] equalize algorithm for mode I;16

Mark Messier messier at indiana.edu
Tue Aug 7 08:04:52 CEST 2007

Hi All,

Does anyone have an implementation of the equalize algorithm for 16- 
bit black-and-white images? The ImageOp.equalize() function does not  
support I;16 (at least I've not made it work using PIL 1.1.6) and my  
attempts to implement the algorithm have all failed when I try to to  
put the equalized pixel data back to the image. The failures are all  
sort of interesting: some fill only the left half of the image, some  
ignore every other row. These failures make me think that this is  
something to do with errors in mapping pixel to memory location for 8- 
bit vs. 16-bit images. I've tried im.putdata(...), Image.frombuffer 
(...), Image.fromstring(...), im.point(...), and pix = im.load(); pix 
[i,j] = h[pix[i,j]] and all produce one of the behaviors I mention  

BTW, I've been able to confirm that my algorithm works by printing  
the pixel data to a file and using a separate plotting program to  
construct the image from the text data. So, I'm confident that its  
just the last packing stage where my problem lies.

Any help would be greatly appreciated.

Mark Messier                                         messier at indiana.edu
Department of Physics            http://www.physics.indiana.edu/~messier
Indiana University                                 Phone: (812) 855-0236
Bloomington, IN 47405                                Fax: (812) 855-0440

More information about the Image-SIG mailing list