Re: How to convert image into numpy.ndarray

2009-02-25 Thread Christian Meesters
On Wed, 25 Feb 2009 07:52:03 -0800, anti-suho wrote:

> In scipy module, there is a function named misc.lena which can return an
> array of numpy.ndarray type. If you use this array as parameter of
> matplotlib.pyplot.imshow and then call the matplotlib.pyplot.imshow
> function, an image will be shown. The shown image is generated by the
> numpy.ndarray array.
> 
> How to convert an arbitrary image into an array of numpy.ndarray type?
Well, arbitrary ...

But this may serve as a starting point:

from scipy.misc import fromimage
import Image #PIL
my_array = fromimage(Image.open(_file_name_))

Of course, you should perform the appropriate error checking, too. ;-)

HTH
Christian


--
http://mail.python.org/mailman/listinfo/python-list


How to convert image into numpy.ndarray

2009-02-25 Thread anti-suho
In scipy module, there is a function named misc.lena which can return
an array of numpy.ndarray type. If you use this array as parameter of
matplotlib.pyplot.imshow and then call the matplotlib.pyplot.imshow
function, an image will be shown. The shown image is generated by the
numpy.ndarray array.

How to convert an arbitrary image into an array of numpy.ndarray type?
--
http://mail.python.org/mailman/listinfo/python-list