CompareC

Compares pixel values of a source image to a given value using a specified compare operation.

Syntax

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

8u_AC4R

16u_AC4R

16s_AC4R

32f_AC4R

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

Parameters

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.

Description

The function ippiCompareC is declared in the ippi.h file. It 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.

Example “Comparing Image to a Constant Value” shows how to use the comparison function and create a mask image:

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 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.

Comparing Image to a Constant Value

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

Submit feedback on this help topic

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