- Read the image file
- Callback event on mouse click
- Shows the color name and RGB values of the pixel that was clicked on
- 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)
- A function to calculate the min value of the difference between that pixel's RGB value and the colours present in the csv dataset.
- 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.
- Exit the window on pressing ESC key.
- Reading and displaying an image using
cv.imread()
andcv.imshow()
- Using an event for mouse click. Here
cv.EVENT_LBUTTONDOWN
was used which is for single click. - Obtaining RGB value of the pixel
- Adding rectangle and text on the image using
cv.rectangle(source,point1,point2,colour,thickness)
andcv.putText(source,text,point,font,fontScale,colour,thickness,linetype)
- On each click, the image was reset using the copy.deepcopy() method to erase the previous rectangle's display
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.