Master Thesis - Fachbereich Informatik
Master Thesis - Fachbereich Informatik
Master Thesis - Fachbereich Informatik
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
2.4. TEMPLATE MATCHING 29<br />
accuracy of 0.01 pixels, while the error increases to about 0.1 pixels for low-contrast edges.<br />
Lyvers et al. [41] proposed a subpixel edge detector based on spatial moments of a gray<br />
level edge with an accuracy of better than 0.05 pixels for real image data. Aström [6] analyzes<br />
subpixel edge detection by stochastic models. A survey on subpixel measurements<br />
techniques can be found in [71].<br />
2.4. Template Matching<br />
A common task in vision applications is to search whether a particular pattern is part<br />
of an image, and if so, where it is located [28]. Template matching is one method to<br />
tackle this problem. The search pattern or template can be represented as an image and is<br />
usually considerably smaller than the inspected input image. Then, the template is shifted<br />
over the input image and compared with the underlying values. A measure of similarity is<br />
computed at each position. Positions reaching a high score are likely to match the pattern,<br />
or the other way around, if the template matches at a certain location, the score has a<br />
maximum at this location.<br />
A technique denoted as cross-correlation is widely used as measure of similarity between<br />
image patches [64]. It can be derived from the sum of squared differences (SSD):<br />
cSSD(x, y) =<br />
W� −1<br />
i=0<br />
H−1 �<br />
j=0<br />
(T (i, j) − I(x + i, y + j)) 2<br />
(2.27)<br />
where I is the discrete image function and T the discrete template function. W and<br />
H indicate the template width and height respectively. Expanding the squared quantity<br />
yields:<br />
cSSD(x, y) =<br />
W� −1<br />
i=0<br />
H−1 �<br />
j=0<br />
T 2 (i, j) − 2T (i, j)I(x + i, y + j)+I 2 (x + i, y + j) (2.28)<br />
Since the template is constant, the sum over the template patch T 2 (i, j) is constant as<br />
well and does not contain any information on similarity. The same holds approximately<br />
for the sum over the image patch I 2 (x + i, y + j) if there are no strong variances in image<br />
intensity. Hence, the term T (i, j)I(x+i, y +j) remains the only real indicator of similarity<br />
that depends on both the image and the template. This leads to the cross-correlation<br />
equation:<br />
c(x, y) =<br />
W� −1<br />
i=0<br />
H−1 �<br />
j=0<br />
T (i, j)I(x + i, y + j) (2.29)<br />
It turns out that the correlation looks very similar to the discrete convolution. Indeed,<br />
the only difference between correlation and convolution is the sign of the summation in the<br />
second term [28]. Thus, theoretically a correlation can be replaced by a convolution with a<br />
flipped version of the template [64]. Like convolution, correlation is an expensive operation<br />
if applied to large images and templates. In some cases it is faster to convert the spatial<br />
images into the frequency domain using the (discrete) Fast Fourier Transformation (FFT),