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

iipiSqrDistanceSame_Norm normalization

nose00
Beginner
461 Views
Hello,

I'm using the image proximity measure iipiSqrDistanceSame_Norm and I don't get how the normalization is done.
I have done the calculations on the sample of the manual by myself and I don't get the same results.han

Could anybody help me?
Thanks in advanced,

kind regards
pepa
0 Kudos
4 Replies
Vladimir_Dudnik
Employee
461 Views

Hello,

could you please share piece of code demosntrating how do you use IPP function?

Regards,
Vladimir
0 Kudos
nose00
Beginner
461 Views

Hello Vladimir,
here the piece of code. I#m using C#.

float[] source = new float[] {2, 2, 2, 2, 2,
2, 1, 1, 2, 2,
2, 1, 1, 2, 2,
2, 1, 1, 2, 2 };

float[] template = new float[] {1, 1, 2,
1, 1, 2,
1, 1, 2};

float[] dest = new float[5*4];

IppiSize sourceRoi = new IppiSize(5, 4);
IppiSize templateRoi = new IppiSize(3, 3);
int sourceStep = 5*sizeof(float);
int templateStep = 3*sizeof(float);
int destStep = 5*sizeof(float);

fixed(float* pSource = source, pTemplate= tuple, pDest = dest) {
ippResult = ip.ippiSqrDistanceSame_Norm_32f_C1R(pSource, sourceStep, sourceRoi, pTemplate,
tupleStep, templateRoi, pDest, destStep);
}

Result:
0,72 - 0,56 - 0,44 - 0,46 - 1,06
0,44 - 0,29 - 0,10 - 0,17 - 0,87
0,55 - 0,33 - 0,00 - 0,14 - 0,87
0,89 - 0,68 - 0,41 - 0,44 - 1,06

At row 2, column 2 I get the expected 0.00. But for example row 2, column 3,
Formula:
result(2,3) = [tmpl'(0,0)- src'(0.5, 1.5)]^2 + [tmpl'(0,1)- src'(0.5, 2.5)]^2 + [tmpl'(0,2)- src'(0.5, 3.5)]^2 +
[tmpl'(1,0)- src'(0.5, 1.5)]^2 + [tmpl'(1,1)- src'(0.5, 2.5)]^2 + [tmpl'(1,2)- src'(0.5, 3.5)]^2 +
[tmpl'(2,0)- src'(0.5, 1.5)]^2 + [tmpl'(2,1)- src'(0.5, 2.5)]^2 + [tmpl'(2,2)- src'(0.5, 3.5)]^2

tmpl' and src' are the normalized template and source.
I guess, that the point(0.5, 1.5) is rounded to (1,2).

For the row 2, column 3 I don't get 0.14, so I guess I'm not normalizing well. (src'(r,c)= src(r,c)/length
I tried different lengths :
- sqrt(elements^2 of the 3x3 part of the source imgage)
- sqrt(elements^2 of the whole image ??)
and other just to test, but I don't get 0,14

Thanks a lot,
regards pepa


0 Kudos
Igor_B_Intel1
Employee
461 Views
Hi,
SSD values in function with "Same_" suffics are normalized by auto-correlations of source and template images in pixelneighborhood. I manually checked (2,3) pixel and got result(2,3) = 3/sqrt(18*27)=0.14.
Please read "Image Proximity Measures" section in ippiman document for more details.

Igor.
0 Kudos
nose00
Beginner
461 Views
Hi,
SSD values in function with "Same_" suffics are normalized by auto-correlations of source and template images in pixelneighborhood. I manually checked (2,3) pixel and got result(2,3) = 3/sqrt(18*27)=0.14.
Please read "Image Proximity Measures" section in ippiman document for more details.

Igor.

Hi Igor,
thanks a lot for the answer.

Kind regards
Pepa
0 Kudos
Reply