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

NAME

Color::Similarity::Lab - compute color similarity using the L*a*b* color space

SYNOPSIS

  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 ] );

DESCRIPTION

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.

FUNCTIONS

distance

  my $distance = distance( [ $r1, $g1, $b1 ], [ $r2, $g2, $b2 ] );

Converts the colors to the L*a*b* space and computes their distance.

rgb2lab

  [ $l, $a, $b ] = rgb2lab( $r, $g, $b );

Converts between RGB and L*a*b* color spaces (using Graphics::ColorObject).

distance_lab

  my $distance = distance_lab( [ $l1, $a1, $b1 ], [ $l2, $a2, $b2 ] );

Computes the Euclidean distance between two colors in the L*a*b* color space.

SEE ALSO

Color::Similarity, Color::Similarity::RGB, Color::Similarity::HCL

AUTHOR

Mattia Barbon, <mbarbon@cpan.org>

COPYRIGHT

Copyright (C) 2007, Mattia Barbon

This program is free software; you can redistribute it or modify it under the same terms as Perl itself.