A simple Python project to analyze the color spectrum of an image using OpenCV and Matplotlib.
This tool loads an image and calculates the distribution of colors (in RGB format), then visualizes them as a color spectrum (pie chart). It's useful for:
- Basic image analysis
- Understanding dominant colors
- Learning OpenCV and matplotlib
- Python 3.x
- OpenCV (
cv2) - Matplotlib
- NumPy
color-spectrum-analyzer/
βββ main.py # Main script
βββ image.jpg # Input image
βββ output.png # Generated color spectrum
βββ requirements.txt # Required packages
βββ README.md # Project description
-
Clone the repository:
git clone https://github.com/your-username/color-spectrum-analyzer.git cd color-spectrum-analyzer -
Install dependencies:
pip install -r requirements.txt
-
Run the script:
python main.py
- Make sure your image file is named
your_image.jpgand is in the same folder asmain.py - The output chart will be saved as
output.png.
Contributions are welcome! Feel free to fork this repo, open issues, or submit pull requests.