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

LUV to RGB color conversion. More...

Functions

NppStatus nppiLUVToRGB_8u_C3R_Ctx (const Npp8u *pSrc, int nSrcStep, Npp8u *pDst, int nDstStep, NppiSize oSizeROI, NppStreamContext nppStreamCtx)
 3 channel 8-bit unsigned packed LUV to 3 channel 8-bit unsigned packed RGB color conversion. More...
 
NppStatus nppiLUVToRGB_8u_C3R (const Npp8u *pSrc, int nSrcStep, Npp8u *pDst, int nDstStep, NppiSize oSizeROI)
 
NppStatus nppiLUVToRGB_8u_AC4R_Ctx (const Npp8u *pSrc, int nSrcStep, Npp8u *pDst, int nDstStep, NppiSize oSizeROI, NppStreamContext nppStreamCtx)
 4 channel 8-bit unsigned packed LUV with alpha to 4 channel 8-bit unsigned packed RGB with alpha color conversion. More...
 
NppStatus nppiLUVToRGB_8u_AC4R (const Npp8u *pSrc, int nSrcStep, Npp8u *pDst, int nDstStep, NppiSize oSizeROI)
 

Detailed Description

LUV to RGB color conversion.

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

* // use CIE D65 chromaticity coordinates
* #define nCIE_XYZ_D65_xn 0.312713F
* #define nCIE_XYZ_D65_yn 0.329016F
* #define nn_DIVISOR (-2.0F * nCIE_XYZ_D65_xn + 12.0F * nCIE_XYZ_D65_yn + 3.0F)
* #define nun (4.0F * nCIE_XYZ_D65_xn / nn_DIVISOR)
* #define nvn (9.0F * nCIE_XYZ_D65_yn / nn_DIVISOR)
*
* // First convert normalized LUV back to original CIE LUV range
* Npp32f nL = (Npp32f)L * 100.0F * 0.003921569F; // / 255.0F
* Npp32f nU = ((Npp32f)U * 354.0F * 0.003921569F) - 134.0F;
* Npp32f nV = ((Npp32f)V * 262.0F * 0.003921569F) - 140.0F;
* // Now convert LUV to CIE XYZ
* Npp32f nTemp = 13.0F * nL;
* Npp32f nu = nU / nTemp + nun;
* Npp32f nv = nV / nTemp + nvn;
* Npp32f nNormalizedY;
* if (nL > 7.9996248F)
* {
* nNormalizedY = (nL + 16.0F) * 0.008621F; // / 116.0F
* nNormalizedY = powf(nNormalizedY, 3.0F);
* }
* else
* {
* nNormalizedY = nL * 0.001107F; // / 903.3F
* }
* Npp32f nNormalizedX = (-9.0F * nNormalizedY * nu) / ((nu - 4.0F) * nv - nu * nv);
* Npp32f nNormalizedZ = (9.0F * nNormalizedY - 15.0F * nv * nNormalizedY - nv * nNormalizedX) / (3.0F * nv);
* Npp32f nR = 3.240479F * nNormalizedX - 1.53715F * nNormalizedY - 0.498535F * nNormalizedZ;
* if (nR > 1.0F)
* nR = 1.0F;
* if (nR < 0.0F)
* nR = 0.0F;
* Npp32f nG = -0.969256F * nNormalizedX + 1.875991F * nNormalizedY + 0.041556F * nNormalizedZ;
* if (nG > 1.0F)
* nG = 1.0F;
* if (nG < 0.0F)
* nG = 0.0F;
* Npp32f nB = 0.055648F * nNormalizedX - 0.204043F * nNormalizedY + 1.057311F * nNormalizedZ;
* if (nB > 1.0F)
* nB = 1.0F;
* if (nB < 0.0F)
* nB = 0.0F;
* R = (Npp8u)(nR * 255.0F);
* G = (Npp8u)(nG * 255.0F);
* B = (Npp8u)(nB * 255.0F);
*

Function Documentation

NppStatus nppiLUVToRGB_8u_AC4R ( const Npp8u pSrc,
int  nSrcStep,
Npp8u pDst,
int  nDstStep,
NppiSize  oSizeROI 
)
NppStatus nppiLUVToRGB_8u_AC4R_Ctx ( const Npp8u pSrc,
int  nSrcStep,
Npp8u pDst,
int  nDstStep,
NppiSize  oSizeROI,
NppStreamContext  nppStreamCtx 
)

4 channel 8-bit unsigned packed LUV with alpha to 4 channel 8-bit unsigned packed RGB with alpha 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
NppStatus nppiLUVToRGB_8u_C3R ( const Npp8u pSrc,
int  nSrcStep,
Npp8u pDst,
int  nDstStep,
NppiSize  oSizeROI 
)
NppStatus nppiLUVToRGB_8u_C3R_Ctx ( const Npp8u pSrc,
int  nSrcStep,
Npp8u pDst,
int  nDstStep,
NppiSize  oSizeROI,
NppStreamContext  nppStreamCtx 
)

3 channel 8-bit unsigned packed LUV to 3 channel 8-bit unsigned packed RGB 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-2022 NVIDIA CORPORATION AND AFFILIATES