Distance - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


ColorTools

  

Distance

  

compute the distance between two colors

 

Calling Sequence

Parameters

Options

Description

Examples

References

Compatibility

Calling Sequence

Distance(color1, color2, opts)

Parameters

color1, color2

-

colors in formats recognized by ColorTools

opts

-

(optional) equation(s) of the form option=value where option is one of metric or raw

Options

• 

metric : name or string. The names accepted are default, cie76, cie94 (the default), cie00, or cmc.  Any of these names can be indexed with a type and severity of color vision deficiency (see below). The strings accepted are the names of color spaces listed at ColorTools/ColorSpaces.

• 

raw : if this option is given, the metric is not normalized

Description

• 

The Distance command computes the distance between two colors using one of several standard color metrics.  The metric can be chosen by passing a name to the metric option. The cie94, cie00, and cmc metrics are not commutative. For these metrics, color1 is the reference color and color2 is the sample color. In these metrics a distances of less than 0.01 mean the two colors are generally not visually distinguishable.

• 

If the metric option is passed a string, then the metric used is the Euclidean distance in the color space represented by that string.

• 

All metrics are normalized so that the distance between white and black is equal to 1 unless the raw option is given.

• 

The named metrics can be indexed to compute the distance between two colors as seen by a viewer with various types of color vision deficiency. For example cie94["deuteranopia"] would compute the cie94 distance assuming the viewer has the most common type of red-green color blindness. A severity between 0 and 100 may also be included, so default["tritanopia", 50] would indicate a viewer with a mild version of the rare blue-yellow color blindness and compute the distance using the default metric. See ColorTools:-CVDSimulation for all supported color deficiencies supported.

Examples

withColorTools:

DistanceRed,#e00

0.0364394971346559

(1)

Distance#fe0000,#ff0000,metric=RGB

0.002264119494

(2)

Distance0.99,0.,0.,1.,0.,0.,metric=RGB,raw

0.01000000000

(3)

References

  

Wikipedia, Color Difference, http://wikipedia.org/wiki/Color_difference

Compatibility

• 

The ColorTools[Distance] command was introduced in Maple 16.

• 

For more information on Maple 16 changes, see Updates in Maple 16.

See Also

ColorTools

ColorTools/ColorSpaces

ColorTools/CVDSimulation

ColorTools[Color]