Greynes
Greynes

Reputation: 749

Local mean filter in numpy

I have a 512x512x512 numpy array. Is there any efficient way to perform a mean filter where every array value is substituted by all 3x3x3 local values?

We are seeking somethin similar to scipy.ndimage.filters.median_filter but insted of median with mean.

Upvotes: 5

Views: 13624

Answers (2)

user16129782
user16129782

Reputation: 11

mean filter is the alias of uniform filter, which is available in scipy.ndimage.uniform_filter()

Upvotes: 1

HYRY
HYRY

Reputation: 97331

scipy.ndimage.filters.convolve() with a weight: np.full((3, 3, 3), 1.0/27).

Upvotes: 8

Related Questions