1

Is there a way I can get HSV range/values for the colour I want to separate?

I want to detect 4 by creating the mask for which I would require the HSV values.

enter image description here

The number 4 is in blue color and I tried the following:

lower_blue = np.array([110,50,50]) 
upper_blue = np.array([130,255,255])
image_blue = cv2.inRange(img, lower_blue, upper_blue)

On applying the above mask, all I get is a black image. Is there some way I can know the HSV values?

Amanda
  • 2,013
  • 3
  • 24
  • 57
  • 1
    You need to convert your image to HSV before you apply a threshold using HSV values. Once your image is in HSV, you can also see what the values are of the pixels composing the 4. – Cris Luengo Apr 21 '19 at 23:24
  • 1
    cv2: [Changing Colorspaces](https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_colorspaces/py_colorspaces.html) – furas Apr 21 '19 at 23:36
  • https://stackoverflow.com/questions/47483951/how-to-define-a-threshold-value-to-detect-only-green-colour-objects-in-an-image/47483966#47483966 – Kinght 金 Apr 22 '19 at 05:44
  • Possible duplicate of [python opencv color tracking](https://stackoverflow.com/questions/31460267/python-opencv-color-tracking) – zeFrenchy Apr 23 '19 at 14:58

0 Answers0