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

RGB to LUV color conversion. More...

Functions

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

Detailed Description

RGB to LUV color conversion.

Here is how NPP converts gamma corrected RGB or BGR to CIE LUV using the CIE XYZ D65 white point with a Y luminance of 1.0. The computed values of the L component are in the range [0..100], U component in the range [-134..220], and V component in the range [-140..122]. The code uses cbrtf() the 32 bit floating point cube root 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 to XYZ
* Npp32f nNormalizedR = (Npp32f)R * 0.003921569F; // / 255.0F
* Npp32f nNormalizedG = (Npp32f)G * 0.003921569F;
* Npp32f nNormalizedB = (Npp32f)B * 0.003921569F;
* Npp32f nX = 0.412453F * nNormalizedR + 0.35758F * nNormalizedG + 0.180423F * nNormalizedB;
* Npp32f nY = 0.212671F * nNormalizedR + 0.71516F * nNormalizedG + 0.072169F * nNormalizedB;
* Npp32f nZ = 0.019334F * nNormalizedR + 0.119193F * nNormalizedG + 0.950227F * nNormalizedB;
* // Now calculate LUV from the XYZ value
* Npp32f nTemp = nX + 15.0F * nY + 3.0F * nZ;
* Npp32f nu = 4.0F * nX / nTemp;
* Npp32f nv = 9.0F * nY / nTemp;
* Npp32f nL = 116.0F * cbrtf(nY) - 16.0F;
* if (nL < 0.0F)
* nL = 0.0F;
* if (nL > 100.0F)
* nL = 100.0F;
* nTemp = 13.0F * nL;
* Npp32f nU = nTemp * (nu - nun);
* if (nU < -134.0F)
* nU = -134.0F;
* if (nU > 220.0F)
* nU = 220.0F;
* Npp32f nV = nTemp * (nv - nvn);
* if (nV < -140.0F)
* nV = -140.0F;
* if (nV > 122.0F)
* nV = 122.0F;
* L = (Npp8u)(nL * 255.0F * 0.01F); // / 100.0F
* U = (Npp8u)((nU + 134.0F) * 255.0F * 0.0028249F); // / 354.0F
* V = (Npp8u)((nV + 140.0F) * 255.0F * 0.0038168F); // / 262.0F
*

Function Documentation

NppStatus nppiRGBToLUV_8u_AC4R ( const Npp8u pSrc,
int  nSrcStep,
Npp8u pDst,
int  nDstStep,
NppiSize  oSizeROI 
)
NppStatus nppiRGBToLUV_8u_AC4R_Ctx ( const Npp8u pSrc,
int  nSrcStep,
Npp8u pDst,
int  nDstStep,
NppiSize  oSizeROI,
NppStreamContext  nppStreamCtx 
)

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

3 channel 8-bit unsigned packed RGB to 3 channel 8-bit unsigned packed LUV 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