Convert from Lab to BGR
MT
FwStatus | fwiLabToBGR_8u_C3R | ( | const Fw8u * pSrc, int srcStep, Fw8u * pDst, int dstStep, FwiSize roiSize ); | |
FwStatus | fwiLabToBGR_16u8u_C3R | ( | const Fw16u * pSrc, int srcStep, Fw8u * pDst, int dstStep, FwiSize roiSize ); |
dstStep | Destination buffer step size (width of the buffer in bytes). | |
pDst | Pointer to a location in a destination buffer. | |
pSrc | Pointer to a location in a source buffer. | |
roiSize | Specifies the height and width of an ROI. | |
srcStep | Source buffer step size (width of the buffer in bytes). |
These functions step through an ROI in a source buffer, convert the source data from the Lab color space to the BGR color model, and write the converted data to a destination buffer.
A CIE Lab image (pSrc) declared in the ROI is converted to a gamma-corrected RGB image (pDst) in two steps.
1. Transform the data to the correct range as follows. 8U data type: L = L * 100 / 255 a = a - 128 b = b - 128 16u data type: L = L * 100 / 65535 a = a / 255 - 128 b = b / 255 - 128 Convert to XYZ: Y = Yn *p^3 X = Xn * (P + a/500)^3 Z = Zn * (P - b/200)^2 where P = (L+16)/116 D65 white point: Xn = 0.950455 Yn = 1.0 Zn = 1.088753 2. Convert( ) XYZ to BGR using the following formulas: X = 3.240479*X - 1.53715 *Y - 0.498535*Z Y = -0.969256*X + 1.875991*Y + 0.041556*Z Z = 0.055648*X - 0.204043*Y + 1.057311*Z The formulas assume that X, Y, and Z values are normalized to [0 to 1] for integer data types. For floating point data types, the data must already be in the range [0 to 1]. For integer data types, the converted image data is saturated to [0 to 1] and scaled to the data type range. For floating point data type, data is saturated to [0 to 1].