JPG Image Compression by Cosine Transformation
Visit GitHub for python code.
Image Compression Process:
- Define quantization matrix and cosine transform matrix.
- Load and preprocess the input image.
- Extract red, green, and blue channels.
- Apply cosine transform to each channel.
- Apply quantization and compress using run-length compression.
- Calculate compression rate and image quality.
- Display original and compressed images.
Image Decompression Process:
- Decompress run-length compressed images.
- Apply dequantization and reverse cosine transform.
- Combine color channels and restore original image.
- Display decompressed image and compare image quality.
Results and Analysis:
- Measure compression rate, distance between original and decompressed images.
- Compare image quality using pixel-wise distance and graphical representation.