machinevisiontoolbox.Image.pyramid

Image.pyramid(sigma=1, N=None, border='replicate', bordervalue=0)

Pyramidal image decomposition

Parameters:
  • sigma (float) – standard deviation of Gaussian kernel

  • N (int, optional) – number of pyramid levels to be computed, defaults to all

  • border (str, optional) – option for boundary handling, see convolve, defaults to ‘replicate’

  • bordervalue (scalar, optional) – padding value, defaults to 0

Returns:

list of images at each pyramid level

Return type:

list of Image

Returns a pyramid decomposition of the input image using Gaussian smoothing with standard deviation of sigma. The return is a list array of images each one having dimensions half that of the previous image. The pyramid is computed down to a non-halvable image size.

Example:

>>> from machinevisiontoolbox import Image
>>> img = Image.Read('monalisa.png')
>>> pyramid = img.pyramid(4)
>>> len(pyramid)
11
>>> pyramid
[Image: 677 x 700 (uint8), Image: 339 x 350 (uint8), Image: 170 x 175 (uint8), Image: 85 x 88 (uint8), Image: 43 x 44 (uint8), Image: 22 x 22 (uint8), Image: 11 x 11 (uint8), Image: 6 x 6 (uint8), Image: 3 x 3 (uint8), Image: 2 x 2 (uint8), Image: 1 x 1 (uint8)]
Note:
  • Works for greyscale images only.

  • Converts a color image to greyscale.

References:
  • Robotics, Vision & Control for Python, Section 12.3.2, P. Corke, Springer 2023.

Seealso:

smooth scalespace