DeltaE  R Documentation 
Calculate Standard CIE Color Differences between two Colors
DeltaE( Lab1, Lab2, metric=1976 )
Lab1 
a numeric Nx3 matrix with Lab values in the rows, or a vector that can be converted to such a matrix, by row.

Lab2 
a numeric Nx3 matrix with Lab values in the rows, or a vector that can be converted to such a matrix, by row.

metric 
a vector of color metric specifiers.
Valid values are 
DeltaE()
returns a numeric vector of length N, or an NxM matrix.
It returns a matrix iff length(metric)=
M≥ 2;
the column names are set to the metric names.
The elements of the output are the pairwise differences,
i.e. between row i of Lab1
and row i of Lab2
.
The names or rownames are set to the rownames of one of the input matrices.
For metric=1976
the distance is simply the Euclidean distance between the two points in Lab, see Hunt p. 111.
For metric=1994
the symmetric variant is used, see Hunt p. 670.
There is an asymmetric variant which is not available in this package.
The weighting coefficients are for graphic arts (not for textiles).
For metric=2000
the distance is insanely complicated, see Hunt p. 671.
All these metrics are symmetric,
which means that swapping Lab1
and Lab2
does not change the result.
Hunt, R. W. G. The Reproduction of Colour. 6th Edition. John Wiley & Sons. 2004.
DeltaE( c(50,0,0), c(51,2,2, 52,10,11, 46,13,16) ) ## [1] 3 15 21 path = system.file( "extdata/ciede2000testdata.txt", package='spacesXYZ' ) df = read.table( path, sep='\t', quote='', head=TRUE ) Lab1 = as.matrix( df[ , 1:3 ] ) Lab2 = as.matrix( df[ , 4:6 ] ) cbind( Lab1, Lab2, DeltaE( Lab1, Lab2, metric=c(1976,2000) ) )[ 1:10, ] ## LAB_L_REF LAB_A_REF LAB_B_REF LAB_L_SAM LAB_A_SAM LAB_B_SAM DeltaE.1976 DeltaE.2000 ## [1,] 50.0000 2.6772 79.7751 50.0000 0.0000 82.7485 4.0010633 2.0424597 ## [2,] 50.0000 3.1571 77.2803 50.0000 0.0000 82.7485 6.3141501 2.8615102 ## [3,] 50.0000 2.8361 74.0200 50.0000 0.0000 82.7485 9.1776999 3.4411906 ## [4,] 50.0000 1.3802 84.2814 50.0000 0.0000 82.7485 2.0627008 0.9999989 ## [5,] 50.0000 1.1848 84.8006 50.0000 0.0000 82.7485 2.3695707 1.0000047 ## [6,] 50.0000 0.9009 85.5211 50.0000 0.0000 82.7485 2.9152927 1.0000130 ## [7,] 50.0000 0.0000 0.0000 50.0000 1.0000 2.0000 2.2360680 2.3668588 ## [8,] 50.0000 1.0000 2.0000 50.0000 0.0000 0.0000 2.2360680 2.3668588 ## [9,] 50.0000 2.4900 0.0010 50.0000 2.4900 0.0009 4.9800004 7.1791720 ## [10,] 50.0000 2.4900 0.0010 50.0000 2.4900 0.0010 4.9800004 7.1791626
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.