Developer Reference for Intel® Integrated Performance Primitives
Compares pixel values of a source image to a given value using a specified compare operation.
Case 1: Operation on one-channel data
IppStatus ippiCompareC_<mod>(const Ipp<datatype>* pSrc, int srcStep, Ipp<datatype> value, Ipp8u* pDst, int dstStep, IppiSize roiSize, IppCmpOp ippCmpOp);
Supported values for mod:
8u_C1R |
16u_C1R |
16s_C1R |
32f_C1R |
Case 2: Operation on multi-channel data
IppStatus ippiCompareC_<mod>(const Ipp<datatype>* pSrc, int srcStep, const Ipp<datatype> value[3], Ipp8u* pDst, int dstStep, IppiSize roiSize, IppCmpOp ippCmpOp);
Supported values for mod:
8u_C3R |
16u_C3R |
16s_C3R |
32f_C3R |
IppStatus ippiCompareC_<mod>(const Ipp<datatype>* pSrc, int srcStep, const Ipp<datatype> value[4], Ipp8u* pDst, int dstStep, IppiSize roiSize, IppCmpOp ippCmpOp);
Supported values for mod:
8u_C4R |
16u_C4R |
16s_C4R |
32f_C4R |
IppStatus ippiCompareC_<mod>(const Ipp<datatype>* pSrc, int srcStep, const Ipp<datatype> value[3], Ipp8u* pDst, int dstStep, IppiSize roiSize, IppCmpOp ippCmpOp);
Supported values for mod:
8u_AC4R |
16u_AC4R |
16s_AC4R |
32f_AC4R |
ippi.h
Headers: ippcore.h, ippvm.h, ipps.h
Libraries: ippcore.lib, ippvm.lib, ipps.lib
pSrc |
Pointer to the source image ROI. |
srcStep |
Distance in bytes between starts of consecutive lines in the source image. |
value |
The value to compare each pixel to. In case of multi-channel data, an array of separate values (one for each channel). |
pDst |
Pointer to the destination image ROI. |
dstStep |
Distance in bytes between starts of consecutive lines in the destination image. |
roiSize |
Size of the source and destination ROI in pixels. |
ippCmpOp |
Compare operation to be used for comparing the pixel values. |
This function operates with ROI (Regions of Interest in Intel IPP).
This function compares pixels of the each channel of the source image ROI pSrc to a given value specified for each channel using the ippCmpOp compare operation, and writes the results to a one-channel Ipp8u image pDst. If the result of the compare is true, that is, all pixels of all channels meet the specified condition, then the corresponding output pixel is set to an IPP_MAX_8U value; otherwise, it is set to 0.
ippStsNoErr |
Indicates no error. Any other value indicates an error or a warning. |
ippStsNullPtrErr |
Indicates an error condition if one of the specified pointer is NULL. |
ippStsSizeErr |
Indicates an error condition if roiSize has a field with zero or negative value. |
ippStsStepErr |
Indicates an error condition if srcStep or dstStep has a zero or negative value. |
The code example below shows how to use the comparison function and create a mask image:
IppStatus compare ( void ) { Ipp8u x[5*4], y[5*4]; IppiSize roi = {5,4}; int i; for( i=0; i<5*4; ++i ) x[i] = (Ipp8u)i; return ippiCompareC_8u_C1R ( x, 5, 7, y, 5, roi, ippCmpGreater ); }
The mask image y contains:
00 00 00 00 00 00 00 00 FF FF FF FF FF FF FF FF FF FF FF FF