NVIDIA 2D Image And Signal Performance Primitives (NPP)  Version 11.0.1.*
 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
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
nppStreamCtxApplication Managed Stream Context.
Returns
Image Data Related Error Codes, ROI Related Error Codes

Copyright © 2009-2020 NVIDIA Corporation