downscale-local-mean

downscale_local_mean

skimage.transform.downscale_local_mean(image, factors, cval=0, clip=True) [source]

Down-sample N-dimensional image by local averaging.

The image is padded with cval if it is not perfectly divisible by the integer factors.

In contrast to the 2-D interpolation in skimage.transform.resize and skimage.transform.rescale this function may be applied to N-dimensional images and calculates the local mean of elements in each block of size factors in the input image.

Parameters:

image : ndarray

N-dimensional input image.

factors : array_like

Array containing down-sampling integer factor along each axis.

cval : float, optional

Constant padding value if image is not perfectly divisible by the integer factors.

Returns:

image : ndarray

Down-sampled image with same number of dimensions as input image.

Examples

>>> a = np.arange(15).reshape(3, 5)
>>> a
array([[ 0,  1,  2,  3,  4],
       [ 5,  6,  7,  8,  9],
       [10, 11, 12, 13, 14]])
>>> downscale_local_mean(a, (2, 3))
array([[ 3.5,  4. ],
       [ 5.5,  4.5]])
doc_scikit_image
2017-01-12 17:20:48
Comments
Leave a Comment

Please login to continue.