This program is a very simple machine learning implementation for image region segmentation. Only by altering training data it can detect any type of region based on pixel value.
- For training the system run SkinDetectorTrainer.java. After training a knowledge file is created.
-
Then run SkinDetectorTester.java or SkinDetectorTester2.java for getting output (change file-paths in the main method according to the need).
input-
output-
We have used naive Bayes here for classification (skin or non-skin pixel). As it is a colour image there are 256*256*256 types of pixels.
In the training phase, pixel frequencies of being skin or non-skin is calculated. We take every pixel of the image and see if it is a pixel of skin by using the mask. If the pixel is on skin, we increase its skin-frequency. Else we increase the non-skin-frequency. After processing all images, probability of a skin-pixels is calculated from the frequency using Bayes Theorem. We store this data in a file.
During testing, we simply map each pixel with the probability we calculated in training phase. If the probability is greater than a certain threshold, we mark that pixel as skin.
SkinDetector is licensed under MIT License.