Bookmark and Share

ARM Guide to OpenCL Optimizing Pyramid: Theory

Register or sign in to access the Embedded Vision Academy's free technical training content.

The training materials provided by the Embedded Vision Academy are offered free of charge to everyone. All we ask in return is that you register, and tell us a little about yourself so that we can understand a bit about our audience. As detailed in our Privacy Policy, we will not share your registration information, nor contact you, except with your consent.

Registration is free and takes less than one minute. Click here to register, and get full access to the Embedded Vision Academy's unique technical training content.

If you've already registered, click here to sign in.

See a sample of this page's content below:


This chapter describes the theory of image pyramid creation.

The pyramid process

The main type of image pyramid algorithm is called Gaussian pyramid. It uses the following steps:

  1. A smoothing filter is applied to the previous image level. For the first iteration, this is the base image. This often uses a Gaussian 5x5 convolution matrix.
  2. To compute the next level the result is subsampled by a factor of two along the x and y directions.

These operations are repeated until you have the required number of levels.

When this smoothing technique is used, the resulting image pyramid is called a Gaussian pyramid.

The following figure shows the iterative process that produces an image pyramid.


Figure 2-1 Simple image pyramid generation

Image sizes created during Gaussian pyramid creation

To understand the effect of the Gaussian convolution and subsampling, it is helpful to consider an image with dimensions 2Nx2N.

The resultant image levels have the following sizes:

Level 0

This is the original image with dimensions 2nx2n.

Level 1

2(n-1)x2(n-1).

Level 2

2(n-2)x2(n-2).

Level i

2(n-i)x2(n-i).

These are the resultant sizes because the subsampling halves the number of pixels in the x and y directions to achieve the result for the next image level.

The Gaussian blur prevents image aliasing from occurring during the subsampling process.

Image border handling

The ARM® Guide to OpenCL Optimizing Convolution provides an example optimization process for convolution. It explains the challenge of safely handling image borders. Without extra strategies to handle edges, some convolution steps try to read outside of the image border. For example, a 5x5 convolution matrix attempts to read two pixels outside the source image in all directions.

Reads from outside the image border return data that is either unrelated to the image, or from a different image line. This means that the result of calculations which use these out-of-border reads, might be spurious.

The following figure shows one convolution step that is attempting to read outside of the source image.


...