Koen De Munter wrote:
Dear tutors,

Given an image, I want to generate another image with the mean values of
the pixels in their neighbourhood, thereby ignoring some of the neighbouring pixels (e.g. the padded boundary). I hoped I could use masked arrays for that, but apparently, this does not work.

Define "does not work".

Do you get an exception? Your computer crashes? You get a result, but it's not the result you were expecting? Something else?



--
def fnc(buffer)
     return numpy.mean(buffer)

mean = scipy.ndimage.generic_filter(masked_array, fnc, footprint = f, mode = 
'constant', cval = 0.0)


scipy, even more than numpy, is a fairly specialised library. You may have better luck asking this question on a dedicated scipy mailing list.

Is there a way to get around this issue, or do I have to accept the filter 
function can not handle masked arrays?

What does the documentation for generic_filter say?

What happens if you test it with a really small, simple example, say an array of just five or six values? Can you show us what you expect to get and what you actually get?



--
Steven

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to