I am trying to build an app which can detect skin color of different parts of skin ( hand, forehead, cheeks ) regardless of lighting condition. I am able to do it using this project but its not taking care of lighting conditions. This is one of the Iphone app which does that
In case you want to do some image processing on your own, i would recommend to create a histogram for each face region of your image. As long as opencv is capable of detecting the face, you should be able to normalize the histogram in that region and take the color values of the normalized version.
Maybe you want to normalize all channels (R,G,B) separately to reduce influences of colored light.
Read here for further information on histograms: https://en.wikipedia.org/wiki/Histogram
When you follow that way, I strongly recommend to take one face as a whole region to create the histogram(s) for.
[Edit]
Now that I know what you try to do, I think you can take the following approach:
As you can see, the user needs to tap the camera fore and back. As the image is lit by the backside-led of the phone, the histogram is indeed exactly what the creators of that app are creating. However, not from different pixels but from different samples of the same pixel using different lighting levels.
When you are very close to the skin, the camera will show you a nearly white image, that is, if you like, the "fixed point" for the histogram calculation.
Although I am not going to show direct code, I will try to explain the mathematical model:
threshold number of values (your "working" range if you like) and call them histLow and histHighpixel = (pixel-histLow) / (histHigh-histLow) * 255If you don't know how to multiply or add colors in RGB, that's where you should start with a different question.
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