Show / Hide Table of Contents

    Class NPPNativeMethods.NPPi.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. 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.

    Inheritance
    System.Object
    NPPNativeMethods.NPPi.FilterCannyBorder
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: ManagedCuda.NPP
    Assembly: NPP.dll
    Syntax
    public static class FilterCannyBorder

    Methods

    nppiFilterCannyBorder_8u_C1R(CUdeviceptr, Int32, NppiSize, NppiPoint, CUdeviceptr, Int32, NppiSize, DifferentialKernel, MaskSize, Int16, Int16, NppiNorm, NppiBorderType, CUdeviceptr)

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

    Declaration
    public static NppStatus nppiFilterCannyBorder_8u_C1R(CUdeviceptr pSrc, int nSrcStep, NppiSize oSrcSize, NppiPoint oSrcOffset, CUdeviceptr pDst, int nDstStep, NppiSize oSizeROI, DifferentialKernel eFilterType, MaskSize eMaskSize, short nLowThreshold, short nHighThreshold, NppiNorm eNorm, NppiBorderType eBorderType, CUdeviceptr pDeviceBuffer)
    Parameters
    Type Name Description
    CUdeviceptr pSrc

    Source-Image Pointer.

    System.Int32 nSrcStep

    Source-Image Line Step.

    NppiSize oSrcSize

    Source image width and height in pixels relative to pSrc.

    NppiPoint oSrcOffset

    The pixel offset that pSrc points to relative to the origin of the source image.

    CUdeviceptr pDst

    output edge destination_image_pointer.

    System.Int32 nDstStep

    output edge destination_image_line_step.

    NppiSize oSizeROI

    Region-of-Interest (ROI).

    DifferentialKernel eFilterType

    selects between Sobel or Scharr filter type.

    MaskSize eMaskSize

    fixed filter mask size to use.

    System.Int16 nLowThreshold

    low hysteresis threshold value.

    System.Int16 nHighThreshold

    high hysteresis threshold value.

    NppiNorm eNorm

    gradient distance method to use.

    NppiBorderType eBorderType

    The border type operation to be applied at source image border boundaries.

    CUdeviceptr pDeviceBuffer

    pointer to scratch DEVICE memory buffer of size hpBufferSize (see nppiFilterCannyBorderGetBufferSize() above)

    Returns
    Type Description
    NppStatus

    StepError, NotEvenStepError, NullPointerError, AlignmentError, StepError, SizeError

    nppiFilterCannyBorderGetBufferSize(NppiSize, ref Int32)

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

    Declaration
    public static NppStatus nppiFilterCannyBorderGetBufferSize(NppiSize oSizeROI, ref int hpBufferSize)
    Parameters
    Type Name Description
    NppiSize oSizeROI

    Region-of-Interest (ROI).

    System.Int32 hpBufferSize

    Required buffer size. Important: hpBufferSize is a host pointer. \ref general_scratch_buffer.

    Returns
    Type Description
    NppStatus

    StepError, NotEvenStepError, NullPointerError, AlignmentError, StepError, SizeError

    • Improve this Doc
    • View Source
    Back to top Generated by DocFX