After reading these tutorials (this & this), I can figure out how to extract any color range including Red, Green, Blue and Yellow, using the Hue value of an HSV
image or OpenCV
Mat. However this value doesn't have the ability to describe the Gray color that I need to select. So is there any way to extract the Gray pixels of an image using OpenCV
?
In HSV/HSL colourspace, the grey pixels are characterised by having Saturation of zero or very close to zero, so that test will discriminate black through grey to white pixels. Then the Value/Lightness will tell you how far along the scale from black to white they actually are, low Lightness/Value is dark grey whereas high Lightness/Value means light grey.
In RGB colourspace, grey pixels are characterised by having all three colour components equal, i.e. R=G=B.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With