Image Data Exchange And Initialization Functions

Functions for initializing, copying and converting image data.

These functions can be found in the nppidei library. Linking to only the sub-libraries that you use can significantly save link time, application load time, and CUDA runtime startup time when using dynamic libraries.

Image Set

Set

Functions for setting all pixels within the ROI to a specific value. For A4 channel counts destination alpha channel remains unaffected.

Common parameters for nppiSet functions include:

Supported data types include NPP_8U, NPP_8S, NPP_16U, NPP_16S, NPP_32U, NPP_32S, NPP_16F, NPP_32F, NPP_64F. Supported channel counts include NPP_CH_1, NPP_CH_2, NPP_CH_3, NPP_CH_4, NPP_CH_A4.

param eSrcDstType

Image Data Type.

param eSrcDstChannels

Image Data Channels.

param pValues

Host memory pointer to the pixel color value(s) to be used to set.

param pDst

Destination-Image Pointer.

param nDstStep

Destination-Image Line Step.

param oSizeROI

Region-Of-Interest (ROI).

param nppStreamCtx

Application Managed Stream Context.

return

Image Data Related Error Codes, ROI Related Error Codes

Functions

NppStatus nppiSet_Ctx(NppDataType eSrcDstType, NppiChannels eSrcDstChannels, const void *pValues, void *pDst, int nDstStep, NppiSize oSizeROI, NppStreamContext nppStreamCtx)

Set image pixel color value(s).

For common parameter descriptions, see Common parameters for nppiSet functions include:. Common parameters for nppiSet functions.

Image Masked Set

Masked Set

The masked set primitives have an additional “mask image” input. The mask

controls which pixels within the ROI are set. For details see

Masked Operation.

Common parameters for nppiSet_CXM functions include:

Supported data types include NPP_8U, NPP_8S, NPP_16U, NPP_16S, NPP_32U, NPP_32S, NPP_16F, NPP_32F. Supported channel counts include NPP_CH_1, NPP_CH_3, NPP_CH_4, NPP_CH_A4.

param eSrcDstType

Image Data Type.

param eSrcDstChannels

Image Data Channels.

param pValues

Host memory pointer to the pixel color value(s) to be used to set.

param pDst

Pointer Destination-Image Pointer.

param nDstStep

Destination-Image Line Step.

param oSizeROI

Region-Of-Interest (ROI).

param pMask

Mask-Image Pointer.

param nMaskStep

Mask-Image Line Step.

param nppStreamCtx

Application Managed Stream Context.

return

Image Data Related Error Codes, ROI Related Error Codes

Functions

NppStatus nppiSet_M_Ctx(NppDataType eSrcDstType, NppiChannels eSrcDstChannels, const void *pValues, void *pDst, int nDstStep, NppiSize oSizeROI, const Npp8u *pMask, int nMaskStep, NppStreamContext nppStreamCtx)

Set image pixel color value(s) using mask control.

For A4 channel counts destination alpha channel remains unaffected.

For common parameter descriptions, see Common parameters for nppiSet_CXM functions include:.

Image Channel Set

Channel Set

The selected-channel set primitives set a single color channel in multi-channel images to a given value. The channel is selected by adjusting the pDst pointer to point to the desired color channel (see Channel-of-Interest API).

Common parameters for nppiSet_CXC functions include:

Supported data types include NPP_8U, NPP_8S, NPP_16U, NPP_16S, NPP_32U, NPP_32S, NPP_16F, NPP_32F. Supported channel counts include NPP_CH_3, NPP_CH_4.

param eSrcDstType

Image Data Type.

param eDstChannels

destination Image Data Channels.

param pValue

Host memory pointer to the pixel color value to be used to set.

param pDst

Select-Channel Destination-Image Pointer.

param nDstStep

Destination-Image Line Step.

param oSizeROI

Region-Of-Interest (ROI).

param nppStreamCtx

Application Managed Stream Context.

return

Image Data Related Error Codes, ROI Related Error Codes

Functions

NppStatus nppiSetChannel_Ctx(NppDataType eSrcDstType, NppiChannels eDstChannels, const void *pValue, void *pDst, int nDstStep, NppiSize oSizeROI, NppStreamContext nppStreamCtx)

Image pixel color value set affecting only single channel.

For A4 channel counts destination alpha channel remains unaffected.

For common parameter descriptions, see Common parameters for nppiSet_CXC functions include:.

Image Copy Operations

Image Copy Operations

Functions for copying image pixels.

Image Copy

Copy

Copy pixels from one image to another. For A4 channel counts destination alpha channel remains unaffected.

Common parameters for nppiCopy functions include:

Supported data types include NPP_8U, NPP_8S, NPP_16U, NPP_16S, NPP_32U, NPP_32S, NPP_16F, NPP_32F. Supported channel counts include NPP_CH_1, NPP_CH_3, NPP_CH_4, NPP_CH_A4.

param eSrcDstType

Image Data Type.

param eSrcDstChannels

