Hi all,
this question concerns the behaviour of the dilate and erode functions in IPP 3.0. The following sample code is meant to perform an out-of-placedilation with a 5-neighbourhood:
const unsigned char mask[9] = {0, 1, 0, 1, 1, 1, 0, 1, 0};
IppiSize maskSize = {3, 3};
IppiPoint anchor = {1, 1};
int bs1, bs2;
Ipp8u *image1 = (Ipp8u *) ippiMalloc_8u_C1(672,486, &bs1); // bs1 is set to 672 as expected (divisible by 32)
Ipp8u *image2 = (Ipp8u *) ippiMalloc_8u_C1(672,486, &bs2); // same for bs2
IppiSize myroiSize = {672, 486};
istat = ippiDilate_8u_C1R(image1, bs1, image2, bs2, myroiSize, mask, maskSize, anchor);
ippiFree(image2);
ippiFree(image1);
This gives the return code istat: "Stride value is less than the row length". But the strides bs1 and bs2 are 672, and so is myroiSize.width. So what's wrong?
By decreasing the roi width to 670, ippiDilate can be called. When adding these lines just before the call to ippiDilate:
istat = ippiSet_8u_C1R(0, image1, bs1, myroiSize); // set image to black
myroiSize.width = 670; // 671 won't work either
image1[673] = 1; // set one non-zero element, at the (1,1) position in the image
This input data is generated in the lower left corner of image1, as expected:
0 0 0
0 1 0
0 0 0
But this is the corresponding 3x3 corner of image2:
11 1 0
1 1 1
0 1 0
Where does the 11 come from? How do the dilate/erode functions treat borders?
Thanks for your help,
Daniel
Erode/Dilate in IPP 3.0
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione

