This project demonstrates how Singular Value Decomposition (SVD) can be used to compress grayscale images by retaining only the most significant singular values. The technique is implemented in Python using NumPy and skimage.
- Load a high-resolution RGB image from the web
- Convert it to grayscale and resize to 256x256 for simplicity
- Apply SVD to decompose the image matrix
- Reconstruct compressed versions of the image using top
ksingular values - Automatically find the optimal
kbased on:- Energy retention ≥ 95%
- SSIM ≥ 0.90
- Visualize:
- Original vs Compressed image
- Singular values
- Energy retention vs number of components
k
- Energy Retention: Measures how much of the image’s information is preserved using the top
ksingular values. - SSIM (Structural Similarity Index): Measures the perceptual similarity between the original and compressed image.
The script automatically selects the smallest k that satisfies both:
- Energy retention ≥ 95%
- SSIM ≥ 0.90
This balances image quality and compression efficiency.
| Original Image | Compressed Image |
|---|---|
![]() |
Generated by script |
Note: The actual image used is converted to grayscale and resized in the script.
IC_AdaptiveSVD.ipynb # Main script README.md # This file
- numpy
- matplotlib
- scikit-image
Install with:
pip install numpy matplotlib scikit-image