machinevisiontoolbox.Image.smooth
- Image.smooth(sigma, h=None, mode='same', border='reflect', bordervalue=0)
Smooth image
- Parameters:
sigma (float) – standard deviation of the Gaussian kernel
h (int) – half-width of the kernel
mode (str, optional) – option for convolution, see
convolve
, defaults to ‘same’border (str, optional) – option for boundary handling, see
convolve
, defaults to ‘reflect’bordervalue (scalar, optional) – padding value, see
convolve
, defaults to 0
- Returns:
smoothed image
- Return type:
Image
Smooth the image by convolving with a Gaussian kernel of standard deviation
sigma
. Ifh
is not given the kernel half width is set to \(2 \mbox{ceil}(3 \sigma) + 1\).Example:
>>> from machinevisiontoolbox import Image >>> img = Image.Read('monalisa.png') >>> img.smooth(sigma=3).disp() <matplotlib.image.AxesImage object at 0x7f769bb28970>
- Note:
Smooths all planes of the input image.
The Gaussian kernel has a unit volume.
If input image is integer it is converted to float, convolved, then converted back to integer.
- References:
Robotics, Vision & Control for Python, Section 11.5.1, P. Corke, Springer 2023.
- Seealso:
machinevisiontoolbox.Kernel.Gauss
convolve