Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Perform Gaussian pyramid decomposition

Transforms

`visiontransforms`

The Gaussian Pyramid block computes Gaussian pyramid reduction or expansion 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.

This block supports intensity and color images on its ports.

Port | Output | Supported Data Types | Complex Values Supported |
---|---|---|---|

Input | In In | 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 In | 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:

$$\text{ceil}\left(\frac{M}{2}\right)-\text{by}-\text{ceil}\left(\frac{N}{2}\right)$$

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:

$$\left[\left(M-1\right){2}^{l}+1\right]-\text{by}-\left[\left(N-1\right){2}^{l}+1\right]$$

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

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 $$R={M}_{R}{2}^{N}+1$$ and $$C={M}_{c}{2}^{N}+1$$,
where *M _{R}*,

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.

**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`

.

**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:

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 Computer Vision Toolbox™ blocks is 0.

**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.

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 Computer Vision Toolbox blocks is 0.

**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.

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 Computer Vision Toolbox blocks is 0.

**Output**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 Computer Vision Toolbox blocks is 0.

**Lock data type settings against change by the fixed-point tools**Select this parameter to prevent the fixed-point tools from overriding the data types you specify on the block mask. For more information, see

`fxptdlg`

, a reference page on the Fixed-Point Tool in the Simulink^{®}documentation.

Computer Vision Toolbox software |