0

I am trying to Mask Green Color in the image .

Below in the code which, i am using to do it .

Even if the color Hue value is inRange , It is NOT masking the Image .

    cvtInputBGRtoHSV = cv2.imread(inputFileImage)
    maskInput = cv2.inRange(cvtInputBGRtoHSV,(30, 0, 0),(91, 255,255))
    cv2.imwrite(inputFileImage, maskInput)

For reference I have attached the Input and Output image .

When I try to Get the HSV value of the Unmasked Green , I am seeing as 121 for range of 360 , so when I convert to 180 Range of Hue ( Which is actually in Python) it will be ~60

Please help me over this and also let me know , if there is any problem

MaskedImageInputImage

Sreevathsabr
  • 649
  • 7
  • 23
  • 1
    Where do you actually convert to HSV? – Miki Feb 20 '19 at 17:18
  • 2
    Possible duplicate of [How to define a threshold value to detect only green colour objects in an image :Opencv](https://stackoverflow.com/questions/47483951/how-to-define-a-threshold-value-to-detect-only-green-colour-objects-in-an-image). Your HSV range for green is Wrong!. I choose ` (36,25,25) ~ (86, 255,255)` for green. Just run the code from the link for [your image](https://i.stack.imgur.com/E8xBW.png), then well will get [this result](https://i.stack.imgur.com/xs2yV.png) – Kinght 金 Feb 21 '19 at 05:18
  • @Kinght金 sorry ! As I told in the comment that problem was I missed the code to convert to HSV – Sreevathsabr Feb 21 '19 at 05:52
  • Can you show expected image? – Alderven Feb 22 '19 at 14:41

0 Answers0