This project implements image compression using the Discrete Cosine Transform (DCT), inspired by JPEG compression techniques.
The image is divided into 8×8 blocks, transformed into the frequency domain using DCT, then reconstructed using inverse DCT (IDCT). The quality of reconstruction is evaluated using PSNR.
- DCT implementation using:
- Mathematical formula
- Matrix multiplication
- Inverse DCT (IDCT)
- Block-based processing (8×8)
- Performance comparison (formula vs matrix)
- PSNR (image quality evaluation)
- Simple graphical interface using Tkinter
The image is first converted to grayscale and resized to ensure dimensions divisible by 8.
Then:
- The image is divided into 8×8 blocks
- Each block is transformed using DCT
- Two methods are used:
- Direct formula (slow)
- Matrix multiplication (optimized)
After that:
- IDCT is applied to reconstruct the image
- PSNR is computed to evaluate reconstruction quality
- Discrete Cosine Transform (DCT)
- Inverse DCT (IDCT)
- Block-based image compression
- Frequency domain representation
- PSNR (Peak Signal-to-Noise Ratio)
pip install numpy opencv-python pillow
python dct-image-compression.py