grayscale | R Documentation |
This function converts from RGB images to grayscale
grayscale(im, method = "Luma", drop = TRUE)
im |
an RGB image |
method |
either "Luma", in which case a linear approximation to luminance is used, or "XYZ", in which case the image is assumed to be in sRGB color space and CIE luminance is used. |
drop |
if TRUE returns an image with a single channel, otherwise keep the three channels (default TRUE) |
a grayscale image (spectrum == 1)
grayscale(boats) %>% plot
#In many pictures, the difference between Luma and XYZ conversion is subtle
grayscale(boats,method="XYZ") %>% plot
grayscale(boats,method="XYZ",drop=FALSE) %>% dim
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.