Help, Image Filters with numpy

Pete Shinners pete at visionart.com
Fri Jun 2 14:57:38 EDT 2000


i have some image data, greyscale, and i'd like to do
some simple filter work on it. i'm trying to think of
a "most optimized" way to get this done. i'm not sure
about all the tools that numerical python gives me, so
i thought i'd ask to see if parts of this are already
taken care of.

say i define a quick soften filter...

soften = array([[1,2,1], [2,4,2], [1,2,1]])

how can i quickly/easily apply this to my image
which is stored in another array? i've been hunting
examples that would do this for me, but no luck

i assume it would be something like this...

filterweight = sum_values_from_array(soften)
subimage = image.extract_subimage((x, y), soften.size())
result = (soften*subimage)/filterweight


ok, i admit i haven't learned much of numpy yet,
but that is in process. but doing something like
this to all the pixels should work, correct?

it'd be great if someone could solidify the code
to the correct numerical python equivalents! but
i'm more interested in hearing how i should best
be doing this.
thanks



More information about the Python-list mailing list