Description Usage Arguments Value
We apply the simple algorithm from
http://www.johndcook.com/blog/2009/08/24/algorithms-convert-color-grayscale/
to convert rgb values to gray-scale based on luminosity. Notice that this
function does not care about the range of r
, g
, and b
:
If all of them are in 0..255
, then the output will also be in
[0,255]
(though not necessary integer). If they are in [0,1]
,
the output is also in [0,1]
. As coefficients, we use the values for
BT.709 (http://en.wikipedia.org/wiki/Rec._709).
1 | aitoa.rgb2gray(color, limit = 255L, make.int = (limit > 1L))
|
color |
the r-g-b vector |
limit |
the color limit |
make.int |
should we convert the result to an integer? |
the scalar gray scale value.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.