colorspace: Color Space Conversion

colorspaceR Documentation

Color Space Conversion

Description

Color space conversion functions for RGB, YUV, YIQ, XYZ, and HSI.

Usage

rgb2grey(obj, compress=TRUE)
rgb2hsi(obj)
hsi2rgb(obj, cspace = "Adobe", compress=TRUE)
rgb2yuv(obj)
yuv2rgb(obj, cspace = "Adobe", compress=TRUE)
rgb2yiq(obj)
yiq2rgb(obj, cspace = "Adobe", compress=TRUE)
rgb2xyz(obj)
xyz2rgb(obj, cspace = "Adobe", black= 0, exposure=1, compress=TRUE)

Arguments

obj

an object of class "adimpro", obj$type should coincide with the first three letters of the function name, that is obj$img containes color values in the corresponding color space.

cspace

Target color space, one of c("sRGB","Adobe","wGamut","kodak","xyz"). For function xyz2rgb also c("yuv","yiq") are implemented.

exposure

Multiplicative factor for all color channels (in xyz or rgb spaces). Applied in linear color space, i.e. if the image is gamma corrected the gamma correction is reversed first.

black

Adjustment for black color. Color values with luminance <= black will be assigned to black in RGB.

compress

logical, determines if image data are returned in raw-format.

Details

The functions convert an image obj from one color space into another.

rgb2grey converts from RGB to GREYSCALE.

rgb2hsi and hsi2rgb convert from RGB to HSI and vice versa.

rgb2yuv and yuv2rgb convert from RGB to YUV and vice versa.

rgb2yiq and yiq2rgb convert from RGB to YIQ and vice versa.

rgb2xyz and xyz2rgb convert from RGB to CIE XYZ and vice versa.

Conversion to XYZ, YIQ, YUV and HSI involves an inverse gamma correction if required.

Value

an object of class "adimpro", with value$type specifying the color space (last three letters of the function name or 'greyscale' for rgb2grey) and value$img containing the color values.

Author(s)

Karsten Tabelow tabelow@wias-berlin.de and Joerg Polzehl polzehl@wias-berlin.de

References

Gonzalez, R.C., and Woods, R.E. (2002). Digital Image Processing. Prentice Hall.

Polzehl, J., and Tabelow, K. (2007). Adaptive smoothing of digital images, Journal of Statistical Software 19 (1).

Examples

## Not run: demo(color)

adimpro documentation built on Sept. 30, 2024, 9:17 a.m.

Related to colorspace in adimpro...