How to define "lower" and "upper" range of two (or more) different color?
This topic: 134248/how-to-define-the-lower-and-upper-range-of-a-color/ gives me some question
How can I define "lower" and "upper" range of two different color, such as red and blue (because red and blue are not next to each other in the HSV color)
This one belongs to red:
lower_red = np.array([160,20,70])
upper_red = np.array([190,255,255])
and this one belongs to blue:
lower_blue = np.array([101,50,38])
upper_blue = np.array([110,255,255])
I tried to combine them using if condition or make their own function but not work, can you guys show me the solution?
you should make seperate masks with inRange() for each color, and then combine those masks using cv2.bitwise_or()
you mean this?
I tried, it receive every red and blue thing (include the thing I don't want it receive), but when I run the program red and blue range one-by-one, it didn't do that? What is my mistake?
@mrlyzin. The answer is NOOOOOOOOoooooo! Look at stackoverflown how to detect color