NVIDIA 2D Image And Signal Performance Primitives (NPP)  Version 11.7.1.*
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
LabelMarkers

Generate image connected region label markers to be used for later image segmentation. More...

LabelMarkersUFGetBufferSize

Before calling any of the LabelMarkersUF functions the application first needs to call the LabelMarkersGetBufferSize function to determine the amount of device memory to allocate as a working buffer.

The application allocated device memory is then passed as the pBuffer parameter to the corresponding LabelMarkersUF function.

NppStatus nppiLabelMarkersUFGetBufferSize_32u_C1R (NppiSize oSizeROI, int *hpBufferSize)
 Calculate scratch buffer size needed 1 channel 32-bit unsigned integer LabelMarkersUF function based on destination image oSizeROI width and height. More...
 

LabelMarkersUF

Generate image connected region label markers to be used for later image segmentation.

A connected region is any pixel region where all pixels in the region have the same pixel value. Note that marker label IDs generally increase in value from image left to right and top to bottom they are not generated in any particular order and there may be numeric gaps between sequential marker IDs. To limit the number of marker IDs generated the application should pass the image through a threshold filter before calling this funcion. Doing so however does not necessarily limit the maximum marker ID value generated by this function. Note that these functions currently only support image ROI sizes up to 4 gigapixels. Also note that while these functions support destination image pitches that are not exactly equal to oSizeROI.width * sizeof(Npp32u) it can avoid a cudaMemCpyAsync() call to copy the final result from the working buffer to the destination image if the pitch exactly equals oSizeROI.width * sizeof(Npp32u).

Before calling any of the LabelMarkersUF functions the application first needs to call the LabelMarkersUFGetBufferSize to determine the amount of device memory to allocate as a working buffer. The allocated device memory is then passed as the pBuffer parameter to the corresponding LabelMarkersUF function.

The algorithm used in this implementation is based on the one described in "An Optimized Union-Find Algorithm for Connected Components Labeling Using GPUs" by Jun Chen and others.

Note that the destination image in these functions must be allocated with cudaMalloc() and NOT cudaMallocPitch(). Also the pitch of the output image MUST be set to oSizeROI.width * sizeof(Npp32u).

NppStatus nppiLabelMarkersUF_8u32u_C1R_Ctx (Npp8u *pSrc, int nSrcStep, Npp32u *pDst, int nDstStep, NppiSize oSizeROI, NppiNorm eNorm, Npp8u *pBuffer, NppStreamContext nppStreamCtx)
 1 channel 8-bit to 32-bit unsigned integer label markers image generation. More...
 
NppStatus nppiLabelMarkersUF_8u32u_C1R (Npp8u *pSrc, int nSrcStep, Npp32u *pDst, int nDstStep, NppiSize oSizeROI, NppiNorm eNorm, Npp8u *pBuffer)
 
NppStatus nppiLabelMarkersUF_16u32u_C1R_Ctx (Npp16u *pSrc, int nSrcStep, Npp32u *pDst, int nDstStep, NppiSize oSizeROI, NppiNorm eNorm, Npp8u *pBuffer, NppStreamContext nppStreamCtx)
 1 channel 16-bit to 32-bit unsigned integer label markers image generation. More...
 
NppStatus nppiLabelMarkersUF_16u32u_C1R (Npp16u *pSrc, int nSrcStep, Npp32u *pDst, int nDstStep, NppiSize oSizeROI, NppiNorm eNorm, Npp8u *pBuffer)
 
NppStatus nppiLabelMarkersUF_32u_C1R_Ctx (Npp32u *pSrc, int nSrcStep, Npp32u *pDst, int nDstStep, NppiSize oSizeROI, NppiNorm eNorm, Npp8u *pBuffer, NppStreamContext nppStreamCtx)
 1 channel 32-bit to 32-bit unsigned integer label markers image generation. More...
 
NppStatus nppiLabelMarkersUF_32u_C1R (Npp32u *pSrc, int nSrcStep, Npp32u *pDst, int nDstStep, NppiSize oSizeROI, NppiNorm eNorm, Npp8u *pBuffer)
 

LabelMarkersUFBatch

Generate image connected region label markers to be used for later image segmentation for a batched list of images.