Image Data Channels.

param pSrc

Source-Image Pointer.

param nSrcStep

Source-Image Line Step.

param pDst

Destination-Image Pointer.

param nDstStep

Destination-Image Line Step.

param oSizeROI

Region-Of-Interest (ROI).

param nppStreamCtx

Application Managed Stream Context.

return

Image Data Related Error Codes, ROI Related Error Codes

Functions

NppStatus nppiCopy_Ctx(NppDataType eSrcDstType, NppiChannels eSrcDstChannels, const void *pSrc, int nSrcStep, void *pDst, int nDstStep, NppiSize oSizeROI, NppStreamContext nppStreamCtx)

Image copy.

For common parameter descriptions, see Common parameters for nppiCopy functions include:.

Image Masked Copy

Masked Copy

The masked copy primitives have an additional “mask image” input. The mask

controls which pixels within the ROI are copied. For details see

Masked Operation. For A4 channel counts destination alpha channel remains unaffected.

Common parameters for nppiCopy_CXM functions include:

Supported data types include NPP_8U, NPP_8S, NPP_16U, NPP_16S, NPP_32U, NPP_32S, NPP_32F. Supported channel counts include NPP_CH_1, NPP_CH_3, NPP_CH_4, NPP_CH_A4.

param eSrcDstType

Image Data Type.

param eSrcDstChannels

Image Data Channels.

param pSrc

Source-Image Pointer.

param nSrcStep

Source-Image Line Step.

param pDst

Destination-Image Pointer.

param nDstStep

Destination-Image Line Step.

param pMask

Mask-Image Pointer.

param nMaskStep

Mask-Image Line Step.

param oSizeROI

Region-Of-Interest (ROI).

param nppStreamCtx

Application Managed Stream Context.

return

Image Data Related Error Codes, ROI Related Error Codes

Functions

NppStatus nppiCopy_M_Ctx(NppDataType eSrcDstType, NppiChannels eSrcDstChannels, const void *pSrc, int nSrcStep, void *pDst, int nDstStep, NppiSize oSizeROI, const Npp8u *pMask, int nMaskStep, NppStreamContext nppStreamCtx)

Image copy with mask control.

For common parameter descriptions, see Common parameters for nppiCopy_CXM functions include:.

Image Copy Channel

Channel Copy

The channel copy primitives copy a single color channel from a multi-channel source image to any other color channel in a multi-channel destination image. The channel is selected by adjusting the respective image pointers to point to the desired color channel (see Channel-of-Interest API).

Common parameters for nppiCopy_CXC functions include:

Supported data types include NPP_8U, NPP_8S, NPP_16U, NPP_16S, NPP_32U, NPP_32S, NPP_32F. Supported channel counts include NPP_CH_3, NPP_CH_4.

param eSrcDstType

Image Data Type.

param eSrcDstChannels

Image Data Channels.

param pSrc

Select-Channel Source-Image Pointer.

param nSrcStep

Source-Image Line Step.

param pDst

Select-Channel Destination-Image Pointer.

param nDstStep

Destination-Image Line Step.

param oSizeROI

Region-Of-Interest (ROI).

param nppStreamCtx

Application Managed Stream Context.

return

Image Data Related Error Codes, ROI Related Error Codes

Functions

NppStatus nppiCopyChannel_Ctx(NppDataType eSrcDstType, NppiChannels eSrcDstChannels, const void *pSrc, int nSrcStep, void *pDst, int nDstStep, NppiSize oSizeROI, NppStreamContext nppStreamCtx)

Image copy selected channel.

For common parameter descriptions, see Common parameters for nppiCopy_CXC functions include:.

Image Extract Channel Copy

Extract Channel Copy

The channel extract primitives copy a single color channel from a multi-channel source image to singl-channel destination image. The channel is selected by adjusting the source image pointer to point to the desired color channel (see Channel-of-Interest API).

Common parameters for nppiCopyExtractChannel_CXC1 functions include:

Supported data types include NPP_8U, NPP_8S, NPP_16U, NPP_16S, NPP_32U, NPP_32S, NPP_32F. Supported channel counts include NPP_CH_3, NPP_CH_4.

param eSrcDstType

Image Data Type.

param eSrcChannels

Image Data Channels.

param pSrc

Select-Channel Source-Image Pointer.

param nSrcStep

Source-Image Line Step.

param pDst

Destination-Image Pointer.

param nDstStep

Destination-Image Line Step.

param oSizeROI

Region-Of-Interest (ROI).

param nppStreamCtx

Application Managed Stream Context.

return

Image Data Related Error Codes, ROI Related Error Codes

Functions

NppStatus nppiCopyExtractChannel_Ctx(NppDataType eSrcDstType, NppiChannels eSrcChannels, const void *pSrc, int nSrcStep, void *pDst, int nDstStep, NppiSize oSizeROI, NppStreamContext nppStreamCtx)

Image extract source channel copy to single destination channel.

