HSV to RGB color conversion.
More...
|
NppStatus |
nppiHSVToRGB_8u_C3R_Ctx (const Npp8u *pSrc, int nSrcStep, Npp8u *pDst, int nDstStep, NppiSize oSizeROI, NppStreamContext nppStreamCtx) |
|
3 channel 8-bit unsigned packed HSV to 3 channel 8-bit unsigned packed RGB color conversion. More...
|
|
NppStatus |
nppiHSVToRGB_8u_C3R (const Npp8u *pSrc, int nSrcStep, Npp8u *pDst, int nDstStep, NppiSize oSizeROI) |
|
NppStatus |
nppiHSVToRGB_8u_AC4R_Ctx (const Npp8u *pSrc, int nSrcStep, Npp8u *pDst, int nDstStep, NppiSize oSizeROI, NppStreamContext nppStreamCtx) |
|
4 channel 8-bit unsigned packed HSV with alpha to 4 channel 8-bit unsigned packed RGB with alpha color conversion. More...
|
|
NppStatus |
nppiHSVToRGB_8u_AC4R (const Npp8u *pSrc, int nSrcStep, Npp8u *pDst, int nDstStep, NppiSize oSizeROI) |
|
HSV to RGB color conversion.
This is how NPP converts HSV to gamma corrected RGB or BGR. This code uses the floorf() 32 bit floating point math function.
* if (nNormalizedS == 0.0F)
* {
* nR = nG = nB = nNormalizedV;
* }
* else
* {
* if (nNormalizedH == 1.0F)
* nNormalizedH = 0.0F;
* else
* nNormalizedH = nNormalizedH * 6.0F;
* }
*
Npp32f nI = floorf(nNormalizedH);
*
Npp32f nF = nNormalizedH - nI;
*
Npp32f nM = nNormalizedV * (1.0F - nNormalizedS);
*
Npp32f nN = nNormalizedV * (1.0F - nNormalizedS * nF);
*
Npp32f nK = nNormalizedV * (1.0F - nNormalizedS * (1.0F - nF));
* if (nI == 0.0F)
* { nR = nNormalizedV; nG = nK; nB = nM; }
* else if (nI == 1.0F)
* { nR = nN; nG = nNormalizedV; nB = nM; }
* else if (nI == 2.0F)
* { nR = nM; nG = nNormalizedV; nB = nK; }
* else if (nI == 3.0F)
* { nR = nM; nG = nN; nB = nNormalizedV; }
* else if (nI == 4.0F)
* { nR = nK; nG = nM; nB = nNormalizedV; }
* else if (nI == 5.0F)
* { nR = nNormalizedV; nG = nM; nB = nN; }
* R = (
Npp8u)(nR * 255.0F);
* G = (
Npp8u)(nG * 255.0F);
* B = (
Npp8u)(nB * 255.0F);
*