Compute gaussian pyramid expansion or reduction.
Create image which is one level up or down in the Gaussian
pyramid. direction must be "reduce"
or
"expand"
. These operations are only done in the first
two dimensions, so that even if im is a N dimensional
array, only the number of rows and columns will change.
The "reduce"
stage is done by low-pass filtering and
subsampling of 1:2 in each axis. If the size of the original
image is [M N], the size of the reduced image is
[ceil((M+1)/2) ceil((N+1)/2)]
.
The "expand"
stage is done by upsampling the image
(2:1 in each axis), and then low-pass filtering. If the size
of the original image is [M N], the size of the expanded image
is [2M-1 2N-1]
.
Note that image processing pyramids are upside down, so
"reduce"
is going one level down in the pyramid,
while "expand"
is going one level up in the pyramid.
impyramid (im, "reduce"); # return reduced image (one level down) impyramid (im, "expand"); # return expanded image (one level up)
The low-pass filter is defined according to Burt & Adelson [1]
W(i,j) = w(i)w(j)
where
w = [0.25-alpha/2 0.25 alpha 0.25 0.25-alpha/2]
with
alpha = 0.375
[1] Peter J. Burt and Edward H. Adelson (1983). The Laplacian Pyramid as a Compact Image Code. IEEE Transactions on Communications, vol. COM-31(4), 532-540.
See also: imresize, imfilter.
Package: image