[EMAIL PROTECTED] wrote: > Hi all, > I am working with images in python using PIL. I come from a MATLAB > background so I am finding it to be sometimes frustrating to do things > correctly and quickly. All I need to do is load an image and store a > list of pixel coordinates at which the alpha channel is set to 1. > In Matlab this would be easy...Lets say we have a 2x2x4 array that > represents the image. I would just type something like: > > indices = find(im(:,:,3)==1); > > then work with indices to get xy coords. Is there a similar way to > accomplish the same thing in python and PIL without having a nested for > loop and checking every pixel? > I would appreciate advice. Thanks very much for your attention!
The kind of array functionality which you have in mind is implemented in python by the Numeric/Numarray libraries. You can (and should) use the PIL for the more image-specific tasks, but basic array things are done via those others. You may also want to look at matplotlib, for a high level, matlab-compatible plotting library. Regards, f -- http://mail.python.org/mailman/listinfo/python-list