A connected region is any pixel region where all pixels in the region have the same pixel value. Note that marker label IDs generally increase in value from image left to right and top to bottom they are not generated in any particular order and there may be numeric gaps between sequential marker IDs. To limit the number of marker IDs generated the application should pass the image through a threshold filter before calling this funcion. Doing so however does not necessarily limit the maximum marker ID value generated by this function. Note that these functions currently only support image ROI sizes up to 4 gigapixels. Also note that these functions work directly in the destination image so destination pitch MUST be equal to destination ROI.width * sizeof(Npp32u) and even if destination pitch is greater than that the output will be in that format. If this doesn't work for you use the single image version of these functions or cudaMemCopy2D can be called for each output image to restore the original pitch. Note that all source and destination images in the batch list must contain enough device memory to support the full ROI size. ROIs in descriptor lists are ignored in these functions.

The algorithm used in this implementation is based on the one described in "An Optimized Union-Find Algorithm for Connected Components Labeling Using GPUs" by Jun Chen and others.

Note that the destination images in these functions must be allocated with cudaMalloc() and NOT cudaMallocPitch(). Also the pitch of the output image MUST be set to oSizeROI.width * sizeof(Npp32u).

NppStatus nppiLabelMarkersUFBatch_8u32u_C1R_Ctx (const NppiImageDescriptor *pSrcBatchList, NppiImageDescriptor *pDstBatchList, int nBatchSize, NppiSize oSizeROI, NppiNorm eNorm, NppStreamContext nppStreamCtx)
 1 channel 8-bit to 32-bit unsigned integer label markers image generation with fixed destination ROI applied to all images in the batch. More...
 
NppStatus nppiLabelMarkersUFBatch_8u32u_C1R (const NppiImageDescriptor *pSrcBatchList, NppiImageDescriptor *pDstBatchList, int nBatchSize, NppiSize oSizeROI, NppiNorm eNorm)
 
NppStatus nppiLabelMarkersUFBatch_16u32u_C1R_Ctx (const NppiImageDescriptor *pSrcBatchList, NppiImageDescriptor *pDstBatchList, int nBatchSize, NppiSize oSizeROI, NppiNorm eNorm, NppStreamContext nppStreamCtx)
 1 channel 16-bit to 32-bit unsigned integer label markers image generation with fixed destination ROI applied to all images in the batch. More...
 
NppStatus nppiLabelMarkersUFBatch_16u32u_C1R (const NppiImageDescriptor *pSrcBatchList, NppiImageDescriptor *pDstBatchList, int nBatchSize, NppiSize oSizeROI, NppiNorm eNorm)
 
NppStatus nppiLabelMarkersUFBatch_32u_C1R_Ctx (const NppiImageDescriptor *pSrcBatchList, NppiImageDescriptor *pDstBatchList, int nBatchSize, NppiSize oSizeROI, NppiNorm eNorm, NppStreamContext nppStreamCtx)
 1 channel 32-bit to 32-bit unsigned integer label markers image generation with fixed destination ROI applied to all images in the batch. More...
 
NppStatus nppiLabelMarkersUFBatch_32u_C1R (const NppiImageDescriptor *pSrcBatchList, NppiImageDescriptor *pDstBatchList, int nBatchSize, NppiSize oSizeROI, NppiNorm eNorm)
 

LabelMarkersUFBatchAdvanced

Generate image connected region label markers to be used for later image segmentation for a batched list of images.

A connected region is any pixel region where all pixels in the region have the same pixel value. Note that marker label IDs generally increase in value from image left to right and top to bottom they are not generated in any particular order and there may be numeric gaps between sequential marker IDs. To limit the number of marker IDs generated the application should pass the image through a threshold filter before calling this funcion. Doing so however does not necessarily limit the maximum marker ID value generated by this function. Note that these functions currently only support image ROI sizes up to 4 gigapixels. Also note that these functions work directly in the destination image so destination pitch MUST be equal to destination ROI.width * sizeof(Npp32u) for each destination image in the list and even if the destination image pitch is greater than that of the output will be in that format. If this doesn't work for you use the single image version of these functions or cudaMemCopy2D can be called for each output image to restore the original pitch. Note that all source and destination images in the batch list must contain enough device memory to contain their specified ROI size.

The algorithm used in this implementation is based on the one described in "An Optimized Union-Find Algorithm for Connected Components Labeling Using GPUs" by Jun Chen and others.

Note that the destination images in these functions must be allocated with cudaMalloc() and NOT cudaMallocPitch(). Also the pitch of the output image MUST be set to oSizeROI.width * sizeof(Npp32u).

NppStatus nppiLabelMarkersUFBatch_8u32u_C1R_Advanced_Ctx (const NppiImageDescriptor *pSrcBatchList, NppiImageDescriptor *pDstBatchList, int nBatchSize, NppiSize oMaxSizeROI, NppiNorm eNorm, NppStreamContext nppStreamCtx)
 1 channel 8-bit to 32-bit unsigned integer label markers image generation with per image destination ROI. More...
 
