RGB to LUV color conversion.
More...
|
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) |
|
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.
*
* #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)
*
*
*
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;
*
*
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);
* U = (
Npp8u)((nU + 134.0F) * 255.0F * 0.0028249F);
* V = (
Npp8u)((nV + 140.0F) * 255.0F * 0.0038168F);
*