Image pyramid reduction and expansion
B = impyramid(A,direction)
Read image into the workspace.
I = imread('cameraman.tif');
Perform a series of reductions. The first call reduces the original image. The other calls to impyramid use the previously reduced image.
I1 = impyramid(I, 'reduce'); I2 = impyramid(I1, 'reduce'); I3 = impyramid(I2, 'reduce');
View the original image and the reduced versions.
figure, imshow(I) figure, imshow(I1) figure, imshow(I2) figure, imshow(I3)
A— Image to reduced or expanded
Image to reduced or expanded, specified as a numeric or logical array.
direction— Reduction or expansion
Reduction or expansion, specified as one of the following values:
|Return an image, smaller than the original image.|
|Return an image that is larger than the original image.|
This function supports the generation of C code using MATLAB® Coder™. For more information, see Code Generation for Image Processing.
When generating code, note the following:
direction must be a compile-time
You can use this function in the MATLAB Function Block in Simulink.
A is m-by-n and
the size of
Reduction and expansion take place only in the first two dimensions.
For example, if
A is 100-by-100-by-3 and
B is 50-by-50-by-3.
impyramid uses the kernel specified
on page 533 of the Burt and Adelson paper cited below:
, where . The parameter a is chosen to be 0.375 so that the equivalent weighting function is close to a Gaussian shape and the weights can be readily applied using fixed-point arithmetic.
 Burt and Adelson, "The Laplacian Pyramid as a Compact Image Code," IEEE Transactions on Communications, vol. COM-31, no. 4, April 1983, pp. 532-540.
 Burt, "Fast Filter Transforms for Image Processing," Computer Graphics and Image Processing, vol. 16, 1981, pp. 20-51