numeric: local neighbour hood functions on arrays

Robert Denham Robert.Denham at dnr.qld.gov.au
Fri Apr 6 02:23:30 EDT 2001


I have a question about applying a local filter to an array.
What would be the most efficient way of creating a new array consisting
of a function of a pixels neighbourhood.

Eg, take a 3x3 neighbourhood, and say the sum of the pixels in the
neighbourhod.

eg   1 1 1
       2 x 1   the x is replaced by 8.  This would be repeated for every
element of the array.
       1 0 1

What to do on the boundaries is less of a numerical problem than a
philosophical one.  I can work that out later.

I am sure this is a frequently used type of function, so I would welcome
any suggestions.

Robert Denham
Department of Natural Resources
Queensland Australia





More information about the Python-list mailing list