I have an image and I need to make everything black except for the color green and what ever color is inside there. How do I make all black except for green and what ever color is inside green?
I have converted the color image from RGB to BGR and converted BGR to HSV. I have created lower and upper for green Masked the image according to the boundaries but when I show the image everything else is black except for green. The color inside the green rectangle doesn't show up.
[]
hsv = cv2.cvtColor(img,cv2.COLOR_BGR2HSV)
lower = np.array([69,206,177], dtype = "uint8")
upper = np.array([69,206,177], dtype = "uint8")
green_mask = cv2.inRange(hsv,lower,upper)
green= cv2.bitwise_and(hsv,hsv,mask=green_mask )
cv2.imshow("Show colors in green ",green)
cv2.waitKey(0)
cv2.destroyAllWindows()