| Video and Image Processing Blockset™ | ![]() |
Transforms

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.
Note This block supports intensity and color images on its ports. |
| Port | Output | Supported Data Types | Complex 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. |
| 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.
The following example model shows how to construct a Laplacian pyramid:
Open this model by typing
doc_laplacian
at the MATLAB® command prompt.

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.
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.
The Main pane of the Gaussian Pyramid dialog box appears as shown in the following figure.

Specify whether you want to reduce or expand the input image.
Specify the number of times the block upsamples or downsamples each dimension of the image by a factor of 2.
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.
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].
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.

Select the rounding mode for fixed-point operations.
Select the overflow mode for fixed-point operations.
Choose how to specify the word length and the fraction length of the coefficients:
When you select Same word length as input, the word length of the coefficients match that of the input to the block. In this mode, the fraction length of the coefficients is automatically set to the binary-point only scaling that provides you with the best precision possible given the value and word length of the coefficients.
When you select Specify word length, you can enter the word length of the coefficients, in bits. The block automatically sets the fraction length to give you the best precision.
When you select Binary point scaling, you can enter the word length and the fraction length of the coefficients, in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the coefficients. The bias of all signals in the Video and Image Processing Blockset™ is 0.

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.
When you select Same as input, these characteristics match those of the input to the block.
When you select Binary point scaling, you can enter the word length and the fraction length of the product output, in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the product output. The bias of all signals in the Video and Image Processing Blockset is 0.

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.
When you select Same as product output, these characteristics match those of the product output.
When you select Same as input, these characteristics match those of the input to the block.
When you select Binary point scaling, you can enter the word length and the fraction length of the accumulator, in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the accumulator. The bias of all signals in the Video and Image Processing Blockset is 0.
Choose how to specify the word length and fraction length of the output of the block:
When you select Same as input, these characteristics match those of the input to the block.
When you select Binary point scaling, you can enter the word length and the fraction length of the output, in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the output. The bias of all signals in the Video and Image Processing Blockset is 0.
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.
Video and Image Processing Blockset |
![]() | Gamma Correction | Histogram | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |