scipy.ndimage.filters.uniform_filter(input, size=3, output=None, mode='reflect', cval=0.0, origin=0)[source]

Multi-dimensional uniform filter.


input : array_like

Input array to filter.

size : int or sequence of ints, optional

The sizes of the uniform filter are given for each axis as a sequence, or as a single number, in which case the size is equal for all axes.

output : array, optional

The output parameter passes an array in which to store the filter output.

mode : {‘reflect’, ‘constant’, ‘nearest’, ‘mirror’, ‘wrap’}, optional

The mode parameter determines how the array borders are handled, where cval is the value when mode is equal to ‘constant’. Default is ‘reflect’

cval : scalar, optional

Value to fill past edges of input if mode is ‘constant’. Default is 0.0

origin : scalar, optional

The origin parameter controls the placement of the filter. Default 0.0.


The multi-dimensional filter is implemented as a sequence of one-dimensional uniform filters. The intermediate arrays are stored in the same data type as the output. Therefore, for output types with a limited precision, the results may be imprecise because intermediate results may be stored with insufficient precision.