NppStatus nppiLabelMarkersUFBatch_8u32u_C1R_Advanced (const NppiImageDescriptor *pSrcBatchList, NppiImageDescriptor *pDstBatchList, int nBatchSize, NppiSize oMaxSizeROI, NppiNorm eNorm)
 
NppStatus nppiLabelMarkersUFBatch_16u32u_C1R_Advanced_Ctx (const NppiImageDescriptor *pSrcBatchList, NppiImageDescriptor *pDstBatchList, int nBatchSize, NppiSize oMaxSizeROI, NppiNorm eNorm, NppStreamContext nppStreamCtx)
 1 channel 16-bit to 32-bit unsigned integer label markers image generation with per image destination ROI. More...
 
NppStatus nppiLabelMarkersUFBatch_16u32u_C1R_Advanced (const NppiImageDescriptor *pSrcBatchList, NppiImageDescriptor *pDstBatchList, int nBatchSize, NppiSize oMaxSizeROI, NppiNorm eNorm)
 
NppStatus nppiLabelMarkersUFBatch_32u_C1R_Advanced_Ctx (const NppiImageDescriptor *pSrcBatchList, NppiImageDescriptor *pDstBatchList, int nBatchSize, NppiSize oMaxSizeROI, NppiNorm eNorm, NppStreamContext nppStreamCtx)
 1 channel 32-bit to 32-bit unsigned integer label markers image generation with per image destination ROI. More...
 
NppStatus nppiLabelMarkersUFBatch_32u_C1R_Advanced (const NppiImageDescriptor *pSrcBatchList, NppiImageDescriptor *pDstBatchList, int nBatchSize, NppiSize oMaxSizeROI, NppiNorm eNorm)
 

Detailed Description

Generate image connected region label markers to be used for later image segmentation.

These functions have been deprecated. Use LabelMarkersUF functions instead.

Function Documentation

NppStatus nppiLabelMarkersUF_16u32u_C1R ( Npp16u pSrc,
int  nSrcStep,
Npp32u pDst,
int  nDstStep,
NppiSize  oSizeROI,
NppiNorm  eNorm,
Npp8u pBuffer 
)
NppStatus nppiLabelMarkersUF_16u32u_C1R_Ctx ( Npp16u pSrc,
int  nSrcStep,
Npp32u pDst,
int  nDstStep,
NppiSize  oSizeROI,
NppiNorm  eNorm,
Npp8u pBuffer,
NppStreamContext  nppStreamCtx 
)

1 channel 16-bit to 32-bit unsigned integer label markers image generation.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
eNormType of pixel connectivity test to use, nppiNormInf will use 8 way connectivity and nppiNormL1 will use 4 way connectivity.
pBufferPointer to device memory scratch buffer at least as large as value returned by the corresponding LabelMarkersUFGetBufferSize call.
nppStreamCtxApplication Managed Stream Context.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiLabelMarkersUF_32u_C1R ( Npp32u pSrc,
int  nSrcStep,
Npp32u pDst,
int  nDstStep,
NppiSize  oSizeROI,
NppiNorm  eNorm,
Npp8u pBuffer 
)
NppStatus nppiLabelMarkersUF_32u_C1R_Ctx ( Npp32u pSrc,
int  nSrcStep,
Npp32u pDst,
int  nDstStep,
NppiSize  oSizeROI,
NppiNorm  eNorm,
Npp8u pBuffer,
NppStreamContext  nppStreamCtx 
)

1 channel 32-bit to 32-bit unsigned integer label markers image generation.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
eNormType of pixel connectivity test to use, nppiNormInf will use 8 way connectivity and nppiNormL1 will use 4 way connectivity.
pBufferPointer to device memory scratch buffer at least as large as value returned by the corresponding LabelMarkersUFGetBufferSize call.
nppStreamCtxApplication Managed Stream Context.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiLabelMarkersUF_8u32u_C1R ( Npp8u pSrc,
int  nSrcStep,
Npp32u pDst,
int  nDstStep,
NppiSize  oSizeROI,
NppiNorm  eNorm,
Npp8u pBuffer 
)
NppStatus nppiLabelMarkersUF_8u32u_C1R_Ctx ( Npp8u pSrc,
int  nSrcStep,
Npp32u pDst,
int  nDstStep,
NppiSize  oSizeROI,
NppiNorm  eNorm,
Npp8u pBuffer,
NppStreamContext  nppStreamCtx 
)

