This project demonstrates image compression using Principal Component Analysis (PCA) for dimensionality reduction. By reducing the dimensionality of image data, we can compress images effectively while retaining most of the important features, thus optimizing storage space without significantly compromising image quality.
Image compression is crucial for efficient storage and transmission of images in various applications. PCA is a statistical technique that transforms data into a set of orthogonal components, capturing the most significant variance in the data. This project applies PCA to compress images by reducing their dimensionality.
- Compress grayscale and color images using PCA
- Adjustable number of principal components for compression level control
- Visual comparison between original and reconstructed images
- Python 3.x
- NumPy
- Matplotlib
- scikit-learn
- Pillow (PIL)
- opencv-python
- setuptools
-
Clone the repository:
git clone https://github.com/yourusername/your-repo-name.git
-
Navigate to the project directory:
cd your-repo-name -
Install the Required packages:
pip install -r requirements.txt
-
Prepare your images: Upload the images you want to compress using the file uploader or you can also use input_images/ directory for trial purposes. Supported formats include JPEG, PNG, etc.
-
Run the Script:
python pca_v2.py
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b feature-name
- commit your changes:
git commit -m 'Add new feature' - Push to the branch:
git push origin feature-name
- Open a Pull Request.