Advice for imaging
ignacio at openservices.net
Wed Aug 22 03:25:20 CEST 2001
On Wed, 22 Aug 2001, Tom Harris wrote:
> I have to do some quick prototyping on some image processing algorithms. The
> requirements are to read in a large 16 bit per pixel image, do stuff to it
> in various ways, and then compute various metrics on the result. The purpose
> of this is to optimise an algorithm. I have libraries for accessing and
> loading/saving the images already written in C++.
> Last time I had to do this I wrote simple command line wrappers in C to call
> my libraries and write out images in a simple format (in fact it was
> Poskanser bitmap, which is the simplest image format ever). Then wrote more
> command line tools in C to try out the algorithms, and scripted the whole
> mess with Perl and bash.
> Now, however, I have learnt Python and there has got to be a better way
> (especially as I can no longer understand what my Perl code did, or why or
> how). I can see that using SWIG to wrap my libraries so that I can call them
> from Python will be easy, but I am not sure quite what is the Pythonic way
> of accessing an image (my lib represents an image as a pointer to the start
> of a buffer together with methods to determine width, height, padding, etc.
> I looked at the Python Imaging Library but unfortunately it does not appear
> to support 16 bit pixel images.
> Since speed is not really an issue, I was thinking in terms of a simple
> class that is attached to an image that is able to iterate over it in
> various ways, and get/set pixel values.
> Tom Harris, Software Engineer
> Optiscan Imaging, 15-17 Normanby Rd, Notting Hill, Melbourne, Vic 3168,
> email tomh at optiscan.com ph +61 3 9538 3333 fax +61 3 9562 7742
Take a look at PythonMagick (http://starship.python.net/crew/zack/pymagick/)
and NumPy (http://www.pfdubois.com/numpy/) and see if they do what you need.
You may find that you don't even need the C++ libraries at all.
Ignacio Vazquez-Abrams <ignacio at openservices.net>
More information about the Python-list