1 channel 8-bit to 32-bit unsigned integer label markers image generation.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
pDstDestination-Image Pointer.
nDstStepDestination-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
eNormType of pixel connectivity test to use, nppiNormInf will use 8 way connectivity and nppiNormL1 will use 4 way connectivity.
pBufferPointer to device memory scratch buffer at least as large as value returned by the corresponding LabelMarkersUFGetBufferSize call.
nppStreamCtxApplication Managed Stream Context.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiLabelMarkersUFBatch_16u32u_C1R ( const NppiImageDescriptor pSrcBatchList,
NppiImageDescriptor pDstBatchList,
int  nBatchSize,
NppiSize  oSizeROI,
NppiNorm  eNorm 
)
NppStatus nppiLabelMarkersUFBatch_16u32u_C1R_Advanced ( const NppiImageDescriptor pSrcBatchList,
NppiImageDescriptor pDstBatchList,
int  nBatchSize,
NppiSize  oMaxSizeROI,
NppiNorm  eNorm 
)
NppStatus nppiLabelMarkersUFBatch_16u32u_C1R_Advanced_Ctx ( const NppiImageDescriptor pSrcBatchList,
NppiImageDescriptor pDstBatchList,
int  nBatchSize,
NppiSize  oMaxSizeROI,
NppiNorm  eNorm,
NppStreamContext  nppStreamCtx 
)

1 channel 16-bit to 32-bit unsigned integer label markers image generation with per image destination ROI.

Parameters
pSrcBatchListSource-Batch-Images Pointer device memory pointer to the list of device memory source image descriptors, oSize element is ignored.
pDstBatchListDestination-Batch-Images Pointer device memory pointer to the list of device memory destination image descriptors.
nBatchSizeNumber of NppiImageDescriptor structures processed in this call (must be > 1).
oMaxSizeROIRegion-of-Interest (ROI) maximum ROI width and height of ALL images in the batch.
eNormType of pixel connectivity test to use, nppiNormInf will use 8 way connectivity and nppiNormL1 will use 4 way connectivity for all images in batch.
nppStreamCtxApplication Managed Stream Context.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiLabelMarkersUFBatch_16u32u_C1R_Ctx ( const NppiImageDescriptor pSrcBatchList,
NppiImageDescriptor pDstBatchList,
int  nBatchSize,
NppiSize  oSizeROI,
NppiNorm  eNorm,
NppStreamContext  nppStreamCtx 
)

1 channel 16-bit to 32-bit unsigned integer label markers image generation with fixed destination ROI applied to all images in the batch.

Parameters
pSrcBatchListSource-Batch-Images Pointer device memory pointer to the list of device memory source image descriptors, oSize element is ignored.
pDstBatchListDestination-Batch-Images Pointer device memory pointer to the list of device memory destination image descriptors, oSize element is ignored.
nBatchSizeNumber of NppiImageDescriptor structures processed in this call (must be > 1).
oSizeROIRegion-of-Interest (ROI).
eNormType of pixel connectivity test to use, nppiNormInf will use 8 way connectivity and nppiNormL1 will use 4 way connectivity for all images in batch.
nppStreamCtxApplication Managed Stream Context.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiLabelMarkersUFBatch_32u_C1R ( const NppiImageDescriptor pSrcBatchList,
NppiImageDescriptor pDstBatchList,
int  nBatchSize,
NppiSize  oSizeROI,
NppiNorm  eNorm 
)
NppStatus nppiLabelMarkersUFBatch_32u_C1R_Advanced ( const NppiImageDescriptor pSrcBatchList,
NppiImageDescriptor pDstBatchList,
int  nBatchSize,
NppiSize  oMaxSizeROI,
NppiNorm  eNorm 
)
NppStatus nppiLabelMarkersUFBatch_32u_C1R_Advanced_Ctx ( const NppiImageDescriptor pSrcBatchList,
NppiImageDescriptor pDstBatchList,
int  nBatchSize,
NppiSize  oMaxSizeROI,
NppiNorm  eNorm,
NppStreamContext  nppStreamCtx 
)

1 channel 32-bit to 32-bit unsigned integer label markers image generation with per image destination ROI.

