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

Performs Canny edge detection on a single channel 8-bit grayscale image and outputs a single channel 8-bit image consisting of 0x00 and 0xFF values with 0xFF representing edge pixels. More...

Functions

NppStatus nppiFilterCannyBorderGetBufferSize (NppiSize oSizeROI, int *hpBufferSize)
 Calculate scratch buffer size needed for the FilterCannyBorder function based on destination image SizeROI width and height. More...
 
NppStatus nppiFilterCannyBorder_8u_C1R_Ctx (const Npp8u *pSrc, int nSrcStep, NppiSize oSrcSize, NppiPoint oSrcOffset, Npp8u *pDst, int nDstStep, NppiSize oSizeROI, NppiDifferentialKernel eFilterType, NppiMaskSize eMaskSize, Npp16s nLowThreshold, Npp16s nHighThreshold, NppiNorm eNorm, NppiBorderType eBorderType, Npp8u *pDeviceBuffer, NppStreamContext nppStreamCtx)
 1 channel 8-bit unsigned grayscale to 1 channel 8-bit unsigned black (0x00) and white (0xFF) image with border control. More...
 
NppStatus nppiFilterCannyBorder_8u_C1R (const Npp8u *pSrc, int nSrcStep, NppiSize oSrcSize, NppiPoint oSrcOffset, Npp8u *pDst, int nDstStep, NppiSize oSizeROI, NppiDifferentialKernel eFilterType, NppiMaskSize eMaskSize, Npp16s nLowThreshold, Npp16s nHighThreshold, NppiNorm eNorm, NppiBorderType eBorderType, Npp8u *pDeviceBuffer)
 

Detailed Description

Performs Canny edge detection on a single channel 8-bit grayscale image and outputs a single channel 8-bit image consisting of 0x00 and 0xFF values with 0xFF representing edge pixels.

The algorithm consists of three phases. The first phase generates two output images consisting of a single channel 16-bit signed image containing magnitude values and a single channel 32-bit floating point image containing the angular direction of those magnitude values. This phase is accomplished by calling the appropriate GradientVectorBorder filter function based on the filter type, filter mask size, and norm type requested. The next phase uses those magnitude and direction images to suppress non-maximum magnitude values which are lower than the values of either of its two nearest neighbors in the same direction as the test magnitude pixel in the 3x3 surrounding magnitude pixel neighborhood. This phase outputs a new magnitude image with non-maximum pixel values suppressed. Finally, in the third phase, the new magnitude image is passed through a hysteresis threshold filter that filters out any magnitude values that are not connected to another edge magnitude value. In this phase, any magnitude value above the high threshold value is automatically accepted, any magnitude value below the low threshold value is automatically rejected. For magnitude values that lie between the low and high threshold, values are only accepted if one of their two neighbors in the same direction in the 3x3 neighborhood around them lies above the low threshold value. In other words, if they are connected to an active edge. J. Canny recommends that the ratio of high to low threshold limit be in the range two or three to one, based on predicted signal-to-noise ratios. The final output of the third phase consists of a single channel 8-bit unsigned image of 0x00 and 0xFF values based on whether they are accepted or rejected during threshold testing.

Currently only the NPP_BORDER_REPLICATE border type operation is supported. Borderless output can be accomplished by using a larger source image than the destination and adjusting oSrcSize and oSrcOffset parameters accordingly.

Function Documentation

NppStatus nppiFilterCannyBorder_8u_C1R ( const Npp8u pSrc,
int  nSrcStep,
NppiSize  oSrcSize,
NppiPoint  oSrcOffset,
Npp8u pDst,
int  nDstStep,
NppiSize  oSizeROI,
NppiDifferentialKernel  eFilterType,
NppiMaskSize  eMaskSize,
Npp16s  nLowThreshold,
Npp16s  nHighThreshold,
NppiNorm  eNorm,
NppiBorderType  eBorderType,
Npp8u pDeviceBuffer 
)
NppStatus nppiFilterCannyBorder_8u_C1R_Ctx ( const Npp8u pSrc,
int  nSrcStep,
NppiSize  oSrcSize,
NppiPoint  oSrcOffset,
Npp8u pDst,
int  nDstStep,
NppiSize  oSizeROI,
NppiDifferentialKernel  eFilterType,
NppiMaskSize  eMaskSize,
Npp16s  nLowThreshold,
Npp16s  nHighThreshold,
NppiNorm  eNorm,
NppiBorderType  eBorderType,
Npp8u pDeviceBuffer,
NppStreamContext  nppStreamCtx 
)

1 channel 8-bit unsigned grayscale to 1 channel 8-bit unsigned black (0x00) and white (0xFF) image with border control.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
oSrcSizeSource image width and height in pixels relative to pSrc.
oSrcOffsetThe pixel offset that pSrc points to relative to the origin of the source image.
pDstoutput edge destination_image_pointer.
nDstStepoutput edge destination_image_line_step.
oSizeROIRegion-of-Interest (ROI).
eFilterTypeselects between Sobel or Scharr filter type.
eMaskSizefixed filter mask size to use.
nLowThresholdlow hysteresis threshold value.
nHighThresholdhigh hysteresis threshold value.
eNormgradient distance method to use.
eBorderTypesource image border type to use use.
pDeviceBufferpointer to scratch DEVICE memory buffer of size hpBufferSize (see nppiFilterCannyBorderGetBufferSize() above)
nppStreamCtxApplication Managed Stream Context.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiFilterCannyBorderGetBufferSize ( NppiSize  oSizeROI,
int *  hpBufferSize 
)

Calculate scratch buffer size needed for the FilterCannyBorder function based on destination image SizeROI width and height.

Parameters
oSizeROIRegion-of-Interest (ROI).
hpBufferSizeRequired buffer size. Important: hpBufferSize is a host pointer. Scratch Buffer and Host Pointer.
Returns
Image Data Related Error Codes, ROI Related Error Codes

Copyright © 2009-2020 NVIDIA Corporation