|
This is a simple class for detecting skin in images. Each color of a pixel is transformed into the hsv-colorspace and then compared against a skin-color database. Usage$skindetection = new SkinDetection("images/example1.jpg", "output1.png");
$skindetection->loadSkinColors("skin_colors.txt");
$skindetection->setThresholdH(0.04, 0.04);
$skindetection->setThresholdS(0.09, 0.09);
#$skindetection->enableImageMagick();
#$skindetection->enableResize(50, 10);
$return = $skindetection->process();
print_r($return);ExamplesGood Examples images/example1.jpg
pixels overall: 32000
pixels skin: 16775
percent skin: 52.42 % images/example2.jpg
pixels overall: 56600
pixels skin: 21092
percent skin: 37.27 % images/example3.jpg
pixels overall: 53400
pixels skin: 4573
percent skin: 8.56 % images/example4.jpg
pixels overall: 40000
pixels skin: 10999
percent skin: 27.5 % images/example5.jpg
pixels overall: 59800
pixels skin: 17605
percent skin: 29.44 % images/example6.jpg
pixels overall: 26800
pixels skin: 8943
percent skin: 33.37 % images/example7.jpg
pixels overall: 26600
pixels skin: 6199
percent skin: 23.3 % Bad Examples images/example8.jpg
pixels overall: 36200
pixels skin: 17222
percent skin: 47.57 % images/example9.jpg
pixels overall: 53400
pixels skin: 35134
percent skin: 65.79 % images/example10.jpg
pixels overall: 28200
pixels skin: 15746
percent skin: 55.84 %
|