python+opencv - How to plot hsv range?

Viewed 13132

To extract the color, we have this function

# define range of blue color in HSV
lower_blue = np.array([110,50,50])
upper_blue = np.array([130,255,255])

# Threshold the HSV image to get only blue colors
mask = cv2.inRange(hsv, lower_blue, upper_blue)

How do we actually visualize the range(lower_blue,upper_blue) I define on hsv space? Also How do I actually plot a hsv color,but it is not working...? I have this code:

upper = np.array([60, 255, 255])
upper = cv2.cvtColor(upper, cv2.COLOR_HSV2BGR)


upper = totuple(upper/-255)
print(upper)
plt.imshow([[upper]])
1 Answers
Related