Hello, say I have an Ipp32s* image array. I want to apply the signum function, which will return -1 for negative pixel values, 1 for positive pixel values, and zero for zero-valued image pixels? I couldn't find a specific IPP function for signum.
链接已复制
1 回复
It could be done like this:
Ipp32s*pSrc; // source image
Ipp32s*pDst; // result image
ippsThreshold_LT_32s_I(pSrc, pDst, len, -1); // replace all values < -1 with -1
ippsThreshold_GT_32s_I(pDst, len, 1); // replace all values > 1 with 1
or if original image doesn't need anymore:
Ipp32s*pSrcDst; // source and result
ippsThreshold_LT_32s_I(pSrcDst, len, -1); // replace all values < -1 with -1
ippsThreshold_GT_32s_I(pSrcDst, len, 1); // replace all values > 1 with 1
