greyscale.avg: Greyscale algorithms

Description Usage Arguments Value Author(s) Examples

View source: R/CVD.R

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

1
greyscale.avg(colorArray)

Arguments

colorArray

array of RGB colors.

Value

colorArray

array of RGB colors converted to greyscale.

Author(s)

Jose Gama

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## 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)

CVD documentation built on May 2, 2019, 1:58 p.m.

Related to greyscale.avg in CVD...