Processing an image with numarray.nd image

Discussion in 'Python' started by =?ISO-8859-1?Q?Rapha=EBl_MARC?=, Oct 4, 2005.

  1. 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,...)

    Is that the correct way to do ?


    Thanks for any help.


    Raphaël
    =?ISO-8859-1?Q?Rapha=EBl_MARC?=, Oct 4, 2005
    #1
    1. Advertising

  2. On Tue, 04 Oct 2005 11:56:51 +0200, Raphaël MARC
    <> 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.
    Matt Feinstein, Oct 4, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. RJS
    Replies:
    0
    Views:
    457
  2. Tim Rowe

    Numarray for Python 2.3

    Tim Rowe, Jul 16, 2003, in forum: Python
    Replies:
    2
    Views:
    323
    Tim Rowe
    Jul 16, 2003
  3. Thomas Heller

    Re: py2exe and numarray

    Thomas Heller, Aug 8, 2003, in forum: Python
    Replies:
    0
    Views:
    382
    Thomas Heller
    Aug 8, 2003
  4. Eugene Druker

    numarray.linear_algebra.eigenvectors bug ?

    Eugene Druker, Sep 19, 2003, in forum: Python
    Replies:
    1
    Views:
    326
    John J. Lee
    Sep 20, 2003
  5. Hubert Hung-Hsien Chang
    Replies:
    2
    Views:
    410
    Michael Foord
    Sep 17, 2004
Loading...

Share This Page