vision.Pyramid System object

Package: vision

Perform Gaussian pyramid decomposition


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.


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.



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


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


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


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


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]

 Fixed-Point Properties


cloneCreate pyramid object with same property values
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs from step method
isLockedLocked status for input attributes and non-tunable properties
release Allow property value and input characteristics changes
stepCompute Gaussian pyramid decomposition of input


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');
Was this topic helpful?