I'm trying to match all green colors in HLS (Hue Lightness Saturation), but without much success. I have to create an image containing only green peppers. Source image:
All I need is specific section/dependencies between H, L and S. I have searched for this in the Internet but i failed :(.
I'm using OpenCV in Java for this. My current code (part):
private double lsRatio(HLS hls) {
return hls.getL() / hls.getS();
}
private boolean isCondition(HLS hls) {
return hls.getS() >= 0 && lsRatio(hls) > 0.8 && lsRatio(hls) < 5 && (hls.getH() <= 120 || hls.getH() >= 80);
}
And for this condition I get:
As you can see there's still some red color.
Thanks for any help.