Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Readme.md

Outline

Colour Detection using Pandas and OpenCV

In this color detection Python project, we are going to build an application through which you can automatically get the name of the color by clicking on them. So for this, we will have a data file that contains the color name and its values. Then we will calculate the distance from each color and find the shortest one.

Steps Used

  • ##Importing required package and load the image.
    Package used - Pandas and cv2 for OpenCV bindings.
  • ##Reading the CSV file with pandas.
  • ##Set a mouse callback event on a window
    First, we created a window in which the input image will display. Then, we set a callback function which will be called when a mouse event happens.
    draw_function - In the function, we check if the event is double-clicked then we calculate and set the r,g,b values along with x,y positions of the mouse.
  • ##Calculate distance to get color name
    d = abs(Red — ithRedColor) + (Green — ithGreenColor) + (Blue — ithBlueColor)
  • ##Display image on the window
    Whenever a double click event occurs, it will update the color name and RGB values on the window.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.