this example as a Mathematica
Here is a demonstration of how to compute the well-known Burt-Adelson image
pyramid [Peter J. Burt and Edward H. Adelson, "The Laplacian Pyramid as a Compact Image Code," IEEE
Transactions on Communication 31, no. 4 (1983) 532-540]. Note that by using
Mathematica's powerful functional programming constructs, the
Gaussian and Laplacian pyramids are computed with one-line programs.
This loads the package.
This loads and displays an example image.
This defines a commonly used generating kernel.
This constructs the Gaussian pyramid by repeatedly convolving an image with the
generating kernel and decimating the result. A pure function is used to define the
operation at each step of the iteration inside NestList.
As expected, the images have dimensions that decrease by a factor of four at each
level of the pyramid.
This shows the images in a graphics array.
The differences of images at successive levels of the Gaussian pyramid define
the Laplacian pyramid. To calculate a difference, the image at a higher level in the pyramid
must be increased in size by a factor of four prior to subtraction. This computes the pyramid.
This shows the six levels of the Laplacian pyramid.
The original image may be reconstructed from the Laplacian pyramid by reversing
the previous steps. This interpolates and adds the images at successive levels of the
pyramid beginning with the lowest level.