A quick research on the internet shows that color segmentation is widely used for skin detection (specifically using HSV and YCbCr colorspaces), mostly by its simplicity and performance. However, skin tone, illumination, and quality are something that could drastically vary between images. For instance, Kolkur et. al (2016), and Sha et. al (2009) studied that kind of skin segmentation and discovered completely different optimal thresholds values.
Then, I decided to search for other methods and found this paper written by Saxen and Al-Hamadi (2014) which shows that region based gives a better output for skin detection tasks.
Here, a region-growing algorithm (Watershed) and a combination of HSV and YCbCr color segmentations work together to produce the output.
This project was implemented using Python (3.10) and OpenCV (4.6). The class SkinDetector
, available inside skinDetector.py
, must be imported into your project and be used as follows:
from src.skinDetector import SkinDetector
detector = SkinDetector(image_path = "path/to/image")
detector.find_skin()
detector.show_all_images()
-
If you do not have python3 installed:
sudo apt-get install python3 python3-pip
-
Go inside the project folder and run
pip3 install -r requeriments.txt
-
Usage of the test app:
python3 app.py imageName
. For using the image inside the testImages use:python3 app.py testImages/f2.jpg