Skip to content

This is an OpenCV program that exercises the retrieval of RGB values of a pixel and displaying the name and RGB value of that colour on the image.

Notifications You must be signed in to change notification settings

muskan-k/colour-detection-of-pixels-on-images

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Colour detection of the pixels in an image

Imports: Pandas, OpenCV, copy, Numpy

This is more of a program that uses OpenCV to process on images. Following are the features:

  1. Read the image file
  2. Callback event on mouse click
  3. Shows the color name and RGB values of the pixel that was clicked on
  4. A function call on mouse click that recieves the rgb value of the pixel at (x,y) position in the image (where it was clicked)
  5. A function to calculate the min value of the difference between that pixel's RGB value and the colours present in the csv dataset.
  6. Displaying a rectangle near the clicked pixel with that colour filled, along with a text that displays the colour name and R G B values from the csv.
  7. Exit the window on pressing ESC key.

What did I learn?

  1. Reading and displaying an image using cv.imread() and cv.imshow()
  2. Using an event for mouse click. Here cv.EVENT_LBUTTONDOWN was used which is for single click.
  3. Obtaining RGB value of the pixel
  4. Adding rectangle and text on the image using cv.rectangle(source,point1,point2,colour,thickness) and cv.putText(source,text,point,font,fontScale,colour,thickness,linetype)
  5. On each click, the image was reset using the copy.deepcopy() method to erase the previous rectangle's display

Will this repository be improved?

Yes, the project will be updated with added features that allows you to capture your own image using the webcam to obtain the colours of an image from real-time.

OUTPUT

O1

O2

O3

About

This is an OpenCV program that exercises the retrieval of RGB values of a pixel and displaying the name and RGB value of that colour on the image.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages