Intel® Integrated Performance Primitives Developer Guide and Reference

ID 790148
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

ApplyHaarClassifier

Applies a Haar classifier to an image.

Syntax

IppStatus ippiApplyHaarClassifier_32f_C1R(const Ipp32f* pSrc, int srcStep, const Ipp32f* pNorm, int normStep, Ipp8u* pMask, int maskStep, IppiSize roiSize, int* pPositive, Ipp32f threshold, IppiHaarClassifier_32f* pState);

IppStatus ippiApplyHaarClassifier_32s32f_C1R(const Ipp32s* pSrc, int srcStep, const Ipp32f* pNorm, int normStep, Ipp8u* pMask, int maskStep, IppiSize roiSize, int* pPositive, Ipp32f threshold, IppiHaarClassifier_32f* pState);

IppStatus ippiApplyHaarClassifier_32s_C1RSfs(const Ipp32s* pSrc, int srcStep, const Ipp32s* pNorm, int normStep, Ipp8u* pMask, int maskStep, IppiSize roiSize, int* pPositive, Ipp32s threshold, IppiHaarClassifier_32s* pState, int scaleFactor);

Include Files

ippcv.h

Domain Dependencies

Headers: ippcore.h, ippvm.h, ipps.h, ippi.h

Libraries: ippcore.lib, ippvm.lib, ipps.lib, ippi.lib

Parameters

pSrc
Pointer to the ROI in the source image of integrals.
srcStep
Distance, in bytes, between the starting points of consecutive lines in the source image.
pNorm
Pointer to the ROI in the source image of norm factors.
normStep
Distance, in bytes, between the starting points of consecutive lines in the image of the norm factors.
pMask
Pointer to the source and destination image of classification decisions.
maskStep
Distance, in bytes, between the starting points of consecutive lines in the image of classification decisions.
pPositive
Pointer to the number of positive decisions.
roiSize
Size of the source and destination images ROI in pixels.
threshold
Stage threshold value.
pState
Pointer to the Haar classifier structure.
scaleFactor
Scale factor (see Integer Result Scaling).

Description

This function operates with ROI (see Regions of Interest in Intel IPP).

This function applies the Haar classifier to pixels of the source image ROI pSrc. The source image should be in the integral representation, it can be obtained by calling one of the integral functions beforehand. The sum of pixels on feature rectangles is computed as:


Here (yl, xl) and (Yl, Xl) are coordinates of top left and right bottom pixels of l-th rectangle of the feature, and wl is the feature weight. For i = 0. roiSize.height - 1, j = 0. roiSize.width - 1 all pixels referred in the above formula should be allocated in memory.

The input value of pPositive[0] is used as a hint to choose the calculation algorithm. If it is greater than or equal to roiSize.width*roiSize.height, the value of the classifier is calculated in accordance with the above formula for all pixels of the input image. Otherwise the value of the classifier is calculated for all non-zero pixels of pMask image. If the sum is less than threshold than the negative decision is made and the value of the corresponding pixel of the pMask image is set to zero. The number of positive decisions is assigned to the pPositive[0].

Before using this function, you need to compute the size of the state structure using HaarClassifierGetSize and initialize the structure using HaarClassifierInit or TiltedHaarClassifierInit.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error when one of the specified pointers is NULL.

ippStsSizeErr

Indicates an error when roiSize has a field with a zero or negative value.

ippStsStepErr

Indicates an error when one of the image step values is less than roiSize.width*<pixelSize>.

ippStsNorEvenStepErr

Indicates an error when one of the image step values is not divisible by 4 for 32-bit images.

See Also