I am trying to detect red color from the video that\'s being taken from my webcam. The following code example given below is taken from OpenCV Documentation. The code is gi
Running the same code for red seems to work:
>>> red = numpy.uint8([[[0,0,255]]])
>>> hsv_red = cv2.cvtColor(red,cv2.COLOR_BGR2HSV)
>>> print(hsv_red)
[[[ 0 255 255]]]
And then you can try different colors that appear reddish. Beware that the red range includes both numbers slightly greater than 0 and numbers slightly smaller than 179 (e.g. red = numpy.uint8([[[0,31,255]]])
results in [[[ 4 255 255]]]
whereas red = numpy.uint8([[[31,0,255]]])
results in [[[176 255 255]]]
.