NVIDIA 2D Image And Signal Performance Primitives (NPP)
Version 11.2.0.*
|
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) |
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.
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.
pSrc | Source-Image Pointer. |
nSrcStep | Source-Image Line Step. |
oSrcSize | Source image width and height in pixels relative to pSrc. |
oSrcOffset | The pixel offset that pSrc points to relative to the origin of the source image. |
pDst | output edge destination_image_pointer. |
nDstStep | output edge destination_image_line_step. |
oSizeROI | Region-of-Interest (ROI). |
eFilterType | selects between Sobel or Scharr filter type. |
eMaskSize | fixed filter mask size to use. |
nLowThreshold | low hysteresis threshold value. |
nHighThreshold | high hysteresis threshold value. |
eNorm | gradient distance method to use. |
eBorderType | source image border type to use use. |
pDeviceBuffer | pointer to scratch DEVICE memory buffer of size hpBufferSize (see nppiFilterCannyBorderGetBufferSize() above) |
nppStreamCtx | Application Managed Stream Context. |
Calculate scratch buffer size needed for the FilterCannyBorder function based on destination image SizeROI width and height.
oSizeROI | Region-of-Interest (ROI). |
hpBufferSize | Required buffer size. Important: hpBufferSize is a host pointer. Scratch Buffer and Host Pointer. |