Parameters
pSrcBatchListSource-Batch-Images Pointer device memory pointer to the list of device memory source image descriptors, oSize element is ignored.
pDstBatchListDestination-Batch-Images Pointer device memory pointer to the list of device memory destination image descriptors.
nBatchSizeNumber of NppiImageDescriptor structures processed in this call (must be > 1).
oMaxSizeROIRegion-of-Interest (ROI) maximum ROI width and height of ALL images in the batch.
eNormType of pixel connectivity test to use, nppiNormInf will use 8 way connectivity and nppiNormL1 will use 4 way connectivity for all images in batch.
nppStreamCtxApplication Managed Stream Context.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiLabelMarkersUFBatch_32u_C1R_Ctx ( const NppiImageDescriptor pSrcBatchList,
NppiImageDescriptor pDstBatchList,
int  nBatchSize,
NppiSize  oSizeROI,
NppiNorm  eNorm,
NppStreamContext  nppStreamCtx 
)

1 channel 32-bit to 32-bit unsigned integer label markers image generation with fixed destination ROI applied to all images in the batch.

Parameters
pSrcBatchListSource-Batch-Images Pointer device memory pointer to the list of device memory source image descriptors, oSize element is ignored.
pDstBatchListDestination-Batch-Images Pointer device memory pointer to the list of device memory destination image descriptors, oSize element is ignored.
nBatchSizeNumber of NppiImageDescriptor structures processed in this call (must be > 1).
oSizeROIRegion-of-Interest (ROI).
eNormType of pixel connectivity test to use, nppiNormInf will use 8 way connectivity and nppiNormL1 will use 4 way connectivity for all images in batch.
nppStreamCtxApplication Managed Stream Context.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiLabelMarkersUFBatch_8u32u_C1R ( const NppiImageDescriptor pSrcBatchList,
NppiImageDescriptor pDstBatchList,
int  nBatchSize,
NppiSize  oSizeROI,
NppiNorm  eNorm 
)
NppStatus nppiLabelMarkersUFBatch_8u32u_C1R_Advanced ( const NppiImageDescriptor pSrcBatchList,
NppiImageDescriptor pDstBatchList,
int  nBatchSize,
NppiSize  oMaxSizeROI,
NppiNorm  eNorm 
)
NppStatus nppiLabelMarkersUFBatch_8u32u_C1R_Advanced_Ctx ( const NppiImageDescriptor pSrcBatchList,
NppiImageDescriptor pDstBatchList,
int  nBatchSize,
NppiSize  oMaxSizeROI,
NppiNorm  eNorm,
NppStreamContext  nppStreamCtx 
)

1 channel 8-bit to 32-bit unsigned integer label markers image generation with per image destination ROI.

Parameters
pSrcBatchListSource-Batch-Images Pointer device memory pointer to the list of device memory source image descriptors, oSize element is ignored.
pDstBatchListDestination-Batch-Images Pointer device memory pointer to the list of device memory destination image descriptors.
nBatchSizeNumber of NppiImageDescriptor structures processed in this call (must be > 1).
oMaxSizeROIRegion-of-Interest (ROI) maximum ROI width and height of ALL images in the batch.
eNormType of pixel connectivity test to use, nppiNormInf will use 8 way connectivity and nppiNormL1 will use 4 way connectivity for all images in batch.
nppStreamCtxApplication Managed Stream Context.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiLabelMarkersUFBatch_8u32u_C1R_Ctx ( const NppiImageDescriptor pSrcBatchList,
NppiImageDescriptor pDstBatchList,
int  nBatchSize,
NppiSize  oSizeROI,
NppiNorm  eNorm,
NppStreamContext  nppStreamCtx 
)

1 channel 8-bit to 32-bit unsigned integer label markers image generation with fixed destination ROI applied to all images in the batch.

Parameters
pSrcBatchListSource-Batch-Images Pointer device memory pointer to the list of device memory source image descriptors, oSize element is ignored.
pDstBatchListDestination-Batch-Images Pointer device memory pointer to the list of device memory destination image descriptors, oSize element is ignored.
nBatchSizeNumber of NppiImageDescriptor structures processed in this call (must be > 1).
oSizeROIRegion-of-Interest (ROI).
eNormType of pixel connectivity test to use, nppiNormInf will use 8 way connectivity and nppiNormL1 will use 4 way connectivity for all images in batch.
nppStreamCtxApplication Managed Stream Context.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiLabelMarkersUFGetBufferSize_32u_C1R ( NppiSize  oSizeROI,
int *  hpBufferSize 
)

Calculate scratch buffer size needed 1 channel 32-bit unsigned integer LabelMarkersUF function based on destination image oSizeROI width and height.

Parameters
oSizeROIRegion-of-Interest (ROI).
hpBufferSizeRequired buffer size in bytes.

Copyright © 2009-2022 NVIDIA CORPORATION AND AFFILIATES