Intel® Integrated Performance Primitives
Community support and discussions relating to developing high-performance vision, signal, security, and storage applications.

IPP Thresholding


I'm doing a C# application for visual computing - and needs a RGB thresholding.

Id like to set the RGB24 pixel to e.g. (255,255,255) when the thresholding condition is true. For this I tried the ippiThreshold_Val() function, like below:

unsafe private ipp.IppStatus ThresholdVal(byte* pSrc, byte* pDst, int Width, int Height, int bytePerPixel, byte[] thresholdValues, System.Drawing.Color objCol, ipp.IppCmpOp cmdOp)


ipp.IppStatus st = ipp.IppStatus.ippStsNoErr;

int Stride = bytePerPixel * Width;

ipp.IppiSize roi = new ipp.IppiSize(Width, Height);

byte[] objectValues = new byte[3] { objCol.B, objCol.G, objCol.R };

fixed (byte* fixThresholdValues = thresholdValues)

fixed (byte* fixObjectValues = objectValues)


if (pSrc == pDst)


st = ipp.ip.ippiThreshold_Val_8u_C3IR(pSrc, Stride, roi, fixThresholdValues, fixObjectValues, cmdOp);

// st = ipp.ip.ippiThreshold_8u_C3IR(pSrc, Stride, roi, fixThresholdValues, cmdOp);




st = ipp.ip.ippiThreshold_Val_8u_C3R(pSrc, Stride, pDst, Stride, roi, fixThresholdValues, fixObjectValues, cmdOp);

// st = ipp.ip.ippiThreshold_8u_C3R(pSrc, Stride, pDst, Stride, roi, fixThresholdValues, cmdOp);



return st;


But to my surprise it doesnt work at all seems that nothing happens?

Using the ippiThreshold() instead works better. A threshold is done, but the pixel is not set to the value Im wanting?

Furthermore ultmately I would like the thresholding conditon to be true only if all three thresholding channel criterias are meet, i.e only modify the pixel if e.g. ((PixRedChannel < PixRedThreshold) && (PixGreenChannel < PixGreenThreshold) && (PixBlueChannel < PixBlueThreshold)), is this possible with the IPP?


0 Kudos
2 Replies
New Contributor I


I'll move this to our Intel Integrated Performance Primitives forum, where our Technical Consulting Engineers can assist you.

Best regards,

Aubrey W.
Intel Software Network Support

Can you provide some specific values for your threshhold input function? Your explanation seems to indicate thatyou want to compare agains 255,255,255 -- but that is the maximum value of a one byte value in a 3 byte pixel (RGB) so I wouldn't expect to see any change in the array of pixels.