I am having an issue with color detection in OpenCV 3.4. I will present a picture of my problem below.
import numpy as np
import cv2
img= cv2.imread("C:\\Users\Stefan_Cepa\\Desktop\\dataset2\\set\\A6.png")
hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
lower_range = np.array([30,150,150])
upper_range = np.array([255,255,180])
mask = cv2.inRange(hsv, lower_range, upper_range)
output = cv2.bitwise_and(img, img, mask = mask)
cv2.imshow("images", np.hstack([img, output]))
cv2.imshow('mask', mask)
while(True):
k = cv2.waitKey(5) & 0xFF
if k == 27:
break
cv2.destroyAllWindows()
As you can see I've set my lower and upper bounds to detect Red color in an image, but for some reason, as you can see in image below, I am not getting any results. Any tips & tricks would be extremely helpful! Thank you in advance!
