Polytec - NYU Tandon School of Engineering



Polytechnic University, Dept. Electrical and Computer Engineering

EE3414 Multimedia Communication System I

Spring 2003, Yao Wang

___________________________________________________________________________________

Solution to Homework 11 (DCT)

Written Assignment:

1. For the 4x4 image S given below, compute its 2D DCT, reconstruct it using different masking windows to evaluate the effect of different basis images.

a. Determine the 2D-DCT coefficients, Tk,l, k=0,1,2,3;l=0,1,2,3.

b. Show that the reconstructed image from the original DFT coefficients equal to the original image.

c. Modify the DCT coefficients using following two different window masks (W1 and W2) and reconstruct the image using the modified DCT coefficients. What effect do you see with each mask?

You may use Matlab functions “dct2” and “idct2” to do the forward and inverse DCT calculation. You can also modify the program “DFT_mask.m” so that the transform is DCT rather than DCT. You should also modify the masking matrix accordingly. Feel free to try other image values and different filter masks.

[pic]

Solution:

a) Using the DCT basis definition, the 4-point 1D DCT basis vectors are:

[pic]

Using the outer product of the above 1-D basis vectors, [pic]we obtain the following 2D DCT basis images:

[pic]

The DCT coefficients can be determined using the inner product operation [pic] The resulting DCT coefficients arranged in a matrix is:

[pic]

Note that the above results can also be obtained by the following matlab command easily:

>> S=[9,1,9,1;1,9,1,9;9,1,9,1;1,9,1,9]; T=dct2(S)

b) There are a total of 5 non-zero DCT coefficients in this example. We can show that

[pic]

With Matlab, you simply use

>> Sreconstructed=idct2(T)

(c ) The effect of mask W1 is to retain only the top 2x2 DCT coefficients and set the rest to zero. The image reconstructed using the mask W1 is

[pic]

With Matlab, you can use

>> W1=[1,1,0,0;1,1,0,0;0,0,0,0;0,0,0,0], T1=T.* W1, S1=idct2(T1)

The effect of mask W2 is to retain only the last coefficient T_{3,3} and set the rest to zero. The image reconstructed using the mask W2 is

[pic]

With Matlab, you can use

>> W2=[0,0,0,0;0,0,0,0; 0,0,0,0;0,0,0,1], T2=T.* W2, S2=idct2(T2)

2. For the same image S as given in Prob. 1. Quantize its DCT coefficients using the following quantization matrix. Determine the quantized coefficient indices and quantized values. Also, determine the reconstructed image from the quantized coefficients.

Hint: you may use idct2 to do the inverse DCT calculation from quantized coefficients. But you can determine the quantized coefficient indices and quantized values by hand. Alternatively, you can modify the “blkquant_dct.m” program provided on the web to accomplish the required tasks.

[pic]

Solution:

Using the equation Qindex(f)=floor((f+Q/2)/Q), Q(f)=Qindex(f)*Q

For coefficient f=T_{0,0}=20, Q=16, Qindex(f)=floor((20+8)/16)=floor(1.75)=1, Q(f)=1*16=16

For coefficient f=T_{1,1}=2.3431, Q=12, Qindex(f)=floor((2.3431+6)/12)=floor(0.6953)=0, Q(f)=0

Repeating the same operations we obtain

Quantized coefficient indices qdct=[pic], quantized coefficients iqdct=[pic]

The reconstructed image from the quantized coefficients is

[pic]

The above can be obtained also using the following matlab command:

» Q=[16,11,10,16;12,12,14,19;14,13,16,24;14,17,22,29];

>> qdct=floor((T+Q/2)./Q)

>> iqdct=qdct.*Q

>> Shat=idct2(iqdct)

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download