Imager::SkinDetector - The great new Imager::SkinDetector!
Version 0.01
use Imager::SkinDetector; my $name = 'mypic.png'; my $image = Imager::SkinDetector->new(file => $name) or die "Can't load image [$name]\n"; my $skinniness = $image->skinniness(); printf "Image is %3.2f%% skinny\n", $skinniness * 100;
Have you ever needed to know if an image has some amount of skin tone color? Did you find some tool to do it? Free software? Yes? If so, please tell me right now!
If not, welcome to Imager-SkinDetector. It uses Imager as processing engine, so it should have a decent speed. Don't expect miracles, though.
I'm planning to use this as part of a set of tools to automatically classify images as nudity or "containing skin". It's only a plan. I might succeed one day. Most probably I won't. :-)
Feel free to provide feedback and code.
is_skin($color)
Examines an Imager::Color object and tells you if it seems to be similar to skin color.
Imager::Color
The algorithm is as stupid as you can get. No less. And it only detects "white" skin colors for now. Sorry.
Example:
my $color = Imager::Color->new(0, 255, 255); if (Imager::SkinDetector::is_color($color)) { print 'Yes, it seems to be skinny'; } else { print 'Mmhhh, probably not'; }
rgb2hsv(@rgb)
Converts an RGB triplet into HSV, returned as a list of values. H is hue, 0 to 360. S is saturation, 0 to 1. V is value, 0 to 255.
H
S
V
my @rgb = (255, 0, 0); my @hsv = Imager::SkinDetector::rgb2hsv(@rgb);
skinniness()
Returns a real value from 0 to 1, indicating how much skin tone color is present in the given picture. A return value of zero means no skin tone colors. A return value of one means a picture that contains only skin colors.
# You might not be able to load '.png' pictures, # depending on your version of Imager and OS my $pic = 'coolpic.png'; my $img = Imager::SkinDetector->new(file => $pic); my $skin = $img->skinniness(); # $skin = 0.21313 -> 21.3% of skin colors
Cosimo Streppone, <cosimo at cpan.org>
<cosimo at cpan.org>
Please report any bugs or feature requests to bug-imager-skindetector at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Imager-SkinDetector. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-imager-skindetector at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Imager::SkinDetector
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Imager-SkinDetector
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Imager-SkinDetector
CPAN Ratings
http://cpanratings.perl.org/d/Imager-SkinDetector
Search CPAN
http://search.cpan.org/dist/Imager-SkinDetector
Copyright 2008 Cosimo Streppone, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Imager::SkinDetector, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Imager::SkinDetector
CPAN shell
perl -MCPAN -e shell install Imager::SkinDetector
For more information on module installation, please visit the detailed CPAN module installation guide.