Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Consider the problem where one searches the presence and position of a perfectly known sub-image gg in an image ff. The sub-image ff is called the pattern (French: motif). Then the cross-correlation (French: corrélation croisée) between ff and gg is a very efficient technique. This technique is often known as matched filter or template matching (French: filtre adapté).

The cross-correlation between ff and gg gives a new image Rf,gR_{f,g} defined as:

Rf,g(u,v)=∑m,nf(m,n)g(u+m,v+n).R_{f,g}(u,v) = \sum_{m,n} f(m,n) g(u+m,v+n).

The cross-correlation can be calculated as a convolution, hence the term “filter” in the name of this technique.

Usually, ff and gg are normalized into:

f~(m,n)=f(m,n)−μfσfg~(m,n)=g(m,n)−μgσg\tilde{f}(m,n) = \frac{ f(m,n)-\mu_f }{ \sigma_f } \qquad \tilde{g}(m,n) = \frac{ g(m,n)-\mu_g }{ \sigma_g }

where μf\mu_f and σf\sigma_f (resp. μg\mu_g and σg\sigma_g) are respectively the mean and the standard deviation of the image ff (resp. gg). This results in the normalized cross-correlation (French: corrélation croisée normalisée) which is insensitive to changes in amplitude:

R~f,g(u,v)=∑m,nf~(m,n)g~(u+m,v+n).\tilde{R}_{f,g}(u,v) = \sum_{m,n} \tilde{f}(m,n) \tilde{g}(u+m,v+n).

Figure 1 gives an example of matched filter.

Normalized cross-correlation with the pattern shown top-left (the letter G).

Figure 1:Normalized cross-correlation with the pattern shown top-left (the letter G).

As seen in Figure 2, the major limit of the matched filter is that it is sensitive to variations in orientation, size, etc.

Normalized cross-correlation with the pattern shown top-left (the digit 0).

Figure 2:Normalized cross-correlation with the pattern shown top-left (the digit 0).

To overcome this limit, one can apply several matched filters, each representative of all the variations of the patterns. However, this is very time-consuming!