Image::DominantColors - Find dominant colors in an image with k-means clustering.
Version 0.01
This module does just one simple thing. It scans an image and clusters colors with the k-means clustering algorithm to give you the most dominant colors in that image.
Here is a live demo : http://www.tryperl.com/dominantcolors/
This is how it works, I would advise leaving the clusters to a default 3 which works best with images.:
use Image::DominantColors; use Data::Dumper; my $dmt = Image::DominantColors->new({file => 'some_path/img.jpg', clusters => 4}); #OR three clusters is default my $dmt = Image::DominantColors->new({file => 'some_path/img.jpg'}); my $r = $dmt->getDominantColors(); print Dumper($r); #This outputs the following: # [ # { # 'r' => 31, # 'b' => 23, # 'g' => 15 # }, # { # 'r' => 193, # 'b' => 41, # 'g' => 84 # }, # { # 'r' => 114, # 'b' => 136, # 'g' => 128 # }, # { # 'r' => 61, # 'b' => 82, # 'g' => 66 # } # ]; ...
A list of functions that can be exported. You can delete this section if you don't export anything, such as for a purely object-oriented module.
This is the only user function the module contains. it returns an array of hashes as in the synopsis.
Gideon Israel Dsouza, <gideon at cpan.org>
<gideon at cpan.org>
Please report any bugs or feature requests to bug-image-dominantcolors at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Image-DominantColors. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-image-dominantcolors at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Image::DominantColors
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Image-DominantColors
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Image-DominantColors
CPAN Ratings
http://cpanratings.perl.org/d/Image-DominantColors
Search CPAN
http://search.cpan.org/dist/Image-DominantColors/
Copyright 2013 Gideon Israel Dsouza.
This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:
http://www.perlfoundation.org/artistic_license_2_0
To install Image::DominantColors, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Image::DominantColors
CPAN shell
perl -MCPAN -e shell install Image::DominantColors
For more information on module installation, please visit the detailed CPAN module installation guide.