Constructing the Gaussian Pyramid

The Gaussian pyramid can be computed with the following steps:

  1. Start with the original image.
  2. Iteratively compute the image at each level of the pyramid, first by smoothing the image (with the Gaussian filter) and then down-sampling it.
  3. Stop at a level where the image size becomes sufficiently small (for example, 1 x 1).
  4. The function to implement the previous algorithm is left as an exercise for the reader; we just need to add a few lines in the following function to complete the implementation:
from skimage.transform import pyramid_reduce def get_gaussian_pyramid(image):     '''    input: an RGB image    output: the Gaussian Pyramid of the image as a list    '''    gaussian_pyramid = []    # add code here # iteratively ...

Get Hands-On Image Processing with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.