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

Cross correlation does not work

shyweissman
Beginner
294 Views
Here is my sample code that runs but return zero on all return matrix

int

_tmain(int argc, _TCHAR* argv[])

{

IppiSize srcRoiSize, tplRoiSize, SizeMat;

Ipp8u* p_img_src, *p_img_templ,*imgMatr;

srcRoiSize.height = 64;

srcRoiSize.width = 64;

tplRoiSize.height = 32;

tplRoiSize.width = 32;

SizeMat.height = 33;

SizeMat.width = 33;

int StepByteSrc,StepByteTempl,stepBytes;

int max_x,max_y;

Ipp8u max_val;

p_img_src = ippiMalloc_8u_C1(64, 64,&StepByteSrc );

p_img_templ = ippiMalloc_8u_C1(32, 32,&StepByteTempl );

imgMatr = ippiMalloc_8u_C1(33, 33,&stepBytes );

memset((void*)p_img_src,0x80,64*64);

memset((void*)p_img_templ,0x80,32*32);

// memset((void*)imgMatr,0,stepBytes*33);

IppStatus Corr_status =

ippiCrossCorrValid_NormLevel_8u_C1RSfs(p_img_src,StepByteSrc, srcRoiSize,

p_img_templ,StepByteTempl ,tplRoiSize, imgMatr, stepBytes, 0);

ippiMaxIndx_8u_C1R(imgMatr, stepBytes, SizeMat, &max_val, &max_x, &max_y);

ippiFree(imgMatr);

return 0;

}

0 Kudos
5 Replies
Intel_C_Intel
Employee
294 Views
Correlation coeffs are
0 Kudos
Intel_C_Intel
Employee
294 Views
Correlation coeffs are less
0 Kudos
Intel_C_Intel
Employee
293 Views
Abs value of correlation coeffs are less than 1, so 8u results will be always 0 with a scale factor 0. Try scale factor = -8
0 Kudos
shyweissman
Beginner
294 Views

It does not work with -8 eigther.

It always give matrix of zeros unless bytes of template and image contain more than one value ie 0 and 1.

If all bytes of template or image are equall the matrix is all zero.

0 Kudos
Intel_C_Intel
Employee
294 Views
Please look to cross correlation folmula in the manual.
The image mean is subtracted from the image ie zero result will be for constant image or template
0 Kudos
Reply