compare_colour {farver} | R Documentation |
There are many ways to measure the distance between colours. farver
provides 5 different algorithms, ranging from simple euclidean distance in
RGB space, to different perceptual measures such as CIE2000.
compare_colour(from, to = NULL, from_space, to_space = from_space, method = "euclidean", white_from = "D65", white_to = white_from)
from, to |
Numeric matrices with colours to compare - the format is the
same as that for |
from_space, to_space |
The colour space of |
method |
The method to use for comparison. Either |
white_from, white_to |
The white reference of the from and to colour
space. Will only have an effect for relative colour spaces such as Lab and
luv. Any value accepted by |
A numeric matrix with the same number of rows as colours in from
and the same number of columns as colours in to
. If to
is not given, only
the upper triangle will be returned.
r <- t(col2rgb(rainbow(10))) h <- t(col2rgb(heat.colors(15))) # Compare two sets of colours compare_colour(r, h, 'rgb', method = 'cie2000') # Compare a set of colours with itself compare_colour(r, from_space = 'rgb', method = 'cmc')