For common parameter descriptions, see Common parameters for nppiCopyExtractChannel_CXC1 functions include:.

Image Insert Channel Copy

Insert Channel Copy

The channel insert primitives copy a single-channel source image into one of the color channels in a multi-channel destination image. The channel is selected by adjusting the destination image pointer to point to the desired color channel (see Channel-of-Interest API).

Common parameters for nppiCopyInsertChannel_C1CX functions include:

Supported data types include NPP_8U, NPP_8S, NPP_16U, NPP_16S, NPP_32U, NPP_32S, NPP_32F. Supported channel counts include NPP_CH_3, NPP_CH_4.

param eSrcDstType

Image Data Type.

param eDstChannels

Image Data Channels.

param pSrc

Source-Image Pointer.

param nSrcStep

Source-Image Line Step.

param pDst

Select-Channel Destination-Image Pointer.

param nDstStep

Destination-Image Line Step.

param oSizeROI

Region-Of-Interest (ROI).

param nppStreamCtx

Application Managed Stream Context.

return

Image Data Related Error Codes, ROI Related Error Codes

Functions

NppStatus nppiCopyInsertChannel_Ctx(NppDataType eSrcDstType, NppiChannels eDstChannels, const void *pSrc, int nSrcStep, void *pDst, int nDstStep, NppiSize oSizeROI, NppStreamContext nppStreamCtx)

Image single source channel copy insert (replace) destination channel.

For common parameter descriptions, see Common parameters for nppiCopyInsertChannel_C1CX functions include:.

Image Packed To Planar Channel Copy

Packed To Planar Channel Copy

Split a packed multi-channel image into multiple single channel planes.

E.g. copy the three channels of an RGB image into three separate single-channel images.

Common parameters for nppiCopy_CXPX functions include:

Supported data types include NPP_8U, NPP_8S, NPP_16U, NPP_16S, NPP_32U, NPP_32S, NPP_32F. Supported source channel counts include NPP_CH_3, NPP_CH_4. Supported destination channel counts include NPP_CH_P3, NPP_CH_P4.

param eSrcDstType

Image Data Type.

param eSrcChannels

source Image Data Channels.

param eDstChannels

destination Image Data Channels.

param pSrc

Source-Image Pointer.

param nSrcStep

Source-Image Line Step.

param aDst

Destination-Planar-Image Pointer Array.

param nDstStep

Destination-Image Line Step.

param oSizeROI

Region-Of-Interest (ROI).

param nppStreamCtx

Application Managed Stream Context.

return

Image Data Related Error Codes, ROI Related Error Codes

Functions

NppStatus nppiCopy_CXPX_Ctx(NppDataType eSrcDstType, NppiChannels eDstChannels, const void *pSrc, int nSrcStep, void *aDst[4], int nDstStep, NppiSize oSizeROI, NppStreamContext nppStreamCtx)

Packed to planar same channel count image copy.

For common parameter descriptions, see Common parameters for nppiCopy_CXPX functions include:.

Image Planar To Packed Channel Copy

Planar To Packed Channel Copy

Combine multiple image planes into a packed multi-channel image.

E.g. copy three single-channel images into a single 3-channel image.

Common parameters for nppiCopy_PXCX functions include:

Supported data types include NPP_8U, NPP_8S, NPP_16U, NPP_16S, NPP_32U, NPP_32S, NPP_32F. Supported source channel counts include NPP_CH_P3, NPP_CH_P4. Supported destination channel counts include NPP_CH_C3, NPP_CH_C4.

param eSrcDstType

Image Data Type.

param eSrcChannels

source Image Data Channels.

param eDstChannels

destination Image Data Channels.

param aSrc

Planar Source-Image Pointer.

param nSrcStep

Source-Planar-Image Pointer Array.

param pDst

Destination-Image Pointer.

param nDstStep

Destination-Image Line Step.

param oSizeROI

Region-Of-Interest (ROI).

param nppStreamCtx

Application Managed Stream Context.

return

Image Data Related Error Codes, ROI Related Error Codes

Functions

NppStatus nppiCopy_PXCX_Ctx(NppDataType eSrcDstType, NppiChannels eSrcChannels, void *const aSrc[4], int nSrcStep, void *pDst, int nDstStep, NppiSize oSizeROI, NppStreamContext nppStreamCtx)

Planar to packed same channel count image copy.

For common parameter descriptions, see Common parameters for nppiCopy_PXCX functions include:.

Image Copy Constant Border

Copy Constant Border

Methods for copying images and padding borders with a constant, user-specifiable color. For A4 channel counts destination alpha channel remains unaffected.

Common parameters for nppiCopyConstBorder functions include:

Supported data types include NPP_8U, NPP_8S, NPP_16U, NPP_16S, NPP_32U, NPP_32S, NPP_16F, NPP_32F. Supported channel counts include NPP_CH_1, NPP_CH_3, NPP_CH_4, NPP_CH_A4.

param eSrcDstType

Image Data Type.

param eSrcDstChannels

Image Data Channels.

param pSrc

Source-Image Pointer.

param nSrcStep

Source-Image Line Step.

param oSrcSizeROI

Size of the source region of pixels.

param pDst

Destination-Image Pointer.

param nDstStep

Destination-Image Line Step.

param oDstSizeROI

Size (width, height) of the destination region, i.e. the region that gets filled with data from the source image (inner part) and constant border color (outer part).

param nTopBorderHeight

Height (in pixels) of the top border. The number of pixel rows at the top of the destination ROI that will be filled with the constant border color. nBottomBorderHeight = oDstSizeROI.height - nTopBorderHeight - oSrcSizeROI.height.

param nLeftBorderWidth

Width (in pixels) of the left border. The width of the border at the right side of the destination ROI is implicitly defined by the size of the source ROI: nRightBorderWidth = oDstSizeROI.width - nLeftBorderWidth - oSrcSizeROI.width.

param pBorderValues

Host memory pointer to the single color value or RGBA color values of set as border pixels.

param nppStreamCtx

Application Managed Stream Context.

return

Image Data Related Error Codes, ROI Related Error Codes

Functions

NppStatus nppiCopyConstBorder_Ctx(NppDataType eSrcDstType, NppiChannels eSrcDstChannels, const void *pSrc, int nSrcStep, NppiSize oSrcSizeROI, void *pDst, int nDstStep, NppiSize oDstSizeROI, int nTopBorderHeight, int nLeftBorderWidth, void *pBorderValues, NppStreamContext nppStreamCtx)

Image copy with constant border color.

For common parameter descriptions, see Common parameters for nppiCopyConstBorder functions include:.

Image Copy Replicate Border

Copy Replicate Border

Methods for copying images and padding borders with a replicates of the nearest source image pixel color. For A4 channel counts destination alpha channel remains unaffected.

Common parameters for nppiCopyReplicateBorder functions include:

Supported data types include NPP_8U, NPP_8S, NPP_16U, NPP_16S, NPP_32U, NPP_32S, NPP_16F, NPP_32F. Supported channel counts include NPP_CH_1, NPP_CH_3, NPP_CH_4, NPP_CH_A4.

param eSrcDstType

Image Data Type.

param eSrcDstChannels

Image Data Channels.

param pSrc

Source-Image Pointer.

param nSrcStep

Source-Image Line Step.

param oSrcSizeROI

Size of the source region of pixels.

param pDst

Destination-Image Pointer.

param nDstStep

Destination-Image Line Step.

param oDstSizeROI

Size (width, height) of the destination region, i.e. the region that gets filled with data from the source image (inner part) and nearest source image pixel color (outer part).

param nTopBorderHeight

Height (in pixels) of the top border. The number of pixel rows at the top of the destination ROI that will be filled with the nearest source image pixel color. nBottomBorderHeight = oDstSizeROI.height - nTopBorderHeight - oSrcSizeROI.height.

param nLeftBorderWidth

Width (in pixels) of the left border. The width of the border at the right side of the destination ROI is implicitly defined by the size of the source ROI: nRightBorderWidth = oDstSizeROI.width - nLeftBorderWidth - oSrcSizeROI.width.

param nppStreamCtx

Application Managed Stream Context.

return

Image Data Related Error Codes, ROI Related Error Codes

Functions

NppStatus nppiCopyReplicateBorder_Ctx(NppDataType eSrcDstType, NppiChannels eSrcDstChannels, const void *pSrc, int nSrcStep, NppiSize oSrcSizeROI, void *pDst, int nDstStep, NppiSize oDstSizeROI, int nTopBorderHeight, int nLeftBorderWidth, NppStreamContext nppStreamCtx)

Image copy with nearest source image pixel border color replication.

For common parameter descriptions, see Common parameters for nppiCopyReplicateBorder functions include:.

Image Copy Wrap Border

Copy Wrap Border

Methods for copying images and padding borders with wrapped replications of the source image pixel colors. For A4 channel counts destination alpha channel remains unaffected.

Common parameters for nppiCopyWrapBorder functions include:

Supported data types include NPP_8U, NPP_8S, NPP_16U, NPP_16S, NPP_32U, NPP_32S, NPP_16F, NPP_32F. Supported channel counts include NPP_CH_1, NPP_CH_3, NPP_CH_4, NPP_CH_A4.

param eSrcDstType

Image Data Type.

param eSrcDstChannels

Image Data Channels.

param pSrc

Source-Image Pointer.

param nSrcStep

Source-Image Line Step.

param oSrcSizeROI

Size of the source region of pixels.

param pDst

Destination-Image Pointer.

param nDstStep

Destination-Image Line Step.

param oDstSizeROI

Size (width, height) of the destination region, i.e. the region that gets filled with data from the source image (inner part) and a border consisting of wrapped replication of the source image pixel colors (outer part).

param nTopBorderHeight

