# vision.Pyramid System object

Package: vision

Perform Gaussian pyramid decomposition

## Description

The `Pyramid` object computes Gaussian pyramid reduction or expansion. The image reduction step involves lowpass filtering and downsampling the image pixels. The image expansion step involves upsampling the image pixels and lowpass filtering.

## Construction

`gaussPyramid = vision.Pyramid` returns a System object, `gaussPyramid`, that computes a Gaussian pyramid reduction or expansion of an image.

`gaussPyramid = vision.Pyramid(Name,Value)` configures the System object properties, specified as one or more name-value pair arguments. Unspecified properties have default values.

Code Generation Support
Supports MATLAB® Function block: Yes
System Objects in MATLAB Code Generation.
Code Generation Support, Usage Notes, and Limitations.

### To compute a Gaussian pyramid:

1. Define and set up your pyramid object using the constructor.

2. Call the `step` method with the input image, `I` and the pyramid object, `gaussPyramid`. See the syntax below for using the `step` method.

`J = step(gaussPyramid,I)` computes `J`, the Gaussian pyramid decomposition of input `I`.

## Properties

 `Operation` Reduce or expand the input image Specify whether to reduce or expand the input image as `Reduce` or `Expand`. If this property is set to `Reduce`, the object applies a lowpass filter and then downsamples the input image. If this property is set to `Expand`, the object upsamples and then applies a lowpass filter to the input image. Default: `Reduce` `PyramidLevel` Level of decomposition Specify the number of times the object upsamples or downsamples each dimension of the image by a factor of `2`. Default: `1` `SeparableFilter` How to specify the coefficients of low pass filter Indicate how to specify the coefficients of the lowpass filter as `Default` or `Custom`. Default: `Default` `CoefficientA` Coefficient 'a' of default separable filter Specify the coefficients in the default separable filter ```1/4-a/2 1/4 a 1/4 1/4-a/2``` as a scalar value. This property applies when you set the `SeparableFilter` property to `Default`. Default: `0.375` `CustomSeparableFilter` Separable filter coefficients Specify separable filter coefficients as a vector. This property applies when you set the `SeparableFilter` property to `Custom`. Default: `[0.0625 0.25 0.375 0.25 0.0625]`

## Methods

 clone Create pyramid object with same property values getNumInputs Number of expected inputs to step method getNumOutputs Number of outputs from step method isLocked Locked status for input attributes and non-tunable properties release Allow property value and input characteristics changes step Compute Gaussian pyramid decomposition of input

## Examples

expand all

### Resize Image Using Gaussian Pyramid Decomposition

Set the level of decomposition

` gaussPyramid = vision.Pyramid('PyramidLevel', 2);`

Cast to single, otherwise the returned output J, will be a fixed point object.

```I = im2single(imread('cameraman.tif')); J = step(gaussPyramid, I);```

Display results.

```figure, imshow(I); title('Original Image'); figure, imshow(J); title('Reduced Image');```