Processing an image with numarray.nd image

Matt Feinstein nospam at here.com
Tue Oct 4 12:58:21 CEST 2005


On Tue, 04 Oct 2005 11:56:51 +0200, Raphaël MARC
<raphael.marc at free.fr> wrote:

>Hello,
>
>Can anyone tell me how to open an image
>and transform it into a list so that
>the functions of the multi dimensionnal module of
>numarray (numarray.nd image) can process it ?
>
>Do I have to use PIL ?
>
>So I would code something like :
>import Image
>im = Image.open("Python.jpg")
>data = list(im.getdata())
>import numarray.nd image as ti
>ti.median filter(data,...)

I've been doing something like that...

from numarray import  *
import numarray.nd_image as Filter
import PIL.Image as Image

im = Image.open(file_name)
array_dat = reshape(array(list(im.getdata())), im.size)
filt_array_dat = Filter.correlate(array_dat, my_filter)

et cetera...

Matt Feinstein

--
There is no virtue in believing something that can be proved to be true.



More information about the Python-list mailing list