This repository provides a MATLAB-based implementation of fractal image compression enhanced with the Discrete Cosine Transform (DCT). The project focuses on compressing images efficiently by leveraging both fractal methods and DCT, optimizing the compression ratio, PSNR, and memory usage. It includes scripts for encoding, decoding, and image processing utility functions, all designed for ease of use and reproducibility.
Fractal image compression is a technique that uses self-similarity within an image to achieve high compression ratios. This project integrates DCT into the fractal compression process to enhance efficiency and performance, particularly for 256x256 images. The method achieves a compression ratio of 10:1, with a decoding time of 5 seconds, and a Peak Signal-to-Noise Ratio (PSNR) of 32 dB, while also reducing memory usage by 40%.
Below are the comparative performance metrics for 256x256 images using various fractal compression techniques:
Table 1. Comparative Performance Metrics of Fractal Image Compression Methods for 256x256 Images in MATLAB.
The following table compares different compression techniques applied to the Lena image with thresholds of 0.5 and 0.1:
Table 2. Comparing the compression using different techniques on the Lena image for thresholds = 0.5 and 0.1.
The repository includes:
- Scripts for encoding and decoding images.
- Utility functions for image transformation and partitioning.
- Example scripts demonstrating the usage of the compression and decompression methods.
- A sample image for testing the algorithm.
- DCT-based Fractal Compression: Combines fractal compression with DCT to achieve superior results.
- Efficient Partitioning: Uses domain transformations and non-search-based partitioning to speed up the process.
- Quantization with Normalization Matrices: Includes tools for DCT quantization and error thresholding.
- Comparative Study: Provides insights into time complexity, compression ratio, PSNR, and memory usage.
Before running the scripts, ensure you have the following software:
- MATLAB (R2021a or later)
- Basic knowledge of image processing and MATLAB scripting.
To set up the project on your local machine, follow these steps:
-
Clone the repository:
git clone https://github.com/your-username/fractal-dct-combined-compression.git cd fractal-dct-combined-compression
-
Open MATLAB: Launch MATLAB and navigate to the project directory.
-
Run the example scripts:
You can run the compression and decompression example scripts provided in theexamples/
folder:examples/compression_example.m
: Script for compressing an image.examples/decompression_example.m
: Script for decompressing an image.
To compress an image:
- Open
examples/compression_example.m
. - Run the script to compress the sample image (
data/bridge.pgm
).
To decompress an image:
- Open
examples/decompression_example.m
. - Run the script to decompress the previously compressed image.
FractalImageCompression/
├── README.md # Project overview and documentation
├── LICENSE # License information
├── src/ # Source code for compression and decompression
│ ├── fractal_dct_compress.m # Main compression function
│ ├── fractal_dct_decompress.m # Main decompression function
│ ├── distortion_calculation.m # Distortion calculation function
│ ├── mean_domain_calculation.m # Mean domain calculation
│ ├── partition_no_search.m # Partitioning without search
│ └── utils/ # Utility functions
│ ├── dct_transform.m # DCT transformation function
│ ├── idct_transform.m # Inverse DCT transformation function
│ └── normalization_matrix.m # Normalization matrix for quantization
├── data/
│ └── bridge.pgm # Sample image for testing
└── examples/
├── compression_example.m # Example script for image compression
└── decompression_example.m # Example script for image decompression
- Normalization Matrices (
normar1
): Matrices used for DCT quantization. - Image Processing Parameters:
T1, T
: Input images.numrange, numdom
: Range and domain block sizes.dct2, idct2
: DCT and inverse DCT functions.
- Compression Parameters:
ss, quan, errr
: Scaling, quantization, and error thresholding.ym, hk, DDF, fdel
: Parameters for managing the state of compression.
This project is licensed under the Apache-2.0 License. See the LICENSE file for details.
Special thanks to all contributors and the open-source community for their support and valuable insights that made this project possible.