Gaussian Pyramid - Perform Gaussian pyramid decomposition

Library

Transforms

Description

The Gaussian Pyramid block uses Gaussian pyramid decomposition to resize an image. The image reduction process involves lowpass filtering and downsampling the image pixels. The image expansion process involves upsampling the image pixels and lowpass filtering. You can also use this block to build a Laplacian pyramid. For more information, see Examples.

PortOutputSupported Data TypesComplex Values Supported

Input

In Reduce mode, the input can be an M-by-N matrix of intensity values or an M-by-N-by-P color video signal where P is the number of color planes.

In Expand mode, the input can be a scalar, vector, or M-by-N matrix of intensity values or an M-by-N-by-P color video signal where P is the number of color planes.

  • Double-precision floating point

  • Single-precision floating point

  • Fixed point

  • 8-, 16-, 32-bit signed integer

  • 8-, 16-, 32-bit unsigned integer

No

Output

In Reduce mode, the output can be a scalar, vector, or matrix that represents one level of a Gaussian pyramid.

In Expand mode, the output can be a matrix that represents one level of a Gaussian pyramid.

Same as Input port

No

Use the Operation parameter to specify whether to reduce or expand the input image. If you select Reduce, the block applies a lowpass filter and then downsamples the input image. If you select Expand, the block upsamples and then applies a lowpass filter to the input image.

Use the Pyramid level parameter to specify the number of times the block upsamples or downsamples each dimension of the image by a factor of 2. For example, suppose you have a 4-by-4 input image. You set the Operation parameter to Reduce and the Pyramid level to 1. The block filters and downsamples the image and outputs a 2-by-2 pixel output image. If you have an M-by-N input image and you set the Operation parameter to Reduce, you can calculate the dimensions of the output image using the following equation:

You must repeat this calculation for each successive pyramid level. If you have an M-by-N input image and you set the Operation parameter to Expand, you can calculate the dimensions of the output image using the following equation:

In the previous equation, l is the scalar value from 1 to inf that you enter for the Pyramid level parameter.

Use the Coefficient source parameter to specify the coefficients of the lowpass filter. If you select Default separable filter [1/4-a/2 1/4 a 1/4 1/4-a/2], use the a parameter to define the coefficients in the vector of separable filter coefficients. If you select Specify via dialog, use the Coefficient for separable filter parameter to enter a vector of separable filter coefficients.

Examples

The following example model shows how to construct a Laplacian pyramid:

  1. Open this model by typing

    doc_laplacian

    at the MATLAB® command prompt.

  2. Run the model to see the following results.

You can construct a Laplacian pyramid if the dimensions of the input image, R-by-C, satisfy and , where MR, MC, and N are integers. In this example, you have an input matrix that is 256-by-256. If you set MR and MC equal to 63 and N equal to 2, you find that the input image needs to be 253-by-253. So you use a Submatrix block to crop the dimensions of the input image to 253-by-253.

Fixed-Point Data Types

The following diagram shows the data types used in the Gaussian Pyramid block for fixed-point signals:

You can set the coefficients table, product output, accumulator, and output data types in the block mask.

Dialog Box

The Main pane of the Gaussian Pyramid dialog box appears as shown in the following figure.

Operation

Specify whether you want to reduce or expand the input image.

Pyramid level

Specify the number of times the block upsamples or downsamples each dimension of the image by a factor of 2.

Coefficient source

Determine how to specify the coefficients of the lowpass filter. Your choices are Default separable filter [1/4-a/2 1/4 a 1/4 1/4-a/2] or Specify via dialog.

a

Enter a scalar value that defines the coefficients in the default separable filter [1/4-a/2 1/4 a 1/4 1/4-a/2]. This parameter is visible if, for the Coefficient source parameter, you select Default separable filter [1/4-a/2 1/4 a 1/4 1/4-a/2].

Coefficients for separable filter

Enter a vector of separable filter coefficients. This parameter is visible if, for the Coefficient source parameter, you select Specify via dialog.

The Fixed-point pane of the Gaussian Pyramid dialog box appears as shown in the following figure.

Rounding mode

Select the rounding mode for fixed-point operations.

Overflow mode

Select the overflow mode for fixed-point operations.

Coefficients

Choose how to specify the word length and the fraction length of the coefficients:

Product output

As shown in the previous figure, the output of the multiplier is placed into the product output data type and scaling. Use this parameter to specify how to designate the product output word and fraction lengths.

Accumulator

As shown in the previous figure, inputs to the accumulator are cast to the accumulator data type. The output of the adder remains in the accumulator data type as each element of the input is added to it. Use this parameter to specify how to designate the accumulator word and fraction lengths.

Output

Choose how to specify the word length and fraction length of the output of the block:

Lock scaling against changes by the autoscaling tool

Select this parameter to prevent any fixed-point scaling you specify in this block mask from being overridden by the autoscaling tool in the Fixed-Point Tool. For more information, see fxptdlg, a reference page on the Fixed-Point Tool in the Simulink® documentation.

See Also

Resize

Video and Image Processing Blockset

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS