NVIDIA Performance Primitives (NPP)  Version 9.1
ColorToGray Conversion

Routines for converting color images to grayscale. More...

RGBToGray

RGB to CCIR601 Gray conversion.

Here is how NPP converts gamma corrected RGB to CCIR601 Gray.

* nGray = 0.299F * R + 0.587F * G + 0.114F * B;
*
NppStatus nppiRGBToGray_8u_C3C1R (const Npp8u *pSrc, int nSrcStep, Npp8u *pDst, int nDstStep, NppiSize oSizeROI)
 3 channel 8-bit unsigned packed RGB to 1 channel 8-bit unsigned packed Gray conversion. More...
 
NppStatus nppiRGBToGray_8u_AC4C1R (const Npp8u *pSrc, int nSrcStep, Npp8u *pDst, int nDstStep, NppiSize oSizeROI)
 4 channel 8-bit unsigned packed RGB with alpha to 1 channel 8-bit unsigned packed Gray conversion. More...
 
NppStatus nppiRGBToGray_16u_C3C1R (const Npp16u *pSrc, int nSrcStep, Npp16u *pDst, int nDstStep, NppiSize oSizeROI)
 3 channel 16-bit unsigned packed RGB to 1 channel 16-bit unsigned packed Gray conversion. More...
 
NppStatus nppiRGBToGray_16u_AC4C1R (const Npp16u *pSrc, int nSrcStep, Npp16u *pDst, int nDstStep, NppiSize oSizeROI)
 4 channel 16-bit unsigned packed RGB with alpha to 1 channel 16-bit unsigned packed Gray conversion. More...
 
NppStatus nppiRGBToGray_16s_C3C1R (const Npp16s *pSrc, int nSrcStep, Npp16s *pDst, int nDstStep, NppiSize oSizeROI)
 3 channel 16-bit signed packed RGB to 1 channel 16-bit signed packed Gray conversion. More...
 
NppStatus nppiRGBToGray_16s_AC4C1R (const Npp16s *pSrc, int nSrcStep, Npp16s *pDst, int nDstStep, NppiSize oSizeROI)
 4 channel 16-bit signed packed RGB with alpha to 1 channel 16-bit signed packed Gray conversion. More...
 
NppStatus nppiRGBToGray_32f_C3C1R (const Npp32f *pSrc, int nSrcStep, Npp32f *pDst, int nDstStep, NppiSize oSizeROI)
 3 channel 32-bit floating point packed RGB to 1 channel 32-bit floating point packed Gray conversion. More...
 
NppStatus nppiRGBToGray_32f_AC4C1R (const Npp32f *pSrc, int nSrcStep, Npp32f *pDst, int nDstStep, NppiSize oSizeROI)
 4 channel 32-bit floating point packed RGB with alpha to 1 channel 32-bit floating point packed Gray conversion. More...
 

ColorToGray

RGB Color to Gray conversion using user supplied conversion coefficients.

Here is how NPP converts gamma corrected RGB Color to Gray using user supplied conversion coefficients.

* nGray = aCoeffs[0] * R + aCoeffs[1] * G + aCoeffs[2] * B;
*

For the C4C1R versions of the functions the calculations are as follows. For BGRA or other formats with alpha just rearrange the coefficients accordingly.

* nGray = aCoeffs[0] * R + aCoeffs[1] * G + aCoeffs[2] * B + aCoeffs[3] * A;
*
NppStatus nppiColorToGray_8u_C3C1R (const Npp8u *pSrc, int nSrcStep, Npp8u *pDst, int nDstStep, NppiSize oSizeROI, const Npp32f aCoeffs[3])
 3 channel 8-bit unsigned packed RGB to 1 channel 8-bit unsigned packed Gray conversion. More...
 
NppStatus nppiColorToGray_8u_AC4C1R (const Npp8u *pSrc, int nSrcStep, Npp8u *pDst, int nDstStep, NppiSize oSizeROI, const Npp32f aCoeffs[3])
 4 channel 8-bit unsigned packed RGB with alpha to 1 channel 8-bit unsigned packed Gray conversion. More...
 
NppStatus nppiColorToGray_8u_C4C1R (const Npp8u *pSrc, int nSrcStep, Npp8u *pDst, int nDstStep, NppiSize oSizeROI, const Npp32f aCoeffs[4])
 4 channel 8-bit unsigned packed RGBA to 1 channel 8-bit unsigned packed Gray conversion. More...
 
NppStatus nppiColorToGray_16u_C3C1R (const Npp16u *pSrc, int nSrcStep, Npp16u *pDst, int nDstStep, NppiSize oSizeROI, const Npp32f aCoeffs[3])
 3 channel 16-bit unsigned packed RGB to 1 channel 16-bit unsigned packed Gray conversion. More...
 
NppStatus nppiColorToGray_16u_AC4C1R (const Npp16u *pSrc, int nSrcStep, Npp16u *pDst, int nDstStep, NppiSize oSizeROI, const Npp32f aCoeffs[3])
 4 channel 16-bit unsigned packed RGB with alpha to 1 channel 16-bit unsigned packed Gray conversion. More...
 
NppStatus nppiColorToGray_16u_C4C1R (const Npp16u *pSrc, int nSrcStep, Npp16u *pDst, int nDstStep, NppiSize oSizeROI, const Npp32f aCoeffs[4])
 4 channel 16-bit unsigned packed RGBA to 1 channel 16-bit unsigned packed Gray conversion. More...
 
NppStatus nppiColorToGray_16s_C3C1R (const Npp16s *pSrc, int nSrcStep, Npp16s *pDst, int nDstStep, NppiSize oSizeROI, const Npp32f aCoeffs[3])
 3 channel 16-bit signed packed RGB to 1 channel 16-bit signed packed Gray conversion. More...
 
NppStatus nppiColorToGray_16s_AC4C1R (const Npp16s *pSrc, int nSrcStep, Npp16s *pDst, int nDstStep, NppiSize oSizeROI, const Npp32f aCoeffs[3])
 4 channel 16-bit signed packed RGB with alpha to 1 channel 16-bit signed packed Gray conversion. More...
 
NppStatus nppiColorToGray_16s_C4C1R (const Npp16s *pSrc, int nSrcStep, Npp16s *pDst, int nDstStep, NppiSize oSizeROI, const Npp32f aCoeffs[4])
 4 channel 16-bit signed packed RGBA to 1 channel 16-bit signed packed Gray conversion. More...
 
NppStatus nppiColorToGray_32f_C3C1R (const Npp32f *pSrc, int nSrcStep, Npp32f *pDst, int nDstStep, NppiSize oSizeROI, const Npp32f aCoeffs[3])
 3 channel 32-bit floating point packed RGB to 1 channel 32-bit floating point packed Gray conversion. More...
 
NppStatus nppiColorToGray_32f_AC4C1R (const Npp32f *pSrc, int nSrcStep, Npp32f *pDst, int nDstStep, NppiSize oSizeROI, const Npp32f aCoeffs[3])
 4 channel 32-bit floating point packed RGB with alpha to 1 channel 32-bit floating point packed Gray conversion. More...
 
NppStatus nppiColorToGray_32f_C4C1R (const Npp32f *pSrc, int nSrcStep, Npp32f *pDst, int nDstStep, NppiSize oSizeROI, const Npp32f aCoeffs[4])
 4 channel 32-bit floating point packed RGBA to 1 channel 32-bit floating point packed Gray conversion. More...
 

GradientColorToGray

RGB Color to Gray Gradient conversion using user selected gradient distance method.

NppStatus nppiGradientColorToGray_8u_C3C1R (const Npp8u *pSrc, int nSrcStep, Npp8u *pDst, int nDstStep, NppiSize oSizeROI, NppiNorm eNorm)
 3 channel 8-bit unsigned packed RGB to 1 channel 8-bit unsigned packed Gray Gradient conversion. More...
 
NppStatus nppiGradientColorToGray_16u_C3C1R (const Npp16u *pSrc, int nSrcStep, Npp16u *pDst, int nDstStep, NppiSize oSizeROI, NppiNorm eNorm)
 3 channel 16-bit unsigned packed RGB to 1 channel 16-bit unsigned packed Gray Gradient conversion. More...
 
NppStatus nppiGradientColorToGray_16s_C3C1R (const Npp16s *pSrc, int nSrcStep, Npp16s *pDst, int nDstStep, NppiSize oSizeROI, NppiNorm eNorm)
 3 channel 16-bit signed packed RGB to 1 channel 16-bit signed packed Gray Gradient conversion. More...
 
NppStatus nppiGradientColorToGray_32f_C3C1R (const Npp32f *pSrc, int nSrcStep, Npp32f *pDst, int nDstStep, NppiSize oSizeROI, NppiNorm eNorm)
 3 channel 32-bit floating point packed RGB to 1 channel 32-bit floating point packed Gray Gradient conversion. More...
 

Detailed Description

Routines for converting color images to grayscale.

Function Documentation

NppStatus nppiColorToGray_16s_AC4C1R ( const Npp16s pSrc,
int  nSrcStep,
Npp16s pDst,
int  nDstStep,
NppiSize  oSizeROI,
const Npp32f  aCoeffs[3] 
)

4 channel 16-bit signed packed RGB with alpha to 1 channel 16-bit signed packed Gray conversion.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
aCoeffsfixed size array of constant floating point conversion coefficient values, one per color channel.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiColorToGray_16s_C3C1R ( const Npp16s pSrc,
int  nSrcStep,
Npp16s pDst,
int  nDstStep,
NppiSize  oSizeROI,
const Npp32f  aCoeffs[3] 
)

3 channel 16-bit signed packed RGB to 1 channel 16-bit signed packed Gray conversion.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
aCoeffsfixed size array of constant floating point conversion coefficient values, one per color channel.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiColorToGray_16s_C4C1R ( const Npp16s pSrc,
int  nSrcStep,
Npp16s pDst,
int  nDstStep,
NppiSize  oSizeROI,
const Npp32f  aCoeffs[4] 
)

4 channel 16-bit signed packed RGBA to 1 channel 16-bit signed packed Gray conversion.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
aCoeffsfixed size array of constant floating point conversion coefficient values, one per color channel.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiColorToGray_16u_AC4C1R ( const Npp16u pSrc,
int  nSrcStep,
Npp16u pDst,
int  nDstStep,
NppiSize  oSizeROI,
const Npp32f  aCoeffs[3] 
)

4 channel 16-bit unsigned packed RGB with alpha to 1 channel 16-bit unsigned packed Gray conversion.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
aCoeffsfixed size array of constant floating point conversion coefficient values, one per color channel.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiColorToGray_16u_C3C1R ( const Npp16u pSrc,
int  nSrcStep,
Npp16u pDst,
int  nDstStep,
NppiSize  oSizeROI,
const Npp32f  aCoeffs[3] 
)

3 channel 16-bit unsigned packed RGB to 1 channel 16-bit unsigned packed Gray conversion.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
aCoeffsfixed size array of constant floating point conversion coefficient values, one per color channel.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiColorToGray_16u_C4C1R ( const Npp16u pSrc,
int  nSrcStep,
Npp16u pDst,
int  nDstStep,
NppiSize  oSizeROI,
const Npp32f  aCoeffs[4] 
)

4 channel 16-bit unsigned packed RGBA to 1 channel 16-bit unsigned packed Gray conversion.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
aCoeffsfixed size array of constant floating point conversion coefficient values, one per color channel.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiColorToGray_32f_AC4C1R ( const Npp32f pSrc,
int  nSrcStep,
Npp32f pDst,
int  nDstStep,
NppiSize  oSizeROI,
const Npp32f  aCoeffs[3] 
)

4 channel 32-bit floating point packed RGB with alpha to 1 channel 32-bit floating point packed Gray conversion.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
aCoeffsfixed size array of constant floating point conversion coefficient values, one per color channel.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiColorToGray_32f_C3C1R ( const Npp32f pSrc,
int  nSrcStep,
Npp32f pDst,
int  nDstStep,
NppiSize  oSizeROI,
const Npp32f  aCoeffs[3] 
)

3 channel 32-bit floating point packed RGB to 1 channel 32-bit floating point packed Gray conversion.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
aCoeffsfixed size array of constant floating point conversion coefficient values, one per color channel.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiColorToGray_32f_C4C1R ( const Npp32f pSrc,
int  nSrcStep,
Npp32f pDst,
int  nDstStep,
NppiSize  oSizeROI,
const Npp32f  aCoeffs[4] 
)

4 channel 32-bit floating point packed RGBA to 1 channel 32-bit floating point packed Gray conversion.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
aCoeffsfixed size array of constant floating point conversion coefficient values, one per color channel.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiColorToGray_8u_AC4C1R ( const Npp8u pSrc,
int  nSrcStep,
Npp8u pDst,
int  nDstStep,
NppiSize  oSizeROI,
const Npp32f  aCoeffs[3] 
)

4 channel 8-bit unsigned packed RGB with alpha to 1 channel 8-bit unsigned packed Gray conversion.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
aCoeffsfixed size array of constant floating point conversion coefficient values, one per color channel.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiColorToGray_8u_C3C1R ( const Npp8u pSrc,
int  nSrcStep,
Npp8u pDst,
int  nDstStep,
NppiSize  oSizeROI,
const Npp32f  aCoeffs[3] 
)

3 channel 8-bit unsigned packed RGB to 1 channel 8-bit unsigned packed Gray conversion.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
aCoeffsfixed size array of constant floating point conversion coefficient values, one per color channel.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiColorToGray_8u_C4C1R ( const Npp8u pSrc,
int  nSrcStep,
Npp8u pDst,
int  nDstStep,
NppiSize  oSizeROI,
const Npp32f  aCoeffs[4] 
)

4 channel 8-bit unsigned packed RGBA to 1 channel 8-bit unsigned packed Gray conversion.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
aCoeffsfixed size array of constant floating point conversion coefficient values, one per color channel.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiGradientColorToGray_16s_C3C1R ( const Npp16s pSrc,
int  nSrcStep,
Npp16s pDst,
int  nDstStep,
NppiSize  oSizeROI,
NppiNorm  eNorm 
)

3 channel 16-bit signed packed RGB to 1 channel 16-bit signed packed Gray Gradient conversion.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
eNormGradient distance method to use.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiGradientColorToGray_16u_C3C1R ( const Npp16u pSrc,
int  nSrcStep,
Npp16u pDst,
int  nDstStep,
NppiSize  oSizeROI,
NppiNorm  eNorm 
)

3 channel 16-bit unsigned packed RGB to 1 channel 16-bit unsigned packed Gray Gradient conversion.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
eNormGradient distance method to use.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiGradientColorToGray_32f_C3C1R ( const Npp32f pSrc,
int  nSrcStep,
Npp32f pDst,
int  nDstStep,
NppiSize  oSizeROI,
NppiNorm  eNorm 
)

3 channel 32-bit floating point packed RGB to 1 channel 32-bit floating point packed Gray Gradient conversion.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
eNormGradient distance method to use.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiGradientColorToGray_8u_C3C1R ( const Npp8u pSrc,
int  nSrcStep,
Npp8u pDst,
int  nDstStep,
NppiSize  oSizeROI,
NppiNorm  eNorm 
)

3 channel 8-bit unsigned packed RGB to 1 channel 8-bit unsigned packed Gray Gradient conversion.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
eNormGradient distance method to use.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiRGBToGray_16s_AC4C1R ( const Npp16s pSrc,
int  nSrcStep,
Npp16s pDst,
int  nDstStep,
NppiSize  oSizeROI 
)

4 channel 16-bit signed packed RGB with alpha to 1 channel 16-bit signed packed Gray conversion.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiRGBToGray_16s_C3C1R ( const Npp16s pSrc,
int  nSrcStep,
Npp16s pDst,
int  nDstStep,
NppiSize  oSizeROI 
)

3 channel 16-bit signed packed RGB to 1 channel 16-bit signed packed Gray conversion.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiRGBToGray_16u_AC4C1R ( const Npp16u pSrc,
int  nSrcStep,
Npp16u pDst,
int  nDstStep,
NppiSize  oSizeROI 
)

4 channel 16-bit unsigned packed RGB with alpha to 1 channel 16-bit unsigned packed Gray conversion.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiRGBToGray_16u_C3C1R ( const Npp16u pSrc,
int  nSrcStep,
Npp16u pDst,
int  nDstStep,
NppiSize  oSizeROI 
)

3 channel 16-bit unsigned packed RGB to 1 channel 16-bit unsigned packed Gray conversion.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiRGBToGray_32f_AC4C1R ( const Npp32f pSrc,
int  nSrcStep,
Npp32f pDst,
int  nDstStep,
NppiSize  oSizeROI 
)

4 channel 32-bit floating point packed RGB with alpha to 1 channel 32-bit floating point packed Gray conversion.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiRGBToGray_32f_C3C1R ( const Npp32f pSrc,
int  nSrcStep,
Npp32f pDst,
int  nDstStep,
NppiSize  oSizeROI 
)

3 channel 32-bit floating point packed RGB to 1 channel 32-bit floating point packed Gray conversion.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiRGBToGray_8u_AC4C1R ( const Npp8u pSrc,
int  nSrcStep,
Npp8u pDst,
int  nDstStep,
NppiSize  oSizeROI 
)

4 channel 8-bit unsigned packed RGB with alpha to 1 channel 8-bit unsigned packed Gray conversion.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiRGBToGray_8u_C3C1R ( const Npp8u pSrc,
int  nSrcStep,
Npp8u pDst,
int  nDstStep,
NppiSize  oSizeROI 
)

3 channel 8-bit unsigned packed RGB to 1 channel 8-bit unsigned packed Gray conversion.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
Returns
Image Data Related Error Codes, ROI Related Error Codes

Copyright © 2009-2017 NVIDIA Corporation