Image Pyramid – Expanding Image

By | May 12, 2017

Image pyramid is widely used in computer vision which allow us to convert an image / frame to a different size ( smaller or larger ) than its original size. There are two possible method available in openCV which allow us to up size and down size an image.

  • A collection of images, all of them are transformed from an original image / frame ( either down sampled or up sampled )
  • Provides two type of image pyramids
    • Gaussian pyramid ( used to down sample image / frame)
    • Laplacian pyramid ( use to up sample image / frame)
image pyramid

Image Pyramid Example. source of the image

Down Size Image

A set of reduced images, added on top of each other will construct a pyramid (higher the layer, smaller the size ).  To produce the reduced layer of images the two steps are involved in Gaussian pyramid (Convolve with  a Gaussian kernel and remove every even number row and column) . The resulting image will be exactly one quarter of its predecessor. Iterating on original image will produce different layers of pyramid. OpenCV provides pyrDown function ( using Gaussian pyramid ) to down size the image.

Here is the complete code to down sample the image or video frame.

Up Size Image

To up size the image twice of its original size in each dimension, add even rows and columns filled with zeros and then approximate the values of missing image pixels by performing convolution with the similar kernal discussed above. OpenCV provides pyrUp function ( using Gaussian pyramid ) to up size the image.

Following is a sample program that can be used to up sample the video frames.

Output of the above program can shown in the following video tutorial.

One thought on “Image Pyramid – Expanding Image

Leave a Reply

Your email address will not be published. Required fields are marked *