resize¶
- sofia_redux.toolkit.image.resize.resize(image, output_shape, order=None, mode='reflect', cval=0, clip=True, anti_aliasing=None, anti_aliasing_sigma=None)[source]¶
Replacement for
skimage.resize
.- Parameters:
- imagenumpy.ndarray
Input image.
- output_shapeiterable
Size of the generated output image
(rows, cols[, ...][, dim])
. Ifdim
is not provided, the number of channels is preserved. In case the number of input channels does not equal the number of output channels a n-dimensional interpolation is applied.- orderint, optional
The order of the spline interpolation, default is 0 if image.dtype is bool and 1 otherwise. The order has to be in the range 0-5.
- modestr, optional
One of {‘constant’, ‘edge’, ‘symmetric’, ‘reflect’, ‘wrap’}. Points outside the boundaries of the input are filled according to the given mode. Modes match the behaviour of
numpy.pad
.- cvalfloat, optional
Used in conjunction with mode ‘constant’, the value outside the image boundaries.
- clipbool, optional
Whether to clip the output to the range of values of the input image. This is enabled by default, since higher order interpolation may produce values outside the given input range.
- anti_aliasingbool, optional
Whether to apply a Gaussian filter to smooth the image prior to downsampling. It is crucial to filter when downsampling the image to avoid aliasing artifacts. If not specified, it is set to True when downsampling an image whose data type is not bool.
- anti_aliasing_sigma{float, tuple of floats}, optional
Standard deviation for Gaussian filtering used when anti-aliasing. By default, this value is chosen as (s - 1) / 2 where s is the downsampling factor, where s > 1. For the up-size case, s < 1, no anti-aliasing is performed prior to rescaling.
- Returns:
- resizednumpy.ndarray
Resized version of the input.