Canny

Implements Canny algorithm for edge detection.

Syntax

IppStatus ippiCanny_16s8u_C1R(Ipp16s* pSrcDx, int srcDxStep, Ipp16s* pSrcDy, int srcDyStep, Ipp8u* pDstEdges, int dstEdgeStep, IppiSize roiSize, Ipp32f lowThresh, Ipp32f highThresh, Ipp8u* pBuffer);

IppStatus ippiCanny_32f8u_C1R(Ipp32f* pSrcDx, int srcDxStep, Ipp32f* pSrcDy, int srcDyStep, Ipp8u* pDstEdges, int dstEdgeStep, IppiSize roiSize, Ipp32f lowThresh, Ipp32f highThresh, Ipp8u* pBuffer);

Parameters

pSrcDx
Pointer to the source image ROI x-derivative.
srcDxStep
Distance in bytes between starts of consecutive lines in the source image pSrcDx.
pSrcDy
Pointer to the source image ROI y-derivative.
srcDyStep
Distance in bytes between starts of consecutive lines in the source image pSrcDy.
pDstEdges
Pointer to the output array of the detected edges.
dstEdgeStep
Distance in bytes between starts of consecutive lines in the output image.
roiSize
Size of the source image ROI in pixels.
lowThresh
Lower threshold for edges detection.
highThresh
Upper threshold for edges detection.
pBuffer
Pointer to the pre-allocated temporary buffer.

Description

The function ippiCanny is declared in the ippcv.h file. It operates with ROI (see Regions of Interest in Intel IPP). This function finds edges in the source image ROI and stores them into the output image pDstEdges using the Canny algorithm. The function requires a temporary working buffer; its size should be computed previously by calling the function ippiCannyGetSize.

Example “Edge detection using the ippiCanny function” shows how to use the function ippiCanny_16s8u_C1R.

Return Values

ippStsNoErr

Indicates no error. Any other value indicates an error or a warning.

ippStsNullPtrErr

Indicates an error condition if one of the specified pointers is NULL.

ippStsSizeErr

Indicates an error condition if pRoiSize has a field with zero or negative value.

ippStsStepErr

Indicates an error condition if srcDxStep, srcDyStep or dstEdgeStep is less than roi.width * <pixelSize>.

ippStsBadArgErr

Indicates an error when lowThresh is negative or highThresh is less than lowThresh.

ippStsNotEvenStepErr

Indicates an error condition if one of the step values is not divisible by 2 for 16s images, and by 4 for 32f images.

Edge detection using the ippiCanny function

    IppStatus sts;
    Ipp32f low=8.0f, high=12.0f;
    int size, size1, srcStep, dxStep, dyStep, dstStep;
    IppiSize roi;
    Ipp8u *src, *dst, *buffer;
    Ipp16s *dx, *dy;
    ...
    sts = ippiFilterSobelNegVertGetBufferSize_8u16s_C1R(roi, ippMskSize3x3, &size);
    sts = ippiFilterSobelHorizGetBufferSize_8u16s_C1R(roi, ippMskSize3x3, &size1);
    if (size<size1) size=size1;
    ippiCannyGetSize(roi, &size1);
    if (size<size1) size=size1;
    buffer = ippsMalloc_8u(size);
    sts = ippiFilterSobelNegVertBorder_8u16s_C1R (src, srcStep, dx, dxStep, roi,
                                            ippMskSize3x3, ippBorderRepl, 0, buffer);
    sts = ippiFilterSobelHorizBorder_8u16s_C1R(src, srcStep, dy, dyStep, roi,
                                            ippMskSize3x3, ippBorderRepl, 0, buffer);
    sts = ippiCanny_16s8u_C1R(dx, dxStep, dy, dyStep, dst, dstStep, roi, low, 
                                            high, buffer);
    ippsFree(buffer);


Submit feedback on this help topic

Copyright © 2000 - 2011, Intel Corporation. All rights reserved.