A high-performance general-purpose compute library

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...
 

Detailed Description

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$

=======================================================================

Function Documentation

◆ af_gray2rgb()

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.

Parameters
[out]outis an array in target color space
[in]inis an array in the Grayscale color space
[in]rFactoris percentage of intensity value contributing to red channel
[in]gFactoris percentage of intensity value contributing to green channel
[in]bFactoris 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.

◆ gray2rgb()

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]inis an array in the Grayscale colorspace
[in]rFactoris percentage of intensity value contributing to red channel
[in]gFactoris percentage of intensity value contributing to green channel
[in]bFactoris percentage of intensity value contributing to blue channel
Returns
array in RGB colorspace
Note
in must be two dimensional for Grayscale to RGB conversion.