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.

probl. with understanding matching-functions

Deleted_U_Intel
Employee
621 Views
Hello,

i'm quite new to the IPP and tried to write a little
program for testing ippiMatchTemplate, but the output of
the program is not what i expected. I think it has
to be 3 by 3 ((W-w+1)*(H-h+1)), but it seems to be only 1 by 3 (look at code).
What is my mistake?

Here's the code:

int i, j;

IppiSize srcROI;
srcROI.width = 5;
srcROI.height = 5;

IppiSize tplROI;
tplROI.width = 3;
tplROI.height = 3;

Ipp8u testpic[] = {
128, 0, 0, 0, 128,
0, 128, 0, 128, 0,
0, 0, 128, 0, 0,
0, 128, 0, 128, 0,
128, 0, 0, 0, 128 };

Ipp8u testtpl[] = {
128, 0, 128,
0, 128, 0,
128, 0, 128};

// i thought the result should be a 3 by 3 image with
// largest value in the mid

int resStep;
int resSize = 5-3+1;
Ipp32f * res = ippiMalloc_32f_C1(resSize,resSize,&resStep);

int bufSize;
int mpicstep, mtplstep;
Ipp8u * mtestpic, *mtesttpl;

mtestpic = ippiMalloc_8u_C1(5,5,&mpicstep);
mtesttpl = ippiMalloc_8u_C1(3,3,&mtplstep);

for(j=0; j5; j++)
for(i=0; i5; i++) mtestpic[i+j*mpicstep] = testpic[i+j*5];

for(j=0; j3; j++)
for(i=0; i3; i++) mtesttpl[i+j*mtplstep] = testtpl[i+j*3];

for(j=0; j3; j++)
for(i=0; i3; i++) res[i+j*resStep] = 3.3f;

ippiMatchTemplateGetBufSize_CorrNormed(
srcROI, tplROI, ipp8u, &bufSize);

Ipp8u* buffer = ippsMalloc_8u(bufSize);

switch(
ippiMatchTemplate_CorrNormed_8u32f_C1R(
mtestpic, mpicstep, srcROI,
mtesttpl, mtplstep, tplROI,
res, resStep, buffer)
)
{
case ippStsNullPtrErr: printf("ippStsNullPtrErr "); break;
case ippStsSizeErr: printf("ippStsSizeErr "); break;
case ippStsStepErr: printf("ippStsStepErr "); break;
case ippStsNotEvenStepErr: printf("ippStsNotEvenStepErr "); break;
case ippStsNoErr: printf("OK ");
}

printf(" Match-Result: ");
for(j=0; j
{
for(i=0; i
{
printf("%1.3g ", res[i+j*resStep]);
}
printf(" ");
}
ippiFree(mtestpic);
ippiFree(mtesttpl);
ippiFree(res);
ippsFree(buffer);



Thanks in advance,

J. Blaser
0 Kudos
2 Replies
chobanu_p_m1
Beginner
621 Views
hi!

none of the links works
could you tell me, please, what whould be the correct output in this example in case it woul de corrected (the error with indexes, i mean)
should the output matrix be symmentic?

regards,
Petr
0 Kudos
Reply