KS DCT
KS DCT
1 Objective
To implement the Discrete Cosine Transform (DCT) on an image, observe its characteristics, and
reconstruct the image using the Inverse DCT.
2 Theory
The Discrete Cosine Transform (DCT) is a mathematical transformation that represents an image as
a sum of cosine functions of different frequencies. It is widely used in image compression techniques
such as JPEG due to its energy compaction property.
The 2D-DCT of an image f (m, n) of size M × N is given by:
M −1 N −1
X X π(2m + 1)u π(2n + 1)v
F (u, v) = αu αv f (m, n) cos cos (1)
m=0 n=0
2M 2N
where the scaling factors are:
√1 , u = 0
αu = qM2 (2)
M, 1 ≤ u ≤ M −1
√1 , v = 0
αv = qN2 (3)
N, 1 ≤ v ≤ N −1
3 Procedure
1. Load an image and convert it to grayscale.
2. Compute the cosine transform matrix for the given image dimensions.
3. Apply the DCT transformation to the image.
4. Analyze the characteristics of the transformed image.
49
4 MATLAB Program
clc;
clear all;
close all;
% Compute 2D-DCT
F_dct = (c * f1) * c’;
% Display results
figure(1);
subplot(1,2,1);
imshow(f1); title(’Original Image’);
subplot(1,2,2);
imshow(fidct); title(’Reconstructed Image’);
figure(2);
imshow(F_dct, []); title(’2D DCT of Image’);
50
5 Results
5.1 Original Image and Reconstructed Image
51
5.2 2D DCT Transformed Image
52
6 Conclusion
The Discrete Cosine Transform (DCT) was successfully implemented in MATLAB to analyze an
image in the frequency domain. It helps separate the important image details from less significant
ones, making it useful for compression techniques like JPEG. By transforming an image, we can
reduce the amount of data needed to store it while preserving important visual information. The
experiment showed that the DCT efficiently converts spatial information into frequency components.
After applying the inverse DCT, the original image was reconstructed with minimal quality loss.
This proves that DCT is an effective method for image processing and compression. It helps reduce
storage space while maintaining image clarity. The results demonstrate how DCT plays a key role in
reducing redundancy in images. It is widely used in multimedia applications to improve efficiency.
Overall, DCT is an essential technique for digital image processing.
53