Developer Reference for Intel® Integrated Performance Primitives
Implements Harris corner detection algorithm.
IppStatus ippiHarrisCorner_8u32f_C1R(const Ipp8u* pSrc, int srcStep, Ipp32f* pDst, int dstStep, IppiSize roiSize, IppiDifferentialKernel filterType, IppiMaskSize filterMask, Ipp32u avgWndSize, float k, float scale, IppiBorderType borderType, Ipp8u borderValue, Ipp8u* pBuffer);
IppStatus ippiHarrisCorner_32f_C1R(const Ipp32f* pSrc, int srcStep, Ipp32f* pDst, int dstStep, IppiSize roiSize, IppiDifferentialKernel filterType, IppiMaskSize filterMask, Ipp32u avgWndSize, float k, float scale, IppiBorderType borderType, Ipp32f borderValue, Ipp8u* pBuffer);
ippcv.h
Headers: ippcore.h, ippvm.h, ipps.h, ippi.h
Libraries: ippcore.lib, ippvm.lib, ipps.lib, ippi.lib
ippKernelSobel |
Sobel filter |
ippKernelScharr |
Scharr filter |
ippKernelCentralDiff |
Central differences operator |
Filter Type | Filter Mask |
---|---|
ippKernelSobel | ippMskSize3x3, ippMskSize5x5 |
ippKernelScharr | ippMskSize3x3 |
ippKernelCentralDiff | ippMskSize3x3 |
Linear size of a neighborhood block for averaging.
Harris detector free coefficient.
Destination image scale factor.
Type of border. Possible values are:
ippBorderConst |
Values of all border pixels are set to constant. |
ippBorderRepl |
Border is replicated from the edge pixels. |
ippBorderInMem |
Border is obtained from the source image pixels in memory. |
ippBorderMirror |
Border pixels are mirrored from the source image boundary pixels. |
Mixed borders are also supported. They can be obtained by the bitwise operation OR between ippBorderRepl or ippBorderConst and the following flags:
Constant value(s) to assign to pixels of the constant border. This parameter is applicable only to the ippBorderConst border type. The ippiHarrisCorner function uses the specified constant value only at the first stage of the algorithm. At the third stage, the function uses zero constant border.
This function goes through the following stages to implement the Harris corner detection algorithm:
Computes I(x, y)x and I(x, y)y gradients for each (x, y) pixel of the image. The function computes gradients using the derivative operator specified by the filterType and filterMask parameters.
Computes products of the gradients at each (x, y) pixel of the image:
Performs averaging of the products of gradients over a rectangular neighborhood block at each pixel of the image. The block size is specified by the avgWndSize value.
Defines 2x2 gradient covariance matrix H(x , y) over a rectangular neighborhood block for each (x, y) pixel of the image.
Computes the corner response at each pixel of the image:
where
k is the Harris detector free parameter
The first and third stages of the function algorithm are filtering operations; they use border processing approach that is specified by the borderType parameter.
The scale parameter is applied to the output image.
Before using this function, compute the size of the temporary work buffer using the HarrisCornerGetBufferSize function.
ippStsNoErr |
Indicates no error. Any other value indicates an error or a warning. |
ippStsNullPtrErr |
Indicates an error when pSrc, pDst, or pBufferSize is NULL. |
ippStsSizeErr |
Indicates an error in the following cases:
|
ippStsNotEvenStepErr |
Indicates an error when one of the step values is not divisible by 4 for floating point images. |
ippStsFilterTypeErr |
Indicates an error when filterType has an illegal value. |
ippStsMaskSizeErr |
Indicates an error when filterMask has an illegal value. |
ippStsBorderErr |
Indicates an error when borderType has an illegal value. |
ippStsStepErr |
Indicates an error when srcStep or dstStep has a negative value. |
ippStsInplaceModeNotSupportedErr |
Indicates an error when pSrc and pDst point to the same image. |
The code example below demonstrates how to use the ippiHarrisCorner_8u32f_C1R and ippiHarrisCornerGetBufferSize functions.
... int bufSize = 0; Ipp8u* pBuffer = 0; Ipp32u numChannels = 1; IppStatus status = ippStsNoErr; IppiBorderType borderType = ippBorderRepl; IppiDifferentialKernel filterType = ippFilterSobel; IppiMaskSize filterMask = ippMskSize5x5; Ipp32u avgWndSize = 3; Ipp32f scale = 1.0f; /* Computes the temporary work buffer size */ status = ippiHarrisCornerGetBufferSize(roiSize, filterMask, avgWndSize, ipp8u, numChannels, &bufSize); /* Memory allocation */ if (status != ippStsNoErr) pBuffer = ippsMalloc_8u(bufSize); if (pBuffer != NULL) { /* Harris Corner processing */ status = ippiHarrisCorner_8u32f_C1R(pSrc, srcStep, pDst, dstStep, roiSize, filterType, filterMask, avgWndSize, 0.04f, scale, borderType, 0, pBuffer); ippsFree(pBuffer); } ...