0

I'm new to image processing and video processing and I tried to get the orange color space for use in my color detecting python file. But unfortunately it doesn't work. It works when I give the blue color space define range in HSV colorspace.

I tried giving the color space for orange but then system doesn't show any output

Define 'orange' range in HSV colorspace

upper = np.array([32,255,255])

lower = np.array([110, 50, 50])

mask = cv2.inRange(hsv, lower, upper)

I want the proper 'orange' range in HSV colorspace

nathancy
  • 42,661
  • 14
  • 115
  • 137
  • 4
    Notice that in the first channel, your `lower` array actually has a *higher* value than your `upper` array does. That means OpenCV will be looking for colors where the first channel is above 110 and lower than 32---of course, no pixels match this description so you'll get a black mask. Simply switch the first element of the two arrays. – alkasm Apr 10 '19 at 19:51
  • 1
    See last part of this answer... https://stackoverflow.com/a/50215020/2836621 – Mark Setchell Apr 10 '19 at 20:27

1 Answers1

0

For me the following values were OK to get an approximate orange color space.

# Threshold of orange in HSV space
lower_orange = np.array([0, 100, 45])
upper_orange = np.array([225, 250, 255])
        
# preparing the mask to overlay
mask = cv2.inRange(hsv, lower_orange, upper_orange)
Jordi Tormo
  • 106
  • 7