I use openCV to select all green objects, but I don’t know how to get around and not select gray objects. Is it possible to somehow check the color of an object? Well, that is, if the object has a green color, then we select it, if not, then we do not select it.
After executing the code, I get this picture, but I need the gray object – the bomb – not to be highlighted in red
screen = cv2.imread('blum.png')
gray_img = cv2.cvtColor(screen, cv2.COLOR_RGB2GRAY)
_, binary = cv2.threshold(gray_img, 125, 255, cv2.THRESH_BINARY)
contours, hierarchy = cv2.findContours(binary, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
screen = cv2.drawContours(screen, contours, -1, (255, 0, 0), 2)
plt.imshow(screen)
plt.show()