OpenCV  3.4.10-dev
Open Source Computer Vision
Image Pyramids

Prev Tutorial: Extract horizontal and vertical lines by using morphological operations

Next Tutorial: Basic Thresholding Operations

Goal

In this tutorial you will learn how to:

Theory

Note
The explanation below belongs to the book Learning OpenCV by Bradski and Kaehler.

Image Pyramid

Gaussian Pyramid

Note
When we reduce the size of an image, we are actually losing information of the image.

Code

This tutorial code's is shown lines below.

Explanation

Let's check the general structure of the program:

Load an image

Create window

Loop

Perform an infinite loop waiting for user input. Our program exits if the user presses ESC. Besides, it has two options:

Notice that it is important that the input image can be divided by a factor of two (in both dimensions). Otherwise, an error will be shown.

Results