Image Nudity Filter can be used to determine whether an image may contain nudity. It analyses the colors used in different sections of an image to determine whether those colors match the human skin color tones.
As result of the analysis it returns a score value that reflects the probability of the image to contain nudity. Additionally, it can output a the analysed image marking the pixels with color skin tones with a given color.
Currently Image Nudity Filter can analyze images in the PNG, GIF and JPEG images.
Code (Download class.ImageFilter.php_.zip)
- error_reporting(0);
- require_once(‘class.ImageFilter.php’);
- $arr = array(‘a.jpg’,‘b.jpg’,‘c.jpg’,‘d.jpg’,‘e.jpg’);
- $filter = new ImageFilter();
- foreach ($arr as $a )
- {
- $ab = SITEURL.‘images/’.$a;
- $score = $filter->GetScore($ab);
- echo ‘<img src=”‘.$ab.‘” style=”height:100px; width:100px;”>’;
- if($score > 60)
- { echo “It seems that you have uploaded a nude picture :-(“ ; }
- else{ echo “It seems that you have uploaded a nice picture 🙂 “; }
- echo “<br>”;
- }