Usage of ippiMorphAdvInitAlloc

Usage of ippiMorphAdvInitAlloc

Hi,

I am new to this morphological operation function, ippiMorphOpenBorder. Does anyone knows how to use it?

My attempt to this is as follows:

IppiSize imgSz = { 320, 240 };
IppiSize maskSz = { 3, 3 };
IppiPoint anchorPt = { 1, 1 };
int buffer1Step, buffer2Step;

int dx, dy;

dx = maskSz.width - anchorPt.x;
dy = maskSz.height - anchorPt.y;

IppiSize imgBorderSz = { imgSz.width + dx + dx, imgSz.height + dy + dy };

buffer1Step = buffer2Step = (imgSz.width + dx + dx) * sizeof(Ipp32f);

Ipp8u* pMask = ippsMalloc_8u(maskSz.width * maskSz.height);
Ipp32f* pBuffer1 = ippsMalloc_32f((imgSz.width + dx) * (imgSz.height + dy));
IppiMorphAdvState* pState = NULL;

IppStatus stat = ippiSet_32f_C1IR(1.5f, pBuffer1, buffer1Step, imgBorderSz);

// I got ippStsMemAllocErr error over here.
// I am not sure about this error (error on the pMask or pState?).
stat = ippiMorphAdvInitAlloc_32f_C1R(&pState, imgSz, pMask, maskSz, anchorPt);

stat = ippiCopyReplicateBorder_32f_C1IR(pBuffer1, buffer1Step, imgSz, imgBorderSz, anchorPt.x, anchorPt.y);
stat = ippiMorphOpenBorder_32f_C1R(pBuffer1, buffer1Step, buffer2, buffer2Step, imgSz, ippBorderRepl, pState);

Regards,

I2R D&T Team

1 条帖子 / 0 全新
如需更全面地了解编译器优化,请参阅优化注意事项