machinevisiontoolbox.Image.scale
- Image.scale(sfactor, sigma=None, interpolation=None)
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:
Image
instance
Rescale the image. If
sfactor> 1
the image is enlarged.If
sfactor < 1
the image is made smaller and smoothing can be applied to reduce sampling artefacts. Ifsigma
is None, use default for scale by sigma=1/sfactor/2. Ifsigma=0
perform 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: 1354 x 1400 (uint8), R:G:B >>> img.scale(0.5) Image: 338 x 350 (uint8), R:G:B
- References:
Robotics, Vision & Control for Python, Section 11.7.2, P. Corke, Springer 2023.
- Seealso: