ArrayFire: gray2rgb (original) (raw)
Grayscale to RGB colorspace converter. More...
| Functions | |
|---|---|
| AFAPI array | gray2rgb (const array &in, const float rFactor=1.0, const float gFactor=1.0, const float bFactor=1.0) |
| C++ Interface for gray to RGB conversion. More... | |
| AFAPI af_err | af_gray2rgb (af_array *out, const af_array in, const float rFactor, const float gFactor, const float bFactor) |
| C Interface for converting gray to RGB. More... | |
Grayscale to RGB colorspace converter.
Grayscale is a single channel color space where pixel value ranges from 0 to 1. Zero represents black, one represent white and any value between zero & one is a gray value
RGB (Red, Green, Blue) is the most common format used in computer imaging. RGB stores individual values for red, green and blue, and hence the 3 values per pixel. A combination of these three values produces the gamut of unique colors.
The grayscale internsity of a pixel is calculated using the following formula
\f$R = rFactor * intensity\f$
\f$G = gFactor * intensity\f$
\f$B = bFactor * intensity\f$
=======================================================================
◆ af_gray2rgb()
C Interface for converting gray to RGB.
Parameters
| [out] | out | is an array in target color space |
|---|---|---|
| [in] | in | is an array in the Grayscale color space |
| [in] | rFactor | is percentage of intensity value contributing to red channel |
| [in] | gFactor | is percentage of intensity value contributing to green channel |
| [in] | bFactor | is percentage of intensity value contributing to blue channel |
Returns
AF_SUCCESS if the color transformation is successful, otherwise an appropriate error code is returned.
Note
in must be two dimensional for Grayscale to RGB conversion.
| AFAPI array gray2rgb | ( | const array & | in, |
|---|---|---|---|
| const float | rFactor = 1.0, | ||
| const float | gFactor = 1.0, | ||
| const float | bFactor = 1.0 | ||
| ) |
C++ Interface for gray to RGB conversion.
Parameters
| [in] | in | is an array in the Grayscale colorspace |
|---|---|---|
| [in] | rFactor | is percentage of intensity value contributing to red channel |
| [in] | gFactor | is percentage of intensity value contributing to green channel |
| [in] | bFactor | is percentage of intensity value contributing to blue channel |
Returns
array in RGB colorspace
Note
in must be two dimensional for Grayscale to RGB conversion.