SkinDetector icon indicating copy to clipboard operation
SkinDetector copied to clipboard

Detects Human Skin From Image (color-region-segmentation-photo-detection-extraction-detect)

:dancer: Skin Detector

Detects Human Skin From Image

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.

How to Run?

  1. For training the system run SkinDetectorTrainer.java. After training a knowledge file is created.
training
  1. Then run SkinDetectorTester.java or SkinDetectorTester2.java for getting output (change file-paths in the main method according to the need).

    input-

    input image

    output-

    outout image outout image

How It Works?

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.

License

MIT License
SkinDetector is licensed under MIT License.