Height (in pixels) of the top border. The number of pixel rows at the top of the destination ROI that will be filled with the wrapped replication of the corresponding column of source image pixels colors. nBottomBorderHeight = oDstSizeROI.height - nTopBorderHeight - oSrcSizeROI.height.

param nLeftBorderWidth

Width (in pixels) of the left border. The width of the border at the right side of the destination ROI is implicitly defined by the size of the source ROI: nRightBorderWidth = oDstSizeROI.width - nLeftBorderWidth - oSrcSizeROI.width.

param nppStreamCtx

Application Managed Stream Context.

return

Image Data Related Error Codes, ROI Related Error Codes

Functions

NppStatus nppiCopyWrapBorder_Ctx(NppDataType eSrcDstType, NppiChannels eSrcDstChannels, const void *pSrc, int nSrcStep, NppiSize oSrcSizeROI, void *pDst, int nDstStep, NppiSize oDstSizeROI, int nTopBorderHeight, int nLeftBorderWidth, NppStreamContext nppStreamCtx)

Image copy with borders wrapped by replication of source image pixel colors.

For common parameter descriptions, see Common parameters for nppiCopyWrapBorder functions include:.

Image Copy Sub-Pixel

Copy Sub-Pixel

Functions for copying linearly interpolated images using source image subpixel coordinates. For A4 channel counts destination alpha channel remains unaffected.

Common parameters for nppiCopySubpix functions include:

Supported data types include NPP_8U, NPP_8S, NPP_16U, NPP_16S, NPP_32U, NPP_32S, NPP_32F. Supported channel counts include NPP_CH_1, NPP_CH_3, NPP_CH_4, NPP_CH_A4.

param eSrcDstType

Image Data Type.

param eSrcDstChannels

Image Data Channels.

param pSrc

Source-Image Pointer.

param nSrcStep

Source-Image Line Step.

param pDst

Destination-Image Pointer.

param nDstStep

Destination-Image Line Step.

param oDstSizeROI

Size (width, height) of the destination region, i.e. the region that gets filled with data from the source image, source image ROI is assumed to be same as destination image ROI.

param nDx

Fractional part of source image X coordinate.

param nDy

Fractional part of source image Y coordinate.

param nppStreamCtx

Application Managed Stream Context.

return

Image Data Related Error Codes, ROI Related Error Codes

Functions

NppStatus nppiCopySubpix_Ctx(NppDataType eSrcDstType, NppiChannels eSrcDstChannels, const void *pSrc, int nSrcStep, void *pDst, int nDstStep, NppiSize oDstSizeROI, Npp32f nDx, Npp32f nDy, NppStreamContext nppStreamCtx)

Linearly interpolated source image subpixel coordinate color copy.

For common parameter descriptions, see Common parameters for nppiCopySubpix functions include:.

Image Convert Bit-Depth

Convert Bit Depth

Functions for converting bit depth without scaling.

Image Convert Increase Bit-Depth

Convert To Increased Bit Depth

The integer conversion methods do not involve any scaling. Also, even when increasing the bit-depth loss of information may occur:

  • When converting integers (e.g. Npp32u) to float (e.g. Npp32f) integer value not accurately representable by the float are rounded to the closest floating-point value.

  • When converting signed integers to unsigned integers all negative values are lost (saturated to 0). For A4 channel counts destination alpha channel remains unaffected.

Note that all pointers and step sizes for images with 16f (Npp16f) data types perform best when they are at least 16 byte aligned.

Common parameters for nppiConvert to increased bit depth functions include:

Supported data types include NPP_8U, NPP_8S, NPP_16U, NPP_16S, NPP_32U, NPP_32S, NPP_32F. Supported channel counts include NPP_CH_1, NPP_CH_3, NPP_CH_4, NPP_CH_A4.

param eSrcType

source Image Data Type.

param eDstType

destination Image Data Type.

param eSrcDstChannels

Image Data Channels.

param pSrc

Source-Image Pointer.

param nSrcStep

Source-Image Line Step.

param pDst

Destination-Image Pointer.

param nDstStep

Destination-Image Line Step.

param oSizeROI

Region-Of-Interest (ROI).

param nppStreamCtx

Application Managed Stream Context.

return

Image Data Related Error Codes, ROI Related Error Codes

Functions

NppStatus nppiConvert_Up_Ctx(NppDataType eSrcType, NppDataType eDstType, NppiChannels eSrcDstChannels, const void *pSrc, int nSrcStep, void *pDst, int nDstStep, NppiSize oSizeROI, NppStreamContext nppStreamCtx)

Image increase bit depth conversion.

For common parameter descriptions, see Common parameters for nppiConvert to increased bit depth functions include:.

Image Convert Decrease Bit-Depth

Convert To Decreased Bit Depth

The integer conversion methods do not involve any scaling. When converting floating-point values to integers the user may choose the most appropriate rounding-mode. Typically information is lost when converting to lower bit depth:

  • All converted values are saturated to the destination type’s range. E.g. any values larger than the largest value of the destination type are clamped to the destination’s maximum.

  • Converting floating-point values to integer also involves rounding, effectively loosing all fractional value information in the process. For A4 channel counts destination alpha channel remains unaffected.

