Color::Similarity::HCL - compute color similarity using the HCL color space
use Color::Similarity::HCL qw(distance rgb2hcl distance_hcl); # the greater the distance, more different the colors my $distance = distance( [ $r1, $g1, $b1 ], [ $r2, $g2, $b2 ] );
Computes color similarity using the color space and distance metric defined in the research report:
HCL: a new Color Space for a more Effective Content-based Image Retrieval
M. Sarifuddin <m.sarifuddin@uqo.ca> - Rokia Missaoui <rokia.missaoui@uqo.ca> Département d'informatique et d'ingénierie, Université du Québec en Outaouais C.P. 1250, Succ. B Gatineau Quéebec Canada, J8X 3X7
http://w3.uqo.ca/missaoui/Publications/TRColorSpace.zip
my $distance = distance( [ $r1, $g1, $b1 ], [ $r2, $g2, $b2 ] );
Converts the colors to the HCL space and computes their distance.
[ $h, $c, $l ] = rgb2hcl( $r, $g, $b );
Converts between RGB and HCL color spaces.
my $distance = distance_hcl( [ $h1, $c1, $l1 ], [ $h2, $c2, $l2 ] );
Computes the distance between two colors in the HCL color space.
Corrected the RGB -> HCL transformation (see rgb2hcl) as per the research report by the same authors (thanks to David Hoerl for finding the document with the corrected formula).
rgb2hcl
Color::Similarity, Color::Similarity::RGB, Color::Similarity::Lab
Mattia Barbon, <mbarbon@cpan.org>
<mbarbon@cpan.org>
Copyright (C) 2007, Mattia Barbon
This program is free software; you can redistribute it or modify it under the same terms as Perl itself.
To install Color::Similarity::HCL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Color::Similarity::HCL
CPAN shell
perl -MCPAN -e shell install Color::Similarity::HCL
For more information on module installation, please visit the detailed CPAN module installation guide.