machinevisiontoolbox.Image.decimate
- Image.decimate(m=2, sigma=None)
Decimate an image
- Parameters:
m (int) – decimation factor
sigma (float, optional) – standard deviation for Gaussian kernel smoothing, defaults to None
- Raises:
ValueError – decimation factor m must be an integer
- Returns:
decimated image
- Return type:
Image
Return a decimated version of the image whose size is reduced by subsampling every
m
(an integer) pixels in both dimensions.The image is smoothed with a Gaussian kernel with standard deviation
sigma
. Ifsigma
is None then a value ofm/2
is used,sigma
is zero then no smoothing is performed.
- Note:
If the image has multiple planes, each plane is decimated.
Smoothing is used to eliminate aliasing artifacts and the standard deviation should be chosen as a function of the maximum spatial frequency in the image.
Example:
>>> from machinevisiontoolbox import Image >>> img = Image.Random(6) >>> img.print() 133 171 65 148 154 83 34 89 193 88 173 155 176 118 221 1 202 243 90 198 239 191 83 182 156 89 75 4 179 186 77 120 45 221 159 132 >>> img.decimate(2, sigma=0).print() 133 65 154 176 221 202 156 75 179