Note that all pointers and step sizes for images with 16f (Npp16f) data types perform best when they are at least 16 byte aligned.

Common parameters for nppiConvert to decreased bit depth functions include:

Supported data types include NPP_8U, NPP_8S, NPP_16U, NPP_16S, NPP_32U, NPP_32S, NPP_32F. Supported channel counts include NPP_CH_1, NPP_CH_3, NPP_CH_4, NPP_CH_A4.

param eSrcType

source Image Data Type.

param eDstType

destination Image Data Type.

param eSrcDstChannels

Image Data Channels.

param pSrc

Source-Image Pointer.

param nSrcStep

Source-Image Line Step.

param pDst

Destination-Image Pointer.

param nDstStep

Destination-Image Line Step.

param eRoundMode

Rounding Mode Parameter.

param nScaleFactor

Integer Result Scaling, 0 for no scaling.

param oSizeROI

Region-Of-Interest (ROI).

param nppStreamCtx

Application Managed Stream Context.

return

Image Data Related Error Codes, ROI Related Error Codes

Functions

NppStatus nppiConvert_Down_Ctx(NppDataType eSrcType, NppDataType eDstType, NppiChannels eSrcDstChannels, const void *pSrc, int nSrcStep, void *pDst, int nDstStep, NppiSize oSizeROI, NppStreamContext nppStreamCtx)

Image decrease bit depth conversion.

For common parameter descriptions, see Common parameters for nppiConvert to decreased bit depth functions include:.

NppStatus nppiConvert_Down_Sfs_Ctx(NppDataType eSrcType, NppDataType eDstType, NppiChannels eSrcDstChannels, const void *pSrc, int nSrcStep, void *pDst, int nDstStep, NppRoundMode eRoundMode, int nScaleFactor, NppiSize oSizeROI, NppStreamContext nppStreamCtx)

Image decrease bit depth conversion with scaling.

For common parameter descriptions, see Common parameters for nppiConvert to decreased bit depth functions include:.

Image Scale Bit-Depth

Scale Bit Depth

Functions for scaling bit depth up or down.

Image Scale To Higher Bit-Depth

Scale To Higher Bit Depth

Functions for scaling images to higher bit depth.

To map source pixel srcPixelValue to destination pixel dstPixelValue the following equation is used:

 dstPixelValue = dstMinRangeValue + scaleFactor * (srcPixelValue - srcMinRangeValue)
where scaleFactor = (dstMaxRangeValue - dstMinRangeValue) / (srcMaxRangeValue - srcMinRangeValue).

For conversions between integer data types, the entire integer numeric range of the input data type is mapped onto the entire integer numeric range of the output data type. For A4 channel counts destination alpha channel remains unaffected.

For conversions to floating point data types the floating point data range is defined by the user supplied floating point values of nMax and nMin which are used as the dstMaxRangeValue and dstMinRangeValue respectively in the scaleFactor and dstPixelValue calculations and also as the saturation values to which output data is clamped.

When converting from floating-point values to integer values, nMax and nMin are used as the srcMaxRangeValue and srcMinRangeValue respectively in the scaleFactor and dstPixelValue calculations. Output values are saturated and clamped to the full output integer pixel value range.

Common parameters for nppiScale to higher bit depth functions include:

Supported data types include NPP_8U, NPP_8S, NPP_16U, NPP_16S, NPP_32U, NPP_32S, NPP_32F. Supported channel counts include NPP_CH_1, NPP_CH_3, NPP_CH_4, NPP_CH_A4.

param eSrcType

source Image Data Type.

param eDstType

destination Image Data Type.

param eSrcDstChannels

Image Data Channels.

param pSrc

Source-Image Pointer.

param nSrcStep

Source-Image Line Step.

param pDst

Destination-Image Pointer.

param nDstStep

Destination-Image Line Step.

param oSizeROI

Region-Of-Interest (ROI).

param nMin

specifies the minimum saturation value to which every output value will be clamped, ignored for integer destinations.

param nMax

specifies the maximum saturation value to which every output value will be clamped, ignored for integer destinations.

param nppStreamCtx

Application Managed Stream Context.

return

Image Data Related Error Codes, ROI Related Error Codes, NPP_SCALE_RANGE_ERROR indicates an error condition if nMax <= nMin.

Functions

NppStatus nppiScale_Up_Ctx(NppDataType eSrcType, NppDataType eDstType, NppiChannels eSrcDstChannels, const void *pSrc, int nSrcStep, void *pDst, int nDstStep, NppiSize oSizeROI, Npp32f nMin, Npp32f nMax, NppStreamContext nppStreamCtx)

Image scale bit depth up conversion.

For common parameter descriptions, see Common parameters for nppiScale to higher bit depth functions include:.

Image Scale To Lower Bit-Depth

Scale To Lower Bit Depth

Functions for scaling images to lower bit depth.

To map source pixel srcPixelValue to destination pixel dstPixelValue the following equation is used:

 dstPixelValue = dstMinRangeValue + scaleFactor * (srcPixelValue - srcMinRangeValue)
where scaleFactor = (dstMaxRangeValue - dstMinRangeValue) / (srcMaxRangeValue - srcMinRangeValue).

For conversions between integer data types, the entire integer numeric range of the input data type is mapped onto the entire integer numeric range of the output data type.

For conversions to floating point data types the floating point data range is defined by the user supplied floating point values of nMax and nMin which are used as the dstMaxRangeValue and dstMinRangeValue respectively in the scaleFactor and dstPixelValue calculations and also as the saturation values to which output data is clamped.

When converting from floating-point values to integer values, nMax and nMin are used as the srcMaxRangeValue and srcMinRangeValue respectively in the scaleFactor and dstPixelValue calculations. Output values are saturated and clamped to the full output integer pixel value range.

Common parameters for nppiScale to lower bit depth functions include:

Supported data types include NPP_8U, NPP_8S, NPP_16U, NPP_16S, NPP_32U, NPP_32S, NPP_32F. Supported channel counts include NPP_CH_1, NPP_CH_3, NPP_CH_4, NPP_CH_A4.

param eSrcType

source Image Data Type.

param eDstType

destination Image Data Type.

param eSrcDstChannels

Image Data Channels.

param pSrc

Source-Image Pointer.

param nSrcStep

Source-Image Line Step.

param pDst

Destination-Image Pointer.

param nDstStep

Destination-Image Line Step.

param oSizeROI

Region-Of-Interest (ROI).

param nMin

specifies the minimum saturation value to which every output value will be clamped, ignored for integer source pixels.

param nMax

specifies the maximum saturation value to which every output value will be clamped, ignored for integer source pixels.

param nppStreamCtx

Application Managed Stream Context.

return

Image Data Related Error Codes, ROI Related Error Codes, NPP_SCALE_RANGE_ERROR indicates an error condition if nMax <= nMin.

Functions

NppStatus nppiScale_Down_Ctx(NppDataType eSrcType, NppDataType eDstType, NppiChannels eSrcDstChannels, const void *pSrc, int nSrcStep, void *pDst, int nDstStep, NppiSize oSizeROI, Npp32f nMin, Npp32f nMax, NppStreamContext nppStreamCtx)

Image scale bit depth down conversion.

For common parameter descriptions, see Common parameters for nppiScale to lower bit depth functions include:.

Image Duplicate Channel

Duplicate Channel

Functions for duplicating a single channel image in a multiple channel image.

Common parameters for nppiDup functions include:

Supported data types include NPP_8U, NPP_8S, NPP_16U, NPP_16S, NPP_32U, NPP_32S, NPP_32F. Supported channel counts include NPP_CH_3, NPP_CH_4, NPP_CH_A4.

param eSrcDstType

destination Image Data Type.

param eDstChannels

Image Data Channels.

param pSrc

Source-Image Pointer.

param nSrcStep

Source-Image Line Step.

param pDst

Destination-Image Pointer.

param nDstStep

Destination-Image Line Step.

param oDstSizeROI

Size (width, height) of the destination region, i.e. the region that gets filled with data from the source image, source image ROI is assumed to be same as destination image ROI.

param nppStreamCtx

Application Managed Stream Context.

return

Image Data Related Error Codes, ROI Related Error Codes

Functions

NppStatus nppiDupChannel_Ctx(NppDataType eSrcDstType, NppiChannels eDstChannels, const void *pSrc, int nSrcStep, void *pDst, int nDstStep, NppiSize oDstSizeROI, NppStreamContext nppStreamCtx)

Duplicate single channel source image in all destination channels.

For common parameter descriptions, see Common parameters for nppiDup functions include:.

Image Transpose

Transpose Image

Functions for transposing images of various types. Like matrix transpose, image transpose is a mirror along the image’s diagonal (upper-left to lower-right corner).

Common parameters for nppiTranspose functions include:

Supported data types include NPP_8U, NPP_8S, NPP_16U, NPP_16S, NPP_32U, NPP_32S, NPP_32F. Supported channel counts include NPP_CH_1, NPP_CH_3, NPP_CH_4.

param eSrcDstType

destination Image Data Type.

param eSrcDstChannels

Image Data Channels.

param pSrc

Source-Image Pointer.

param nSrcStep

Source-Image Line Step.

param pDst

Pointer to the destination ROI.

param nDstStep

Destination-Image Line Step.

param oSizeROI

Region-Of-Interest (ROI).

param nppStreamCtx

Application Managed Stream Context.

return

Image Data Related Error Codes, ROI Related Error Codes

Functions

NppStatus nppiTranspose_Ctx(NppDataType eSrcDstType, NppiChannels eSrcDstChannels, const void *pSrc, int nSrcStep, void *pDst, int nDstStep, NppiSize oSizeROI, NppStreamContext nppStreamCtx)

