al_color_distance_ciede2000 - Man Page

Allegro 5 API

Synopsis

#include <allegro5/allegro_color.h>

double al_color_distance_ciede2000(ALLEGRO_COLOR color1,
      ALLEGRO_COLOR color2) {

Description

This function computes the CIEDE2000 color difference between two RGB colors. This is a visually uniform color difference, unlike for example the RGB distance.

When using the RGB distance (Euklidean distance between two RGB triplets) there can be color pairs with the same distance, where the colors of one pair appear to be almost the same color, while the colors of the other pair look quite different. This is improved by using the L*a*b* color space which was designed with perceptual uniformity in mind. However it still is not completely uniform. The CIEDE2000 formula contains some additional transformations to fix that.

The returned color distance is roughly in the range 0 (identical color) to 1 (completely different color) - but values greater than one are possible.

Note: This function uses al_color_lab(3) internally which defines the L component to be in the range 0..1 (and not 0..100 as is sometimes seen).

Since

5.2.3

Info

Allegro reference manual