The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Imager::SkinDetector - The great new Imager::SkinDetector!

VERSION

Version 0.01

SYNOPSIS

    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;

DESCRIPTION

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.

FUNCTIONS

is_skin($color)

Examines an Imager::Color object and tells you if it seems to be similar to skin 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.

Example:

    my @rgb = (255, 0, 0);
    my @hsv = Imager::SkinDetector::rgb2hsv(@rgb);

METHODS

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.

Example:

    # 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

AUTHOR

Cosimo Streppone, <cosimo at cpan.org>

BUGS

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.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Imager::SkinDetector

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

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.