EVOLUTION-MANAGER
Edit File: compare_colour.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Calculate the distance between colours</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for compare_colour {farver}"><tr><td>compare_colour {farver}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Calculate the distance between colours</h2> <h3>Description</h3> <p>There are many ways to measure the distance between colours. <code>farver</code> provides 5 different algorithms, ranging from simple euclidean distance in RGB space, to different perceptual measures such as CIE2000. </p> <h3>Usage</h3> <pre> compare_colour( from, to = NULL, from_space, to_space = from_space, method = "euclidean", white_from = "D65", white_to = white_from ) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>from, to</code></td> <td> <p>Numeric matrices with colours to compare - the format is the same as that for <code><a href="convert_colour.html">convert_colour()</a></code>. If <code>to</code> is not set <code>from</code> will be compared with itself and only the upper triangle will get calculated</p> </td></tr> <tr valign="top"><td><code>from_space, to_space</code></td> <td> <p>The colour space of <code>from</code> and <code>to</code> respectively. <code>to_space</code> defaults to be the same as <code>from_space</code>.</p> </td></tr> <tr valign="top"><td><code>method</code></td> <td> <p>The method to use for comparison. Either <code>'euclidean'</code>, <code>'cie1976'</code>, <code>'cie94'</code>, <code>'cie2000'</code>, or <code>'cmc'</code></p> </td></tr> <tr valign="top"><td><code>white_from, white_to</code></td> <td> <p>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 <code><a href="as_white_ref.html">as_white_ref()</a></code> allowed.</p> </td></tr> </table> <h3>Value</h3> <p>A numeric matrix with the same number of rows as colours in <code>from</code> and the same number of columns as colours in <code>to</code>. If <code>to</code> is not given, only the upper triangle will be returned. </p> <h3>Handling of non-finite and out of bounds values</h3> <p><code>NA</code>, <code>NaN</code>, <code>-Inf</code>, and <code>Inf</code> are treated as invalid input and will result in <code>NA</code> values for the colour. If a given colourspace has finite bounds in some of their channels, the input will be capped before conversion, and the output will be capped before returning, so that both input and output colours are valid colours in their respective space. This means that converting back and forth between two colourspaces may result in a change in the colour if the gamut of one of the spaces is less than the other. </p> <h3>Examples</h3> <pre> r <- decode_colour(rainbow(10)) h <- decode_colour(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') # Compare colours from different colour spaces h_luv <- convert_colour(h, 'rgb', 'luv') compare_colour(r, h_luv, 'rgb', 'luv') </pre> <hr /><div style="text-align: center;">[Package <em>farver</em> version 2.0.3 <a href="00Index.html">Index</a>]</div> </body></html>