LUV to RGB color conversion.
More...
|
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) |
|
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.
*
* #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 nu = nU / nTemp + nun;
*
Npp32f nv = nV / nTemp + nvn;
* if (nL > 7.9996248F)
* {
* nNormalizedY = (nL + 16.0F) * 0.008621F;
* nNormalizedY = powf(nNormalizedY, 3.0F);
* }
* else
* {
* nNormalizedY = nL * 0.001107F;
* }
*
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);
*