Specifications
Intel
®
Image Processing Library Reference Manual
12-12
12
Cross-Correlation
This section describes the iplNormCrossCorr() function that allows you
to compute the cross-correlation of an image and a template (another
image). The cross-correlation values are image similarity measures: the
higher cross-correlation at a particular pixel, the more similarity between
the template and the image in the neighborhood of the pixel.
The mathematical definition of the cross-correlation R
tx
(r,c) between a
template and an image at the pixel in row r and column c is given by this
equation:
()
∑∑
−
=
−
=
−+−+=
1
0
1
0
)2/,2/(),(,
tplCols
i
tplRows
j
tx
tplColsictplRowsjrxijtcrR
where x(r,c) is the image’s pixel value in row r and column c,andt(r,c)is
the template’s pixel value; the template size is tplCols x tplRows.
The
iplNormCrossCorr() function of the Image Processing Library
computes normalized cross-correlation values,
ρ
tx
(r,c), defined as follows:
()
()
()( )
2/,2/,
,
,
tplColstplRowsRcrR
crR
Acr
ttxx
tx
tx
=
ρ
.
Here A is a factor for scaling the computed values to the full range of pixel
values in the destination image; R
xx
and R
tt
denote the auto-correlation of
the image and the template, respectively:
∑∑
−+
−−=
−+
−−=
=
2/)1(
2/)1(
,,
2/)1(
2/)1(
),(
tplColsc
tplColsci
ijij
tplRowsr
tplRowsrj
xx
xxcrR
()
∑∑
−
=
−
=
=
1
0
,,
1
0
2/,2/
tplCols
i
ijij
tplRows
j
tt
tttplColstplRowsR .