OpenCV Android Green Color Detection -
currently i'm making app user detect green colors. use photo testing:
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:
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:
you can refer this answer details.
Comments
Post a Comment