Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Incorrect result from ippiCrossCorr**?

bernt
Beginner
314 Views
(I've also seeked premier support help for this, but to maybe speed things, here goes...)

I experience weird behaviour with the ippi cross correlation routine(s), as follows:

Under is my sample code. I would expect the value of Rf[0][0] to be 1, but it is in fact 0.54999.... The other values are correct as far as I can see. What can I have done wrong?

#include
#define uint8 unsigned char
int main()
{
uint8 M[5][5] = {
{ 0, 100, 0, 0, 0},
{100, 100, 100, 0, 0},
{ 0, 100, 0, 0, 0},
{ 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0}
};
uint8 T[3][3] = {
{ 0, 100, 0},
{100, 100, 100},
{ 0, 100, 0}
};
float Rf[3][3] = {0};
IppiSize srcRoiSize,tplRoiSize;
srcRoiSize.width=5;
srcRoiSize.height=5;
tplRoiSize.width=3;
tplRoiSize.height=3;
ippiCrossCorrValid_NormLevel_8u32f_C1R((void*)M,5,srcRoiSize,(void*)T,3,tplRoiSize,(void*)Rf,3*sizeof(float));
return 0;
}
I can supply a Matlab script that does the same thing, if anyone's interested!
0 Kudos
2 Replies
bernt
Beginner
314 Views
Update :-)

It seems the problem is a step size for the template less than 4. I didn't use the Intel allocation functions for a reason (I have my own library with its own data structures that I normally use). I remember reading that Intel allocations should be used for efficiency, but I might have missed (?) a requirement statement. Also, the ippiCrossCorr* function does not indicate that anything is wrong. Can anyone comment on this?

In any case, here is a more streamlined version of my code. Set nT to 4, and all is well.

#include
#define uint8 unsigned char
#define nM 5
#define nT 3
#define nR (1+nM-nT)
int main()
{
uint8 M[nM][nM] = {
{ 0, 100, 0},
{100, 100, 100},
{ 0, 100, 0},
};
uint8 T[nT][nT] = {
{ 0, 100, 0},
{100, 100, 100},
{ 0, 100, 0},
};
float Rf[nR][nR] = {0};
int res;
IppiSize srcRoiSize = {nM, nM};
IppiSize tplRoiSize = {nT, nT};
res=ippiCrossCorrValid_NormLevel_8u32f_C1R((void*)M,nM,srcRoiSize,(void*)T,nT,tplRoiSize,(void*)Rf,nR*sizeof(float));
return 0;
}
0 Kudos
Vladimir_Dudnik
Employee
314 Views

Hello, could you please try IPP 5.2 beta? We were not able to reproduce the issue on IPP 5.2 beta

Regards,
Vladimir

0 Kudos
Reply