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. Advertisements

  2. 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
     
    Matt Feinstein, Oct 4, 2005
    #2
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.