Sie sind auf Seite 1von 2

Lab 15

Discrete Cosine Transform

In this lab we will apply Discrete Cosine Transform (DCT) analysis on an image.

15.1 Introduction to Wavelet Transform

In Transform coding the choice of particular transform, in a given application, depends on


the amount of reconstruction error that can be tolerated and the computational resources
available. Compression is achieved during the quantization of the transformed coefficients.
The discrete transform, T (u, v), and inverse cosine transform of an image f (x, y) of size N x
N is given Eq. 15.1and Eq. 15.2, respectively.
N
X1 NX1
T (u, v) = f (x, y)g(x, y, u, v) (15.1)
x=0 y=0

N
X1 NX1
f (u, v) = T (u, v)h(x, y, u, v) (15.2)
x=0 y=0

Where, u, v = 0, 1, ..., N 1 and x, y = 0, 1, ..., N 1. While, g(x, y, u, v) and h(x, y, u, v) are


f orward and reverse kernels or basis images, respectively.

Discrete Cosine Transform is symmetric i.e forward and reverse kernels are equal as given in
Eq. 15.3

(2x + 1)u⇡ (2x + 1)v⇡


g(x, y, u, v) = h(x, y, u, v) = ↵(u)↵(v)cos[ ].cos[ ] (15.3)
2N 2N

where

8 q
< 1
, for u = 0;
↵(u) = qN (15.4)
:
N , for u = 1, 2, ..., N 1.
2

63
Lab 15 Discrete Cosine Transform

15.2 Practical

15.2.1 Activity No. 1

Take an arbitrary 8 x 8 image using magic or round(a ⇤ rand()) functions and take its
2-D DCT by using dct2 function and show the DCT coefficient matrix.Quantize the DCT
coefficient matrix for less than 10 take its inverse DCT using idct2 function.

15.2.2 Activity No. 2

Extend Act. 15.2.1 for a gray scale image. Set the values less than magnitude 20 in DCT
matrix to zero, and then reconstruct the image using the inverse DCT function idct2.

15.2.3 Questions

1. Find the reconstruction error in Act. 15.2.1 and Act. 15.2.2

2. Comment on the results by increasing the threshold of quantizing the DCT coefficient
matrix.

64

Das könnte Ihnen auch gefallen