Decolorize algorithm from Mark Grundland and Neil A. Dodgson

Description

decolorize converts a color image to contrast enhanced greyscale algorithm from Mark Grundland and Neil A. Dodgson. The input is an array of RGB values and the output is an array with the greyscale values. decolorizeFile sends the output to a file instead of returning an array

Usage

1
decolorize(fileIN=NULL,effect=0.5,scale=NULL,noise=0.001,recolor=FALSE)

Arguments

fileIN

PNG file

effect

how much the picture's achromatic content should be altered to accommodate the chromatic contrasts

scale

in pixels is the typical size of relevant color contrast features

noise

noise quantile indicates the amount of noise in the picture enabling the dynamic range of the tones to be appropriately scaled

recolor

return also the chromatic content of the picture

Value

colorArray

array of RGB colors converted to contrast enhanced greyscale.

Author(s)

Jose Gama

References

Mark Grundland and Neil A. Dodgson, "Decolorize: Fast, Contrast Enhancing, Color to Grayscale Conversion", Pattern Recognition, vol. 40, no. 11, pp. 2891-2896, (2007). http://www.Eyemaginary.com/Portfolio/Publications.html

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
samplePics <- c('fruits', 'pastel_color', 'sample1', 'TurnColorsGrayImage1', 'TurnColorsGrayImage2')
for (pics in samplePics)
{
fname<-paste(system.file(package='CVD'),'/extdata/fruits.png',sep='')
g1<-decolorize(fname)
png::writePNG(g1$tones, paste(pics, '.decolorize.png',sep=''))
}

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.