bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / transform / _warps / resize_local_mean
function
skimage.transform._warps:resize_local_mean
source: /dev/scikit-image/src/skimage/transform/_warps.py :1290
Signature
def resize_local_mean ( image , output_shape , grid_mode = True , preserve_range = False , * , channel_axis = None ) Summary
Resize an array with the local mean / bilinear scaling.
Parameters
image: ndarrayInput image. If this is a multichannel image, the axis corresponding to channels should be specified using
channel_axis.output_shape: iterableSize of the generated output image. When
channel_axisis not None, thechannel_axisshould either be omitted fromoutput_shapeor theoutput_shape[channel_axis]must matchimage.shape[channel_axis]. If the length ofoutput_shapeexceeds image.ndim, additional singleton dimensions will be appended to the inputimageas needed.grid_mode: bool, optionalDefines
imagepixels position: if True, pixels are assumed to be at grid intersections, otherwise at cell centers. As a consequence, for example, a 1d signal of length 5 is considered to have length 4 whengrid_modeis False, but length 5 whengrid_modeis True. See the following visual illustration:| pixel 1 | pixel 2 | pixel 3 | pixel 4 | pixel 5 | |<-------------------------------------->| vs. |<----------------------------------------------->|
The starting point of the arrow in the diagram above corresponds to coordinate location 0 in each mode.
preserve_range: bool, optionalWhether to keep the original range of values. Otherwise, the input image is converted according to the conventions of img_as_float. Also see https://scikit-image.org/docs/dev/user_guide/data_types.html
Returns
resized: ndarrayResized version of the input.
Notes
This method is sometimes referred to as "area-based" interpolation or "pixel mixing" interpolation [1]. When grid_mode is True, it is equivalent to using OpenCV's resize with INTER_AREA interpolation mode. It is commonly used for image downsizing. If the downsizing factors are integers, then downscale_local_mean should be preferred instead.
Examples
from skimage import data from skimage.transform import resize_local_mean image = data.camera() resize_local_mean(image, (100, 100)).shape✓
See also
Aliases
-
skimage.transform.resize_local_mean