Assignment 4
Assignment 4
Said Ghoniemy
Computer Systems Department Dr Noha Aly
Assignment 4_2020_2021_1
1 23 4
[ ]
f ( x , y )= 5 6 7 8
9 1011 12
13 14 15 16
Use 2×2 block neighborhood averaging for the approximation filter and pixel
replication as interpolation filter
b. Construct a Laplacian pyramid for the “cameraman” image. Find the mean and
standard deviation of the image at the lowest level of the Laplacian pyramid (ie.,
highest resolution image). Compare that with the mean and standard deviation of
the original gray level image.
2. Given the following 8x8 image and a 4-bit version of Lenna image:
a) Find Level-2 of the image pyramid (4x4) using mean method as approximation filter
b) Calculate the laplacian pyramid (prediction residual).
c) onstruct the image from the laplacian pyramid and estimate the reconstruction error
3. Write a MATLAB script for implementing a simplified wavelet transform coder using
the Haar wavelet. Your program should do the following:
1) Read in an image from a file;
2) Perform one stage Haar wavelet decomposition to create 4 subimages;
3) Quantize the wavelet coefficients in each subband using a uniform quantizer with a
specified stepsize Q. For the LL band, you should assume that all coefficients are
non-negative and use a quantizer than assumes the minimal value is 0. For the
This study source was downloaded by 100000866223090 from CourseHero.com on 04-26-2023 01:46:48 GMT -05:00
https://www.coursehero.com/file/131197400/Assignment-4docx/
other bands, you should assume that all coefficients follow a symmetric
distribution with respect to 0.
4) Count the number of non-zeros in the quantized subimages, and determine the
approximate compression ratio defined as:
Total number of pixels
Total number of nonzero coefficients
5) Reconstruct the image using the quantized sub-images. Perform necessary
truncation so that the reconstructed pixel values can be represented by 8 bit
unsigned integers, and save the results in a file.
6) Determine the MSE and PSNR of the reconstructed image.
7) Your program should report the estimated compression ratio and the PSNR, as well
as the decompressed image.
To compute the PSNR, first calculate the mean-squared error using the following
equation:
I
¿
¿ 1 ( m, n )−I 2 (m , n)¿2
¿
¿
∑¿
M ,N
MSE=¿
where M and N are the number of rows and columns in the input image.
R2
PSNR=10 log 10 ( )
MSE
R is the maximum graylevel of the input image
4. a. Carry out a 2D Haar wavelet transform of the 4x4 letter ’O’ image shown below,
using the functions below for forming Approximation, Horizontal details, Vertical
details and Diagonal details. Give the 4x4 image which is the level 1 wavelet
transform.
1 1 1 1
1 0 0 1
1 0 0 1
1 1 1 1
b. Show that the level 2 wavelet transform equals the image given below.
’Haar Level 2 Wavelet Transform’
3 0 1 -1
0 0 1 -1
1 1 -1 1
This study source was downloaded by 100000866223090 from CourseHero.com on 04-26-2023 01:46:48 GMT -05:00
https://www.coursehero.com/file/131197400/Assignment-4docx/
-1 -1 1 -1
5 . You are given the following basis images for 2x2 image patterns:
6.a. Develop a MATLAB script that reads the input image 'cameraman.tif', computes a 3-
scale Haar discrete wavelet transform (DWT) of the input image and reconstructs
the approximation coefficients for level 2 from the level 3 decomposition and
writes the image to cameraman_A2.png, and reconstructs the approximation
coefficients for level 1 from the level 2 decomposition and writes the image to
cameraman_A1.png. Use the function imread to read the input image in MATLAB.
Use imwrite to write the output image in MATLAB.
This study source was downloaded by 100000866223090 from CourseHero.com on 04-26-2023 01:46:48 GMT -05:00
https://www.coursehero.com/file/131197400/Assignment-4docx/
Powered by TCPDF (www.tcpdf.org)