Learn R Programming

munsellinterpol (version 3.5-1)

NickersonColorDifference: Calculate the Nickerson Color Difference between two Colors

Description

Calculate the Nickerson Color Difference between two colors, given in Munsell HVC; see Nickerson.

Usage

NickersonColorDifference( HVC0, HVC1, symmetric=TRUE, coeffs=c(0.4,6,3) )

Value

A numeric N-vector with the pairwise differences, i.e. between row i of HVC0 and row i of HVC1.

Arguments

HVC0

a numeric Nx3 matrix with HVC values in the rows, or a vector that can be converted to such a matrix, by row. HVC0 can also be a numeric 3-vector with a single HVC, and it is then replicated to match the size of HVC1.
HVC0 can also be a character N-vector with Munsell Notations, which is converted to an Nx3 matrix using HVCfromMunsellName().

HVC1

a numeric Nx3 matrix with HVC values in the rows, or a vector that can be converted to such a matrix, by row. HVC1 can also be a numeric 3-vector with a single HVC, and it is then replicated to match the size of HVC0.
HVC1 can also be a character N-vector with Munsell Notations, which is converted to an Nx3 matrix using HVCfromMunsellName().

symmetric

if FALSE then use the original Nickerson difference formula, and if TRUE then use a symmetrized version; see Details.

coeffs

the coefficients for Hue, Value, and Chroma in the difference equation, see Details. The defaults are the ones used by Nickerson, but tweaking them is possible in special circumstances. The argument must have length 3 and all coefficents positive.

Condition Signaling

For an overview see: Appendix E - Logging and Condition Signaling in the User Guide.

In case of an ERROR event, an error condition is signaled with the additional S3 class "invalid_argument". The invalid argument is added to the condition object.

In the case that not all differences could be computed, a warning condition is signaled with the additional S3 class "incomplete". The condition object also has the indexes of the invalid differences as item indexes.

Author

Jose Gama and Glenn Davis

Details

If HVC0=\(H_0,V_0,C_0\) and If HVC1=\(H_1,V_1,C_1\) then the original Nickerson formula is: $$NCD(\code{HVC0},\code{HVC1}) = 0.4 C_0 \Delta H ~+~ 6 \Delta V ~+~ 3 \Delta C$$ where \( \Delta H = |H_0 - H_1| \) (on the circle), \( \Delta V = |V_0 - V_1| \) and \( \Delta C = |C_0 - C_1| \). Unfortunately, if HVC0 and HVC1 are swapped, the color difference is different. The first color is considered to be the reference color and the second one is the test color. The difference is not symmetric.
Another problem is that the difference is not continuous when the second color is a neutral gray, for rectangular coordinates on a plane of constant V.

Both of these problems are fixed with a slightly modified formula: $$NCD(\code{HVC0},\code{HVC1}) = 0.4 \min(C_0,C_1) \Delta H ~+~ 6 \Delta V ~+~ 3 \Delta C$$

For the first formula set symmetric=FALSE and for the second formula set symmetric=TRUE.

References

Nickerson, Dorothy. The Specification of Color Tolerances. Textile Research. Vol 6. pp. 505-514. 1936.

Examples

Run this code
NickersonColorDifference( '7.6P 8.9/2.2', '8P 8.2/3'  )
##  [1] 6.952

Run the code above in your browser using DataLab