How to define the “lower” and “upper” range of a color?
Hi, could you please help me with a question defining the range of a certain color?
Learning from the question and answers in the site /31305/why-is-this-simple-mask-not-working/
The lines limiting the red are 2 arrays:
lower = n.array([0,100,100])
upper = n.array([20,255,255])
how are these arrays are formed?
The RGB of red is (255, 0, 0) and its HSV is (0°, 100°, 100°)
How’s the RGB 255,0,0 to be relevant into ([0,100,100]) and ([20,255,255])? (reading it BGR shall be 0,0,255)
Thank you.
the ranges are specific to a colorspace, so for which colorspace is it ?
@berak, thank you for the comment. "colorspace" is a new concept to me. Do you mean I need to convert the RGB to colorspace?
no, but ranges for BGR are different from ranges for HSV, so you have to be explicit about what you want.
@berak, thanks. I just want to know what values to put in the arrays. i.e. how do I know between ([0,100,100]) and ([20,255,255]) is red?
in hsv space: [0,100,100] and [20,255,255]
in bgr space: [255 255 0] and [0 0 255]
from where can I find the "hsv space" (lower and upper) for all colors?