NVIDIA 2D Image And Signal Performance Primitives (NPP)  Version 11.3.0.*
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Functions

Lab to BGR color conversion. More...

Functions

NppStatus  nppiLabToBGR_8u_C3R_Ctx (const Npp8u *pSrc, int nSrcStep, Npp8u *pDst, int nDstStep, NppiSize oSizeROI, NppStreamContext nppStreamCtx)
  3 channel 8-bit unsigned packed Lab to 3 channel 8-bit unsigned packed BGR color conversion. More...
 
NppStatus  nppiLabToBGR_8u_C3R (const Npp8u *pSrc, int nSrcStep, Npp8u *pDst, int nDstStep, NppiSize oSizeROI)
 

Detailed Description

Lab to BGR color conversion.

This is how NPP converts Lab to gamma corrected BGR or RGB using the CIE Lab D65 white point with a Y luminance of 1.0. The code uses powf() the 32 bit floating point power math function.

* // use CIE Lab chromaticity coordinates
* #define nCIE_LAB_D65_xn 0.950455F
* #define nCIE_LAB_D65_yn 1.0F
* #define nCIE_LAB_D65_zn 1.088753F
* // First convert Lab back to original range then to CIE XYZ
* Npp32f nL = (Npp32f)L * 100.0F * 0.003921569F; // / 255.0F
* Npp32f nA = (Npp32f)a - 128.0F;
* Npp32f nB = (Npp32f)b - 128.0F;
* Npp32f nP = (nL + 16.0F) * 0.008621F; // / 116.0F
* Npp32f nNormalizedY = nP * nP * nP; // powf(nP, 3.0F);
* Npp32f nNormalizedX = nCIE_LAB_D65_xn * powf((nP + nA * 0.002F), 3.0F); // / 500.0F
* Npp32f nNormalizedZ = nCIE_LAB_D65_zn * powf((nP - nB * 0.005F), 3.0F); // / 200.0F
* Npp32f nR = 3.240479F * nNormalizedX - 1.53715F * nNormalizedY - 0.498535F * nNormalizedZ;
* if (nR > 1.0F)
* nR = 1.0F;
* Npp32f nG = -0.969256F * nNormalizedX + 1.875991F * nNormalizedY + 0.041556F * nNormalizedZ;
* if (nG > 1.0F)
* nG = 1.0F;
* nB = 0.055648F * nNormalizedX - 0.204043F * nNormalizedY + 1.057311F * nNormalizedZ;
* if (nB > 1.0F)
* nB = 1.0F;
* R = (Npp8u)(nR * 255.0F);
* G = (Npp8u)(nG * 255.0F);
* B = (Npp8u)(nB * 255.0F);
*

Function Documentation

NppStatus nppiLabToBGR_8u_C3R ( const Npp8u pSrc,
int  nSrcStep,
Npp8u pDst,
int  nDstStep,
NppiSize  oSizeROI 
)
NppStatus nppiLabToBGR_8u_C3R_Ctx ( const Npp8u pSrc,
int  nSrcStep,
Npp8u pDst,
int  nDstStep,
NppiSize  oSizeROI,
NppStreamContext  nppStreamCtx 
)

3 channel 8-bit unsigned packed Lab to 3 channel 8-bit unsigned packed BGR color conversion.

Parameters
pSrc Source-Image Pointer.
nSrcStep Source-Image Line Step.
pDst Destination-Image Pointer.
nDstStep Destination-Image Line Step.
oSizeROI Region-of-Interest (ROI).
nppStreamCtx Application Managed Stream Context.
Returns
Image Data Related Error Codes, ROI Related Error Codes