Reputation: 488
Given an image, how do I go about determining if a certain pixel is "white" ? Based on Wikipedia, I understand that if the RGB values are at (255,255,255)
, the pixel is considered white and that a lower similar set of values for eg. (200,200,200)
would mean that it is a "darker shade of white" i.e. gray.
Should I just set a threshold of example 80% for each channel and if the RGB at a certain pixel passes that condition then it is marked as gray/white ? Are there any papers that I can read up for help ?
Regards, Haziq
Upvotes: 1
Views: 1512
Reputation: 207540
If you simply threshold all channels at, say 200, you are allowing the Red to differ from the Green and that to differ from the Blue, which means you are allowing colour into your images and all the following colours would be permitted:
You need to ensure that, not only are Red, Green and Blue above 200, but further that they are equal. That way you only permit this range:
In the HSL model, you need Lightness to be above say 80%, but also the Saturation to be zero to ensure white/gray.
Upvotes: 1