NVIDIA 2D Image And Signal Performance Primitives (NPP)  Version 11.1.0.*

HSV to RGB color conversion. More...

Functions

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)

Detailed Description

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.

* Npp32f nNormalizedH = (Npp32f)H * 0.003921569F; // / 255.0F
* Npp32f nNormalizedS = (Npp32f)S * 0.003921569F;
* Npp32f nNormalizedV = (Npp32f)V * 0.003921569F;
* Npp32f nR;
* Npp32f nG;
* Npp32f nB;
* if (nNormalizedS == 0.0F)
* {
* nR = nG = nB = nNormalizedV;
* }
* else
* {
* if (nNormalizedH == 1.0F)
* nNormalizedH = 0.0F;
* else
* nNormalizedH = nNormalizedH * 6.0F; // / 0.1667F
* }
* 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);
*

Function Documentation

 NppStatus nppiHSVToRGB_8u_AC4R ( 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.

Parameters
 pSrc Source-Image Pointer. nSrcStep Source-Image Line Step. pDst Destination-Image Pointer. nDstStep Destination-Image Line Step. oSizeROI Region-of-Interest (ROI). nppStreamCtx Application Managed Stream Context.
Returns
Image Data Related Error Codes, ROI Related Error Codes
 NppStatus nppiHSVToRGB_8u_C3R ( const Npp8u * pSrc, int nSrcStep, Npp8u * pDst, int nDstStep, NppiSize oSizeROI )
 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.

Parameters
 pSrc Source-Image Pointer. nSrcStep Source-Image Line Step. pDst Destination-Image Pointer. nDstStep Destination-Image Line Step. oSizeROI Region-of-Interest (ROI). nppStreamCtx Application Managed Stream Context.
Returns
Image Data Related Error Codes, ROI Related Error Codes