Jai DCT
Jai DCT
JAYAKUMAR E
208124014
March 2025
1 Objective
To implement the Discrete Cosine Transform (DCT) on an image, analyze its frequency domain
characteristics, and reconstruct the image using the Inverse DCT.
2 Theory
The Discrete Cosine Transform (DCT) is used to represent an image as a sum of cosine functions
of varying frequencies. It is widely used in image compression techniques such as JPEG due to its
energy compaction properties. The mathematical expression for 2D-DCT is:
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 αu and αv are scaling factors:
√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 CODE
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 and Reconstructed Images
51
5.2 Magnitude Spectrum of Image
52
6 Conclusion
In this experiment, we implemented the Discrete Cosine Transform (DCT) to analyze an image
in the frequency domain. The DCT conversion helps in understanding the frequency components
of an image. The transformed coefficients demonstrate the energy compaction property of DCT,
which is useful in compression techniques like JPEG. The reconstructed image obtained using the
Inverse DCT was nearly identical to the original image, demonstrating that the transform preserves
essential image details. This experiment highlights the significance of DCT in image processing
applications such as compression, filtering, and enhancement.
53