Image transpose.

For common parameter descriptions, see Common parameters for nppiTranspose functions include:.

Image Swap Channels

Swap Channels

Functions for swapping and duplicating channels in multiple channel images. The methods support arbitrary permutations of the original channels, including replication and setting one or more channels to a constant value.

Functions

NppStatus nppiSwapChannels_C3R_Ctx(NppDataType eSrcDstType, NppiChannels eSrcChannels, const void *pSrc, int nSrcStep, void *pDst, int nDstStep, NppiSize oSizeROI, const int aDstOrder[3], NppStreamContext nppStreamCtx)

Image swap channels to 3 channel destination.

Supported data types include NPP_8U, NPP_8S, NPP_16U, NPP_16S, NPP_32U, NPP_32S, NPP_32F. Supported channel counts include NPP_CH_3, NPP_CH_4.

Parameters
Returns

Image Data Related Error Codes, ROI Related Error Codes

NppStatus nppiSwapChannels_C3IR_Ctx(NppDataType eSrcDstType, NppiChannels eSrcChannels, void *pSrcDst, int nSrcDstStep, NppiSize oSizeROI, const int aDstOrder[3], NppStreamContext nppStreamCtx)

In place image swap channels o 3 channel destination.

Supported data types include NPP_8U, NPP_8S, NPP_16U, NPP_16S, NPP_32U, NPP_32S, NPP_32F. Supported channel counts include NPP_CH_3, NPP_CH_4.

Parameters
Returns

Image Data Related Error Codes, ROI Related Error Codes

NppStatus nppiSwapChannels_C4R_Ctx(NppDataType eSrcDstType, NppiChannels eSrcChannels, const void *pSrc, int nSrcStep, void *pDst, int nDstStep, NppiSize oSizeROI, const int aDstOrder[4], const void *pValue, NppStreamContext nppStreamCtx)

Image swap channels to 4 channel destination.

Supported data types include NPP_8U, NPP_8S, NPP_16U, NPP_16S, NPP_32U, NPP_32S, NPP_32F. Supported channel counts include NPP_CH_3, NPP_CH_4.

Parameters
  • eSrcDstType – source Image Data Type.

  • eSrcChannels – source Image Data Channels.

  • pSrcSource-Image Pointer.

  • nSrcStepSource-Image Line Step.

  • pDstDestination-Image Pointer.

  • nDstStepDestination-Image Line Step.

  • oSizeROIRegion-Of-Interest (ROI).

  • aDstOrder – Host memory integer array describing how channel values are permutated. The n-th entry of the array contains the number of the channel that is stored in the n-th channel of the output image. E.g. Given an RGB image, aDstOrder = [3,2,1,0] converts this to VBGR channel order.

  • pValue – (V) Host memory pointer to single channel constant value that can be replicated in one or more of the 4 destination channels. pValue[0] is either written or not written to a particular channel depending on the aDstOrder entry for that destination channel. An aDstOrder value of 3 will output nValue to that channel, an aDstOrder value greater than 3 will leave that particular destination channel value unmodified. pValue is ignored if both eSrcChannels is NPP_CH_4.

  • nppStreamCtxApplication Managed Stream Context.

Returns

Image Data Related Error Codes, ROI Related Error Codes

NppStatus nppiSwapChannels_C4IR_Ctx(NppDataType eSrcDstType, NppiChannels eSrcChannels, void *pSrcDst, int nSrcDstStep, NppiSize oSizeROI, const int aDstOrder[4], const void *pValue, NppStreamContext nppStreamCtx)

In place image swap channels o 4 channel destination.

Supported data types include NPP_8U, NPP_8S, NPP_16U, NPP_16S, NPP_32U, NPP_32S, NPP_32F. Supported channel counts include NPP_CH_3, NPP_CH_4.

Parameters
  • eSrcDstType – source Image Data Type.

  • eSrcChannels – source Image Data Channels.

  • pSrcDstIn-Place Image Pointer.

  • nSrcDstStepIn-Place-Image Line Step.

  • oSizeROIRegion-Of-Interest (ROI).

  • aDstOrder – Host memory integer array describing how channel values are permutated. The n-th entry of the array contains the number of the channel that is stored in the n-th channel of the output image. E.g. Given an RGB image, aDstOrder = [3,2,1,0] converts this to VBGR channel order.

  • pValue – (V) Host memory pointer to single channel constant value that can be replicated in one or more of the 4 destination channels. pValue[0] is either written or not written to a particular channel depending on the aDstOrder entry for that destination channel. An aDstOrder value of 3 will output nValue to that channel, an aDstOrder value greater than 3 will leave that particular destination channel value unmodified. pValue is ignored if both eSrcChannels is NPP_CH_4.

  • nppStreamCtxApplication Managed Stream Context.

Returns

Image Data Related Error Codes, ROI Related Error Codes