HLSToRGB
Color Model Conversion

HLS to RGB color conversion. More...

## Functions

NppStatus | nppiHLSToRGB_8u_C3R_Ctx (const Npp8u *pSrc, int nSrcStep, Npp8u *pDst, int nDstStep, NppiSize oSizeROI, NppStreamContext nppStreamCtx)
| 3 channel 8-bit unsigned packed HLS to 3 channel 8-bit unsigned packed RGB color conversion. More...
NppStatus | nppiHLSToRGB_8u_C3R (const Npp8u *pSrc, int nSrcStep, Npp8u *pDst, int nDstStep, NppiSize oSizeROI)
NppStatus | nppiHLSToRGB_8u_AC4R_Ctx (const Npp8u *pSrc, int nSrcStep, Npp8u *pDst, int nDstStep, NppiSize oSizeROI, NppStreamContext nppStreamCtx)
| 4 channel 8-bit unsigned packed HLS with alpha to 4 channel 8-bit unsigned packed RGB with alpha color conversion. More...
NppStatus | nppiHLSToRGB_8u_AC4R (const Npp8u *pSrc, int nSrcStep, Npp8u *pDst, int nDstStep, NppiSize oSizeROI)

## Detailed Description

HLS to RGB color conversion.

This is how NPP converts HLS to gamma corrected RGB or BGR.

* Npp32f nNormalizedH = (Npp32f)H * 0.003921569F; // / 255.0F
* Npp32f nNormalizedL = (Npp32f)L * 0.003921569F;
* Npp32f nNormalizedS = (Npp32f)S * 0.003921569F;
* Npp32f nM1;
* Npp32f nM2;
* Npp32f nR;
* Npp32f nG;
* Npp32f nB;
* Npp32f nh = 0.0F;
* if (nNormalizedL <= 0.5F)
* nM2 = nNormalizedL * (1.0F + nNormalizedS);
* else
* nM2 = nNormalizedL + nNormalizedS - nNormalizedL * nNormalizedS;
* nM1 = 2.0F * nNormalizedL - nM2;
* if (nNormalizedS == 0.0F)
* nR = nG = nB = nNormalizedL;
* else
* {
* nh = nNormalizedH + 0.3333F;
* if (nh > 1.0F)
* nh -= 1.0F;
* }
* Npp32f nMDiff = nM2 - nM1;
* if (0.6667F < nh)
* nR = nM1;
* else
* {
* if (nh < 0.1667F)
* nR = (nM1 + nMDiff * nh * 6.0F); // / 0.1667F
* else if (nh < 0.5F)
* nR = nM2;
* else
* nR = nM1 + nMDiff * ( 0.6667F - nh ) * 6.0F; // / 0.1667F
* }
* if (nR > 1.0F)
* nR = 1.0F;
* nh = nNormalizedH;
* if (0.6667F < nh)
* nG = nM1;
* else
* {
* if (nh < 0.1667F)
* nG = (nM1 + nMDiff * nh * 6.0F); // / 0.1667F
* else if (nh < 0.5F)
* nG = nM2;
* else
* nG = nM1 + nMDiff * (0.6667F - nh ) * 6.0F; // / 0.1667F
* }
* if (nG > 1.0F)
* nG = 1.0F;
* nh = nNormalizedH - 0.3333F;
* if (nh < 0.0F)
* nh += 1.0F;
* if (0.6667F < nh)
* nB = nM1;
* else
* {
* if (nh < 0.1667F)
* nB = (nM1 + nMDiff * nh * 6.0F); // / 0.1667F
* else if (nh < 0.5F)
* nB = nM2;
* else
* nB = nM1 + nMDiff * (0.6667F - nh ) * 6.0F; // / 0.1667F
* }
* if (nB > 1.0F)
* nB = 1.0F;
* R = (Npp8u)(nR * 255.0F);
* G = (Npp8u)(nG * 255.0F);
* B = (Npp8u)(nB * 255.0F);
*

## Function Documentation

NppStatus nppiHLSToRGB_8u_AC4R | ( | const Npp8u * | pSrc,
|  | int | nSrcStep,
|  | Npp8u * | pDst,
|  | int | nDstStep,
|  | NppiSize | oSizeROI
| ) |  |

NppStatus nppiHLSToRGB_8u_AC4R_Ctx | ( | const Npp8u * | pSrc,
|  | int | nSrcStep,
|  | Npp8u * | pDst,
|  | int | nDstStep,
|  | NppiSize | oSizeROI,
|  | NppStreamContext | nppStreamCtx
| ) |  |

4 channel 8-bit unsigned packed HLS 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 nppiHLSToRGB_8u_C3R | ( | const Npp8u * | pSrc,
|  | int | nSrcStep,
|  | Npp8u * | pDst,
|  | int | nDstStep,
|  | NppiSize | oSizeROI
| ) |  |

NppStatus nppiHLSToRGB_8u_C3R_Ctx | ( | const Npp8u * | pSrc,
|  | int | nSrcStep,
|  | Npp8u * | pDst,
|  | int | nDstStep,
|  | NppiSize | oSizeROI,
|  | NppStreamContext | nppStreamCtx
| ) |  |

3 channel 8-bit unsigned packed HLS 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

Copyright © 2009-2018 NVIDIA Corporation