I have photos of people's faces, and I want to detect each person's skin color for later use. I don't want to use predetermined color ranges, instead I want to determine each person's color and then use it to detect occlusions in this person's later photos. The training face images are taken under the same conditions, but testing will be with photos of different conditions. My first thought is to use color histograms of these images, and then the peak will be this person's skin color. Is there a smarter way to do this? I'm using Python and OpenCV, but I can use other tools if needed.


1 Answer 1


It'd be good idea to extract face segment first. In OpenCV there're predefined HaarCascades for face detection. Though, you can run into some problems using them. Photos really need to be well-exposed. They're also prone to false positives as hell.


Slightly better, but still vanilla, there's dlib. Worst problem with them is you'll only get bounding box. Background may creep in and mess your color analysis.

To get seminal-like scores you gotta go DNN. Here's some example.

I would propose a bit different approach. Take your data set. Extract faces using existing tool and label skin colour manually. Then train CNN. Just be careful, when you augment data set. Some operations might be damaging, like swapping channels. Color-based analysis is tough. You need to think of covering different exposure values, contrast, white-balance, saturation etc.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.