Image to numeric array

Claudio Grondi claudio.grondi at freenet.de
Mon Feb 13 11:10:55 EST 2006


Diez B. Roggisch wrote:
> Dimitrios Charitatos wrote:
> 
> 
>>Hello,
>>
>>I suspect that there is a quite straight forward answer to this, but I
>>can't find it... I want to import an image and extract a matrix (or array)
>>from it with elements showing the RGB value of each pixel. But I want to
>>be able to do this with all types of image formats. It was suggested that
>>a function such as 'B = numeric.from_image(A)' was used but I can't find
>>it in any of the libraries. I was hoping you could help me on this.
> 
> 
> You have to install the numeric library for that. Googling numeric python
> will bring you there pretty quick.
> 
> Diez
Is there a difference between the 'Numeric' and 'numeric' module?
I have on my system only Numeric... And this has no function like 
'from_image'.

The usual way of doing such things is to use PIL (Python Image Library) 
to load the image from file, then export it from PIL to a Python string 
in order to import from this string to an array of the targeted 
numerical module.

Really curious if there is a direct way in any of the numerical 
packages, as it would save the time and effort of unnecessary 
conversions from PIL, ImageMagick or from other image libraries.

Claudio





More information about the Python-list mailing list