Automatic size recognition


Normalized correlation Go back to the indexAutomatic color recognition

In general, making an object recognition algorithm that is scale invariant is a hard task. This task is even harder if the algorithm is based in correlating the photo with some template, as the absolute spacing of the pixels in the photo changes with respect to the spacing of the pixels in the template, resulting in a low correlation value.

In this algorithm we have taken a brute force approach, which seems to be the only feasible solution for this type of algorithms. A dozen of possible sizes are predefined, and for the first template the combined correlations for all sizes are calculated. The size with the maximum value of correlation is considered the correct one, and saved in a vector. For the next template, the correlations corresponding to the correct size, to the previous and to the next are calculated, and again the higher value is chosen and the size saved in the vector that contained the previous correct size. For each of the following, the average of the sizes vector is calculated, and the correlations of the 3 closest sizes are performed. The highest value is chosen and the sizes vector updated.

This algorithm is obviously a performance vs computation-cost compromise. Calculating correlations for all possible sizes of all templates would be safer but the computational cost is simply not acceptable. At the same time, it would be faster to take the ideal value of the first template as the overall ideal value, but faces are slightly different and moreover there may be some problem that affects to the first template only.

Normalized correlation Go back to the indexAutomatic color recognition