OpenCV Android Green Color Detection -


currently i'm making app user detect green colors. use photo testing: enter image description here

my problem can not detect green pixel. before worked blue color , worked fine. can't detect though tried different combinations of rgb. wanted know whether it's problem green or detection range, made image in paint using (0, 255, 0) , worked. why can't see circle then? use code detection:

core.inrange(hsv_image, new scalar([i change value]), new scalar(60, 255, 255), ultimate_blue); 

it have been set wrong range, use photoshop color of 1 of green pixels , convert rgb value of hsv. yet doesn't work. don't detect pixel i've sampled. what's wrong? in advance.

using miki's answer:

enter image description here

green color hsv space has h = 120 , it's in range [0, 360].

opencv halves h values fit range [0,255], h value instead of being in range [0, 360], in range [0, 180]. s , v still in range [0, 255].

as consequence, value of h green 60 = 120 / 2.

you upper , lower bound should be:

// sensitivity int, typically set 15 - 20  [60 - sensitivity, 100, 100] [60 + sensitivity, 255, 255] 

update

since image quite dark, need use lower bound v. these values:

sensitivity = 15; [60 - sensitivity, 100, 50]  // lower bound [60 + sensitivity, 255, 255] // upper bound 

the resulting mask like:

enter image description here

you can refer this answer details.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -