IMAGE COMPRESSION:using the Two-Dimensional Discrete Cosine Transform (2D-DCT)
and Quantization Methods
2D-DCT ===> \(Y=CXC^{T}\) Image Matrix X ===> \(n\times n\) matrix \(X\) matrix , where \(C\) is defined as: $$C_{ij} = \frac{\sqrt 2}{\sqrt n} a_{i} \text{cos} \frac{i(2j+1)\pi}{2n}$$ for \(i,j=0,...,n-1\), where $$a_{i} \equiv \begin{cases} \frac{1}{\sqrt 2}, & \mbox{if } \mbox{ i=0,} \\ 1, & \mbox{if } \mbox{ i=1,...,n-1} \end{cases}$$ or $$C = \sqrt{\frac{2}{n}}\left[\begin{matrix} \frac{1}{\sqrt2} & \frac{1}{\sqrt2} & \cdots & \frac{1}{\sqrt2} \\ \text{cos}\frac{\pi}{2n} & \text{cos}\frac{3\pi}{2n} & \cdots & \text{cos}\frac{(2n-1)\pi}{2n}\\ \text{cos}\frac{2\pi}{2n} & \text{cos}\frac{6\pi}{2n} & \cdots & \text{cos}\frac{2(2n-1)\pi}{2n}\\ \vdots & \vdots & & \vdots \\ \text{cos}\frac{(n-1)\pi}{2n} & \text{cos}\frac{(n-1)3\pi}{2n} & \cdots & \text{cos}\frac{(n-1)(2n-1)\pi}{2n} \end{matrix} \right] $$
Result (a): 8\(\times\)8 pixel block (Matlab code)
![]() |
![]() |
|
Original B&W | 8x8 Pixel |
Result (b,c,d):Apply 2D-DCT; Quantize using linear quantization \(p=1,2,4\); Print out each \(Y_{Q}\);
![]() |
![]() |
![]() |
|
p = 1
\(Y_Q\) Linear Quantization (p=1) |
p = 2
\(Y_Q\) Linear Quantization (p=2) |
p = 4
\(Y_Q\) Linear Quantization (p=4) |
Result (e):Reconstitute image;(Matlab code)
![]() |
![]() |
![]() |
![]() |
|
Original B&W | p = 1 | p = 2 | p = 4 |
Result: Impressive Reconstruction (Matlab code)
![]() |
![]() |
|
Original B&W | Special Quantization Matrix \(Q_{Y}\) JPEG Quantization
\(Y_Q\) (p=1) |
Results: (Matlab code)
![]() |
![]() |
![]() |
![]() |
|
Sedona, AZ | p=1
RGB \(Y_Q\) (p=1) |
p=2 | p=4 |
![]() |
|
p=16 |
Results: (Matlab code)
![]() |
![]() |
![]() |
![]() |
|
Sedona, AZ | p=1 | p=2 | p=4 | |
Original |
Luminance \(Q_{Y}\) & Color Difference \(Q_{C}\) |
Luminance \(Q_{Y}\) & Color Difference \(Q_{C}\) |
Luminance \(Q_{Y}\) & Color Difference \(Q_{C}\) |
![]() |
|
p=8 |