Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

IPP erode issue when eroding entire image

cks2k2
Beginner
1,140 Views
I am trying to apply an erode operation to an entire grayscale image.
Realizing the issues with borders, I use ippiErodeBorderReplicate() but a cross-check with the expected output shows that some pixels (~10) at the top and bottom border are incorrect.
[bash]Ipp8u mask[9] = {0,1,0,1,1,1,0,1,0}; // some random kernel
IppiSize maskSize = {3,3};
IppiPoint anchor = {1,1};
IppiMorphState* morphState = NULL;
IppStatus status;

ippiMorphologyInitAlloc_8u_C1R(dstRoiSize.width, mask, maskSize, anchor, &morphState);

status = ippiErodeBorderReplicate_8u_C1R(pSrc, srcStep, pDst, dstStep, dstRoiSize, ippBorderRepl, morphState);

ippiMorphologyFree(morphState);[/bash]
A copy of the source image is created before the code above is called; source and image have exact same dimensions. ROI has same dimension as source and destination.
0 Kudos
5 Replies
Ying_H_Intel
Moderator
1,140 Views
Hello cks2k2, Coudl you please provide the input and output, And if possible, please add the below code // Print the version of ipp being used const IppLibraryVersion* lib = ippiGetLibVersion(); printf("%s %s %d.%d.%d.%d\n", lib->Name, lib->Version,lib->major, lib->minor, lib->majorBuild, lib->build); in your code and and let me know the result? Regards, Ying H.
0 Kudos
cks2k2
Beginner
1,140 Views
Hi the output that you requested:
lib name: ippiv8l.lib
version: 5.2.108.410
On IPP 5.2.
0 Kudos
Ying_H_Intel
Moderator
1,140 Views

Have you try the latest version?
( geta 30-dayseval version fromIntel Downloads, Registration and Licensing

As you haven't provide the test image,Itried the sample 8-2

#include
#include
#include "ipp.h"

int main()
{


// Print the version of ipp being used
const IppLibraryVersion* lib = ippiGetLibVersion();
printf("%s %s %d.%d.%d.%d\n", lib->Name, lib->Version,lib->major, lib->minor, lib->majorBuild, lib->build);

IppiMorphState* ppState;
IppiSize roiSize = {5, 5};
Ipp8u pMask[3*3] = {1, 1, 1,1, 0, 1,1, 1, 1};
IppiSize maskSize = {3, 3};
IppiPoint anchor = {1, 1};
Ipp8u pSrc[5*5] = {
1, 2, 4, 1, 2,
5, 1, 2, 1, 2,
1, 2, 1, 2, 1,
2, 1, 5, 1, 2};
int srcStep = 5;
int dstStep = 5;
Ipp8u pDst[5*5];
int dstSize = 5;
IppStatus status;
ippiMorphologyInitAlloc_8u_C1R( roiSize.width, pMask, maskSize, anchor,
&ppState);
status = ippiErodeBorderReplicate_8u_C1R( pSrc, srcStep, pDst, dstStep, roiSize,
ippBorderRepl, ppState);

printf ("ippiErodeBorderReplicate return %s\n", ippGetStatusString(status));
ippiMorphologyFree(ppState);
int i=0, j=0;
for ( i=0; i<5; i++)
{
for (j=0;j<5; j++)
printf("%d \t", pDst[i*5+j]);
printf("\n");
}

return 0;

}
I have the below result.

ippiv8-7.0.dll 7.0 build 205.58 7.0.205.1054
ippiErodeBorderReplicate return ippStsNoErr: No error, it's OK
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
0 0 0 0 0
0 0 0 0 0
Press any key to continue . . .


Please try it and let me know if any result.

Regards,
Ying H.

0 Kudos
cks2k2
Beginner
1,140 Views
I have attached the test image. Kernel is 3x3, with values {1,1,1, 0,1,0, 0,1,0} and anchor {1,1}. (T-kernel).
0 Kudos
Ying_H_Intel
Moderator
1,140 Views
Hello Cks2k2,

Could you tell theplace of wrong result you are seeing? And if possible, please try the latest Ipp version?

I print some value of the test image and result image. Theirresultseems ok.

With T mask.

Src:

src[0] [0:9] and src [1][0:9]

103 95 95 102 108 112 112 109 107 108

110 103 104 110 113 113 112 108 108 110

Dst:
dst[0] [0:9] anddst [1][0:9]

95 95 95 95 102 108 109 107 107 107
95 95 95 95 102 108 109 107 107 107

src[510] [250:259] and src [511][250:259]

(110) 112 114 111 109 111 111 115 106 113 112

(110) 111 113 110 108 109 110 114 105 112 111

dst[510] [250:259] anddst [511][250:259]

111 112 110 108 109 110 107 105 107 111

110 111 109 108 109 110 106 105 106 111

Regards,
Ying

0 Kudos
Reply