Color detection in opencv (python)

1.1k views Asked by At

I'm trying to make a mask of all green pixels and one of all yellow pixels using the inrange function. The big trouble I have is finding the correct HSV values for both colors because they seem to overlap. The following picture (green circle) should detect the green circle only in the yellow mask, this picture (yellow square) must do the opposite (only yellow) but i cannot seem to seperate them.

I use the following HSV values

#Yellow
lower_yellow = np.array([20, 20, 20], dtype=np.uint8)
upper_yellow = np.array([35, 255, 255], dtype=np.uint8)

#Green
lower_green = np.array([24, 40, 40], dtype=np.uint8)
upper_green = np.array([60, 255, 120], dtype=np.uint8)

I hope anyone can help

0

There are 0 answers