TransFromRgb (Operator)

Name

TransFromRgb — Transform an image from the RGB color space to an arbitrary color space.

Signature

void TransFromRgb(const HObject& ImageRed, const HObject& ImageGreen, const HObject& ImageBlue, HObject* ImageResult1, HObject* ImageResult2, HObject* ImageResult3, const HTuple& ColorSpace)

HImage HImage::TransFromRgb(const HImage& ImageGreen, const HImage& ImageBlue, HImage* ImageResult2, HImage* ImageResult3, const HString& ColorSpace) const

HImage HImage::TransFromRgb(const HImage& ImageGreen, const HImage& ImageBlue, HImage* ImageResult2, HImage* ImageResult3, const char* ColorSpace) const

Description

TransFromRgb transforms an image from the RGB color space to an arbitrary color space (ColorSpace). The three channels of the image are passed as three separate images on input and output.

The operator TransFromRgb supports the image types byte, uint2, int4, and real. In the case of int4 images, the images should not contain negative values. In the case of real images, all values should lay within 0 and 1. If not, the results of the transformation may not be reasonable.

Certain scalings are performed accordingly to the image type:

Considering byte and uint2 images, the domain of color space values is generally mapped to the full domain of [0..255] or [0..65535], respectively. Because of this, the origin of signed values (e.g., CIELab) may not be at the center of the domain.

Hue values are represented by angles of [0..2PI[ and are coded for the particular image types differently:

byte-images map the angle domain to [0..255].

uint2/int4-images are coded in minutes of arc [0..21600[, except for the transformations "cielchab" and "cielchuv" for int4-images, where they are coded in seconds of arc [0..1296000[.

real-images are coded in radians [0..2PI[, except for the transformations "cielchab" and "cielchuv", where the standards ISO 11664-4:2008 and ISO 11664-5:2009 require the hue to be specified in degrees.

Saturation values are represented by percentages of [0..100] and are coded differently for the particular image type:

byte-images map the saturation values to [0..255].

uint2/int4-images map the saturation values to [0..10000].

real-images map the saturation values to [0..1].

The following transformations are supported:

(All range of values are based on RGB values scaled to [0; 1]. To obtain the range of values for a certain image type, they must be multiplied with the maximum of the image type, e.g., 255 in the case of a byte image)

TransFromRgb (Operator)