I'm attempting to translate a matlab image convolution (conv2) to c++ using the ipp libs. My issue is that the only options provided by the ippiConv_ are 'valid' and 'full'. conv2 in matlab provides 'valid', 'full', and 'same' of which the code i'm trying to translate uses the 'same' option. I have the 'valid' option working, however the borders of the image don't match the output of matlab (obviously). Is there a way to match the 'same' functionality? Also, if i try to do a 'full' convolution using ippiConv, my returned buffer size is incorrect. If i try to hard code the size to something big, then run the convolution it crashes...not sure why. Can someone help?
Sample code below.
Ipp8u* pBuffer = nullptr; IppStatus status = ippStsNoErr; IppEnum algType = (IppEnum)(ippAlgAuto | ippiROIValid); int32_t buffSizeBytes = 0; status = ippiConvGetBufferSize(srcRoiSize, tplRoiSize, ipp32f, 1, algType, &buffSizeBytes); pBuffer = ippsMalloc_8u(buffSizeBytes); outImg.Clear(); status = ippiConv_32f_C1R( srcImg[0], srcImg.Cols() * sizeof(float), srcRoiSize, tpl[0], tpl.Cols() * sizeof(float), tplRoiSize, outImg[0], outImg.Cols() * sizeof(float), algType, pBuffer); if (pBuffer != nullptr) ippsFree(pBuffer);