greyscale.avg {CVD}R Documentation

Greyscale algorithms

Description

Common algorithms to convert color images to greyscale. The input is an array of RGB values and the output is an array with the greyscale values. greyscale.avg Greyscale algorithm, convert to average RGB values. greyscale.Y Greyscale algorithm YIQ/NTSC - RGB colors in a gamma 2.2 color space. greyscale.linear Greyscale algorithm linear RGB colors greyscale.RMY Greyscale algorithm RMY greyscale.BT709 Greyscale algorithm BT709 greyscale.luminosity Greyscale algorithm using luminosity

Usage

greyscale.avg(colorArray)

Arguments

colorArray

array of RGB colors.

Value

colorArray

array of RGB colors converted to greyscale.

Author(s)

Jose Gama

Examples

## Not run: 
samplePics <- c('fruits', 'pastel_color', 'sample1', 'TurnColorsGrayImage1', 'TurnColorsGrayImage2')
for (pics in samplePics)
{
fname<-paste(system.file(package='CVD'),'/extdata/',pics,'.png',sep='')
imgTest<-loadPNG(fname)
g1<-greyscale.avg(imgTest)
png::writePNG(g1, paste(pics, '.greyscale.avg.png',sep=''))
}

imgTest<-loadPNG(fname)
g1<-greyscale.avg(imgTest)
png::writePNG(g1, paste(pics, '.greyscale.avg.png',sep=''))
g1<-greyscale.BT709(imgTest)
png::writePNG(g1, paste(pics, '.BT709.png',sep=''))
g1<-greyscale.Linear(imgTest)
png::writePNG(g1, paste(pics, '.Linear.png',sep=''))
g1<-greyscale.Luminosity(imgTest)
png::writePNG(g1, paste(pics, '.Luminosity.png',sep=''))
g1<-greyscale.RMY(imgTest)
png::writePNG(g1, paste(pics, '.RMY.png',sep=''))
g1<-greyscale.Y(imgTest)
png::writePNG(g1, paste(pics, '.Y.png',sep=''))


## End(Not run)

[Package CVD version 1.0.2 Index]