Skip to content

About

No description or website provided.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

Color Detection Project

This project was built to understand how computers can identify colors in images. Humans recognize colors naturally, but computers work with numerical values, so I wanted to learn how to bridge that gap and build something practical along the way.

About This Project

I created a tool that lets you click anywhere on an image and it tells you the name of that color along with its RGB values. It works by comparing the RGB values of the pixel you select against a database of over 865 named colors, finding the closest match using a simple distance calculation. It was a great learning experience that combined image processing, data handling, and working with real-world datasets.

What I Learned

Working on this project taught me several important concepts. I learned how to read and display images using OpenCV, how to capture mouse events and respond to user clicks, and how to draw text and shapes directly on top of images. I also practiced loading and querying structured data from CSV files using Pandas, which was very useful. Beyond the technical skills, I gained a much clearer understanding of how colors are represented digitally, how the RGB color space works, and how to measure similarity between colors so a computer can make sense of what it sees.

How It Works

The program reads an image file and loads a dataset containing color names and their corresponding RGB values. When you double-click on any part of the image, it captures the RGB values of that pixel, compares it to every color in the dataset, and returns the name of the closest matching color. The result is displayed directly on the image along with the exact RGB values, and the text color automatically adjusts so it stays readable on both light and dark backgrounds.

Tools and Technologies

This project uses Python as the programming language, OpenCV for image handling and display, Pandas for reading and working with the color dataset, and NumPy for numerical operations. It runs entirely on CPU and does not require a GPU, which made it easy to develop and test on my own laptop.

How to Run

First install the required libraries: pip install opencv-python numpy pandas

Then run the script and provide the path to your image: python main.py --image path/to/your/image.jpg

Once the image window opens, double-click anywhere on the image to detect the color at that point. Press the ESC key to close the program.

Project Files

main.py - The main program code data/colors.csv - Dataset with 865 named colors and their RGB values images/ - Folder containing sample images to test with

About

No description or website provided.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages