0% found this document useful (0 votes)
36 views1 page

4 Out of N: SGN-3016 Digital Image Processing I Exercise 9 8-9.11.2011

The document describes an exercise to apply the discrete Fourier transform (DFT), discrete cosine transform (DCT), and Haar transform to an image, take a quarter of the coefficients, reconstruct the image using inverse transforms, and compare the reconstructed images and their errors. It also provides instructions to write a Matlab function to generate a Haar transform matrix based on the defined Haar functions.

Uploaded by

Peyman Jamali
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views1 page

4 Out of N: SGN-3016 Digital Image Processing I Exercise 9 8-9.11.2011

The document describes an exercise to apply the discrete Fourier transform (DFT), discrete cosine transform (DCT), and Haar transform to an image, take a quarter of the coefficients, reconstruct the image using inverse transforms, and compare the reconstructed images and their errors. It also provides instructions to write a Matlab function to generate a Haar transform matrix based on the defined Haar functions.

Uploaded by

Peyman Jamali
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

SGN-3016 Digital Image Processing I

EXERCISE 9
8-9.11.2011

DFT, DCT and Haar Transforms
Load the image cameraman.tif and perform on it the DFT, DCT and Haar transforms (each transform is applied on the original
image). Take only a quarter (N
2
/4 out of N
2
, where N N is the dimension of the image) of the coefficients of each of the transformed
images and reconstruct the image using the inverse transforms (the rest of the coefficients are put to zero). The coefficients should be
taken so that they contain most of the image energy. Visually compare the reconstructed images. Compute also the mean square error
between the reconstructed images and the original. (Hint: dct2, idct2)
For Haar transforms, write a Matlab function haarmtx(N), that produces the Haar transform matrix H for the given N. You can then do
the Haar transformation by the multiplication HIH, where I is the image, and the inverse Haar transformation by HJ H, where J is the
transformed (and handled as explained) image.
The Haar functions h
k
(x) are defined on a continuous interval, x e [0, 1], and for k =0, ...,N 1 where N =2
n
.
The integer k can be uniquely decomposed as
2 1
p
k q = +
where p,q are integers: 0 p n 1; q =0,1 for p =0 and 1 q 2
p
for p = 0.
Hint: Create vectors p and q, where p =floor(log2(k)), p(0) =0.
Representing k by (p, q), the Haar functions are defined as
j
j
0 0,0
/ 2
/ 2
,
1
( ) ( ) , 0,1
1 1/ 2
2 ,
2 2
1 1/ 2
( ) ( ) 2 ,
2 2
0, otherwise for 0,1
p
p p
p
k p q
p p
h x h x x
N
q q
x
q q
h x h x x
N
x
= = e

s <


= = s <


The Haar transform matrix can be obtained by letting x take discrete values at j/N, j =0, 1, ...,N 1. H(i, j) = h
i
(j/N).
haarmtx(4) should give you

Your report should contain the Matlab scripts, the resulting images and comparisons.

You might also like