Digital Image Processing
Course Nos. ECE.09.452 and ECE.09.552
Fall 2009
Laboratory Project 4: Digital Image
Compression
Due Monday, December 21, 2009
Objective
The objective of this project is to study the use of the Discrete
Fourier Transform (DFT), Discrete
Cosine
Transform (DCT) and the Karhunen-Loeve
Transform (KLT) as tools for performing image compression. This project
has
three parts.
The image compression standard Lenna image is used for this project.
Download
the Lenna image from the SIPI database at USC (http://sipi.usc.edu/services/database/Database.html)
Note: In all of the image compression studies that you
will perform, you must provide pictures of (a) the reconstructed image
and (b) the squared error image. At the top of each page, also provide
a picture
of the original image, in order to facilitate comparison.
Part 1
In this part, you will compare the image compression capabilities of
the three image transforms indicated earlier.
- Import the Lenna image into MATLAB.
- Subdivide the original 256 x 256 image into sub-images of size 8
x 8. Compute, for each sub-image, the DFT, DCT and KLT coefficients.
Perform image compression by using threshold masks of various sizes,
i.e. choose only
the k < 64 most significant transform coefficients of the 8
x 8
sub-images. For the DFT and DCT, this is done by retaining the k largest
transform coefficients in the sub-image and setting the remaining
elements
of the sub-image to zero. For the KLT, choose the transform
coefficients that
correspond to the k largest eigenvalues.
Hint 1: Use the blkproc function in MATLAB for
computing the transform coefficients for the sub-images. Do >>help
blkproc for details, or check out the MATLAB Image Processing
Toolbox User's Manual.
Hint 2: You are welcome to modify and use the code given in Demo7: Hotelling or Karhunen-Loeve Transform,
for computing the KLT coefficients.
- Reconstruct the 256 x 256 image from each of the truncated 8 x 8
transform images. The blkproc function in MATLAB is again
useful
for this. Compute the mean squared error between the original and
reconstructed
image.
- Vary k and compute the mean squared error resulting
from
image compression for each case. Obtain a graph of the mean squared
error
vs. k for image compression performed using each of the three
transforms. Comment on your results.
Part 2
In this part, you will investigate the effect of varying the sub-image
size and type of truncation mask, while performing image compression
using
the Discrete Cosine Transform.
- Choose sub-images of sizes 2 x 2, 8 x 8, 16 x 16, 64 x 64, 128 x
128 and 256 x 256 (entire image).
- For each of these sub-images, perform image compression using
both threshold and zonal masks such that approximately 25% of the DCT
coefficients are retained.
- Calculate, for each case, the mean squared error in the
reconstructed image. Obtain a graph of the mean squared error vs.
sub-image size, for both types of masks. Comment on your results.
Part 3
Based on your investigations in Parts 1 and 2, implement what you
decide is the "best" image compression for the given Lenna image. What
criteria
(visual, mathematical, etc.) have you used to arrive at this answer?
What
is the compression ratio?
Your report should be in the usual format.