ColorDistance

ColorDistance[c1,c2]

gives the approximate perceptual distance between color directives c1 and c2.

ColorDistance[list,c]

gives color distances between elements of list and c.

ColorDistance[list1,list2]

gives color distances between corresponding elements of list1 and list2.

ColorDistance[image,c]

gives an image whose pixel values are color distance between pixels in image and the color c.

ColorDistance[image1,image2]

yields an image giving the pixelwise color distance between image1 and image2.

Details and Options

  • The distance between two colors is computed as the Euclidean distance between the two color vectors in the LABColor space.
  • In the computation of the color distance, the alpha channel is ignored.
  • ColorDistance works with arbitrary 2D and 3D images.
  • With ColorDistance[image,], color distances are returned as an image of a real type with the same dimensions as image.
  • With ColorDistance[image1,image2], image1 and image2 are center aligned, and an image of color distances for the overlapping pixels is returned.
  • ColorDistance supports a DistanceFunction option. The following settings are available:
  • "CIE76"Euclidean distance in LABColor (default)
    "CIE94"color difference defined in LCHColor
    "CIE2000"CIE94 with some corrections
    {"CMC",{l,c}}Color Measurement Committee metric with lightness l and chroma c
    "DeltaL"luminance difference in LCHColor
    "DeltaC"chroma difference in LCHColor
    "DeltaH"hue-based difference in LCHColor
    ffunction f that is given two lists of Lab values
  • With the "CMC" metric, commonly used parameters are for perceptibility and for acceptability. If not specified, is used.

Examples

open allclose all

Basic Examples  (2)

Distance between two colors:

In[1]:=
Click for copyable input
Out[1]=

Distance between a color and each pixel of an image:

In[1]:=
Click for copyable input
Out[1]=

Scope  (5)

Options  (8)

Applications  (6)

Properties & Relations  (8)

Neat Examples  (1)

See Also

LABColor  RGBColor  LUVColor  XYZColor  CMYKColor  Hue  ImageDistance  DominantColors  MinColorDistance  EuclideanDistance  Nearest  CentralFeature

Introduced in 2014
(10.0)
| Updated in 2015
(10.2)