Color::Similarity::Lab - compute color similarity using the L*a*b* color space
use Color::Similarity::Lab qw(distance rgb2lab distance_lab); # the greater the distance, more different the colors my $distance = distance( [ $r1, $g1, $b1 ], [ $r2, $g2, $b2 ] );
Computes color similarity using the L*a*b* color space and Euclidean distance metric.
The RGB -> L*a*b* conversion is just a wrapper around Graphics::ColorObject.
my $distance = distance( [ $r1, $g1, $b1 ], [ $r2, $g2, $b2 ] );
Converts the colors to the L*a*b* space and computes their distance.
[ $l, $a, $b ] = rgb2lab( $r, $g, $b );
Converts between RGB and L*a*b* color spaces (using Graphics::ColorObject).
my $distance = distance_lab( [ $l1, $a1, $b1 ], [ $l2, $a2, $b2 ] );
Computes the Euclidean distance between two colors in the L*a*b* color space.
Color::Similarity, Color::Similarity::RGB, Color::Similarity::HCL
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, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Color::Similarity
CPAN shell
perl -MCPAN -e shell install Color::Similarity
For more information on module installation, please visit the detailed CPAN module installation guide.