on-internet
← Community

Python OpenCV - How to recognize the specific colour in the image

Stack Overflow ·

Hello all I am working on the program that will simply recognize % of violet colour in the image. I am struggling with this rgb values.. Is there any smarter way of predefined static values for colours like 'blue' or 'green' or 'violet' in openCV already? This is the code and the picture import cv2 import numpy as np imagePath = "probki/b.png" img = cv2.imread(imagePath) violet = [84, 39, 60] diff = 100 boundaries = [([violet[2], violet[1]-diff, violet[0]-diff], [violet[2]+diff, violet[1]+diff, violet[0]+diff])] scalePercent = 1 width = int(img.shape[1] * scalePercent) height = int(img.shape[0

Comments

Sign in or sign up to comment and upvote.

No comments yet.