Image.scale#
- Image.scale(sfactor: float, sigma: float | None = None, interpolation: str | None = None) Self[source]#
Scale an image
- Parameters:
sfactor (scalar) – scale factor
sigma (float) – standard deviation of kernel for image smoothing, in pixels
- Raises:
ValueError – bad interpolation string
ValueError – bad interpolation value
- Returns:
smoothed image
- Return type:
Imageinstance
Rescale the image. If
sfactor> 1the image is enlarged.If
sfactor < 1the image is made smaller and smoothing can be applied to reduce sampling artefacts. Ifsigmais None, use default for scale by sigma=1/sfactor/2. Ifsigma=0perform no smoothing.interpolation
description
'cubic'bicubic interpolation
'linear'bilinear interpolation
'area'resampling using pixel area relation
Example:
>>> from machinevisiontoolbox import Image >>> img = Image.Read('monalisa.png') >>> img.scale(2) Image(size=(1354, 1400), dtype=uint8, nplanes=3, colororder=R:G:B) >>> img.scale(0.5) Image(size=(338, 350), dtype=uint8, nplanes=3, colororder=R:G:B)
- References:
P. Corke, Robotics, Vision & Control for Python, Springer, 2023, Section 11.7.2.
- Seealso: