Community
cancel
Showing results for 
Search instead for 
Did you mean: 
royvm101
Beginner
73 Views

Is there a NON normalized function such as ippiSqrDistanceValid_Norm_8u32f_C1R ?


the function ippiSqrDistanceValid_Norm_8u32f_C1R matches a template to an image by sliding the template on the image and calculating the normalized square distance.
Is there such a function that does the same but does not normalize the result by the norms of the template and the image portion overlapping the template ?
0 Kudos
9 Replies
igorastakhov
New Contributor II
73 Views

I can suggest only ippiCrossCorrValid_8u32f_C1R - there is no not normalized SqrDistance in IPP - but you can use CrossCorr and search for maximum coefficient instead of using SqrDistance and searching for minimum.

Regards,
Igor
royvm101
Beginner
73 Views

I believe that a square distance between a sliding template and an image is important. It should be a minor change from the code of the existing normalized function.
Is there a way to ask Intel to ask for the implementation of such a function ? Is there a high likelihood that the request will be addressed ?
igorastakhov
New Contributor II
73 Views

IPP has more than 12 years history and you are the first one who has asked for non-normalized SqrDistance - could you clarify the purposeof having the non-normalized version? IPP already has more than 12000 functions - we can't inflate it infinitelly.

Regards,
Igor
royvm101
Beginner
73 Views

Non normalized matching functions are crucial to differentiate between objects with similar shape but different colors.

Here is a general example:

Suppose we look for a bright circle, a bright line or any other simple shape on a darker image. If we use a normalized distance, then most bright circles, lines, etc. (of similar size and shape) will get a good matching grade, regardless of their actual values. In non-artificial images, it is most likely that we will be flooded with a huge number of matches, which differs a lot from the template, but happen to have similar intensity variations. This flood of matches is often unfeasible to handle.

Here is a more specific example:

Lets assume that we track a ball in a basketball game. The ball color remains constant between frames, but if we normalize the match, many of the players and spectators' heads will get a good match, even though the non normalized template would have detected the correct ball, due to its accurate color.

Here is another specific use for non-normalized matching functions:

In stereo matching, or object tracking we wish to match an object in one frame with the same object in another frame based on its accurate color, and not get lots of matches from objects which have similar shape and color variations but with very different color. Therefore, non-normalized matching is required.

igorastakhov
New Contributor II
73 Views

Hi,

why you can't use non-normalized CrossCorr for such purposes? For SqrDistance you look for minimum, for CroosCorr you should look for maximum - so what is the difference for you? Both are done via 2D FFT and have the similar performance. From tha manual (ippiman.pdf - page 664):

"There are several ways to compute the measure of similarity between two images. One way is to compute the Euclidean distance, or sum of the squared distances (SSD), of an image and a template. The smaller is the value of SSD at a particular pixel, the more similarity exists between the template and the image in the neighborhood of that pixel.

The other similarity measure is the cross-correlation function: the higher is the cross-correlation at a particular pixel, the more similarity exists between the template and the image in the neighborhood of that pixel."

Regards,
Igor

royvm101
Beginner
73 Views

Hi,

Non normalized cross correlation often gives a good match to a template and an image location even though the template is very different than the image. This happens when the image values are large. Here is a 1D example (in the 2D case the same phenomena described below occurs):

Given 1D Template values: 1, 1, 1,

Example a: 1D image values are: 2, 2, 2, 2 (result in small correlation with template).

Example b: 1D image values are: 1, 1, 1000, 1 (result in large correlation with template).

As you can see, the image in example (b) will get much larger correlation values even though it is very different from the template, while the image in example (a) which has values which are close to the template values, will get a lower correlation value than in example (b).

That is why unless the norm of both image and template are known, then one has to normalize the correlation.

This problem would not occur when using non-normalized square diff: The image in example (a) will result in much smaller square distance from the template than the image in example (b), as it should be.

B.R.

Roy

igorastakhov
New Contributor II
73 Views

Roy,

agree, sounds reasonable, put a request to QuAD please, we'll consider it for the next major IPP (8.0) version (~Q3-Q4 2012)

Regards,
Igor
royvm101
Beginner
73 Views

I could not find the QuAD link. What/where is it ?
Thanks,
Roy
Chao_Y_Intel
Employee
73 Views


Roy,

Here is the link: https://premier.intel.com/

Thanks,
Chao

Reply