marți, 12 aprilie 2022

Color Detection

 Color detection is the process of detecting the name of the color. For humans this is an extremely easy task, but for computers it is tougher. Human eyes and brains work together to translate light into color. Our eyes transmit the light signal to the brain, and then the brain recognizes the color. But computers can’t use this strategy. They have to do some calculations in order to detect the color.

That is because colors are made up of 3 primary colors: red, green, and blue. Computers define each color a value within a range of 0 to 255. That makes 16,777,216 different colors. The dataset of the project includes 865 color names, their RGB and hexagonal values. The data is arranged in 6 columns: color, color name, hex value, R, G, B. For example: royal_blue_traditional, "Royal Blue (Traditional)",#002366,0,35,102.

The goal of the system is to find the color of the point on which the picture was clicked on. Since there are more than 16,5 million colors, and the dataset contains only 865, after the system found the RGB values it has to calculate the shortest distance to a listed color. 

The distance is calculated by this formula: 

d = abs(Red – ithRedColor) + abs(Green – ithGreenColor) + abs(Blue – ithBlueColor) 


Once the shortest distance is found, the system will display the colors name, and RGB values on the top left side of the picture. 

Result

Steps:

  1. Load the image 
  2. Read the csv file

  3. Show the image 

  4. Wait for a click event 

  5. Get the coordinates of the clicked point 

  6. Get the RGB values of the clicked point

  7. Calculate the shortest distance to a color 

  8. Display the color name and RGB values 


Bibliography:
COLOR DETECTION USING PANDAS AND OPENCV - C K Gomathy

Niciun comentariu:

Trimiteți un comentariu

Neural network can read tree heights from satellite images

Neural network can read tree heights from satellite images Researchers at ETH Zurich have created a high-resolution global vegetation height...