TEMPLATE MATCHING One of the most fundamental means of object detection within an image field is by template matching, in which a replica of an object of interest is compared to all unkn
Trang 119
IMAGE DETECTION AND REGISTRATION
This chapter covers two related image analysis tasks: detection and registration.Image detection is concerned with the determination of the presence or absence ofobjects suspected of being in an image Image registration involves the spatial align-ment of a pair of views of a scene
19.1 TEMPLATE MATCHING
One of the most fundamental means of object detection within an image field is by
template matching, in which a replica of an object of interest is compared to all
unknown objects in the image field (1–4) If the template match between anunknown object and the template is sufficiently close, the unknown object is labeled
as the template object
As a simple example of the template-matching process, consider the set of binary
black line figures against a white background as shown in Figure 19.1-1a In this
example, the objective is to detect the presence and location of right triangles in the
image field Figure 19.1-1b contains a simple template for localization of right
trian-gles that possesses unit value in the triangular region and zero elsewhere The width
of the legs of the triangle template is chosen as a compromise between localizationaccuracy and size invariance of the template In operation, the template is sequen-tially scanned over the image field and the common region between the templateand image field is compared for similarity
A template match is rarely ever exact because of image noise, spatial and tude quantization effects, and a priori uncertainty as to the exact shape and structure
ampli-of an object to be detected Consequently, a common procedure is to produce adifference measure D m n( , ) between the template and the image field at all points of
Digital Image Processing: PIKS Inside, Third Edition William K Pratt
Copyright © 2001 John Wiley & Sons, Inc.ISBNs: 0-471-37407-5 (Hardback); 0-471-22132-5 (Electronic)
Trang 2the image field where and denote the trial offset An object
is deemed to be matched wherever the difference is smaller than some establishedlevel Normally, the threshold level is constant over the image field Theusual difference measure is the mean-square difference or error as defined by
(19.1-1)
where denotes the image field to be searched and is the template Thesearch, of course, is restricted to the overlap region between the translated templateand the image field A template match is then said to exist at coordinate if
D m n( , ) L< D(m n, )
D m n( , ) = D (m n, ) 2D– (m n, ) D+ (m n, )
Trang 3between the image field and the template At the coordinate location of atemplate match, the cross correlation should become large to yield a small differ-ence However, the magnitude of the cross correlation is not always an adequatemeasure of the template difference because the image energy term is posi-tion variant For example, the cross correlation can become large, even under a con-dition of template mismatch, if the image amplitude over the template region is highabout a particular coordinate This difficulty can be avoided by comparison ofthe normalized cross correlation
in rotation and magnification of template objects For this reason, template matching
is usually limited to smaller local features, which are more invariant to size andshape variations of an object Such features, for example, include edges joined in a
D1(m n, )
R FT(m n, )
D1(m n, )
m n,( )
R˜ FT(m n, ) D2(m n, )
D1(m n, ) -
Trang 419.2 MATCHED FILTERING OF CONTINUOUS IMAGES
Matched filtering, implemented by electrical circuits, is widely used in sional signal detection applications such as radar and digital communication (5–7)
one-dimen-It is also possible to detect objects within images by a two-dimensional version ofthe matched filter (8–12)
In the context of image processing, the matched filter is a spatial filter that
pro-vides an output measure of the spatial correlation between an input image and a erence image This correlation measure may then be utilized, for example, todetermine the presence or absence of a given input image, or to assist in the spatialregistration of two images This section considers matched filtering of deterministicand stochastic images
ref-19.2.1 Matched Filtering of Deterministic Continuous Images
As an introduction to the concept of the matched filter, consider the problem ofdetecting the presence or absence of a known continuous, deterministic signal or ref-erence image in an unknown or input image corrupted by additivestationary noise independent of Thus, is composed of thesignal image plus noise,
ε η,( )
S ε η( , )2 = F x y( , ) 䊊ⴱ H x y( , )2
Trang 5MATCHED FILTERING OF CONTINUOUS IMAGES 617
with and By the convolution theorem,
(19.2-4)
where is the Fourier transform of The additive input noise ponent is assumed to be stationary, independent of the signal image, anddescribed by its noise power-spectral density From Eq 1.4-27, the totalnoise power at the filter output is
If the input noise power-spectral density is white with a flat spectrum,
, the matched filter transfer function reduces to
∞
∫
∞ –
∞
∫
∞ –
∞
∫
∞ –
∞
∫
∞ –
Trang 6If the unknown image consists of the signal image translated by tances plus additive noise as defined by
be detected
It is possible to implement the general matched filter of Eq 19.2-7 as a two-stagelinear filter with transfer function
(19.2-14)
The first stage, called a whitening filter, has a transfer function chosen such that
noise with a power spectrum at its input results in unit energywhite noise at its output Thus
∞
∫
∞ –
∞
∫
=
ε η,( )
F O(x y, ) 2
n w
- F U(α β, )F∗ α x( – ,β y– ) αd dβ
∞ –
∞
∫
∞ –
∞
∫
∞ –
Trang 7MATCHED FILTERING OF CONTINUOUS IMAGES 619
The transfer function of the whitening filter may be determined by a spectral ization of the input noise power-spectral density into the product (7)
factor-(19.2-16)
such that the following conditions hold:
(19.2-17a)(19.2-17b)(19.2-17c)
The simplest type of factorization is the spatially noncausal factorization
(19.2-18)
where represents an arbitrary phase angle Causal factorization of theinput noise power-spectral density may be difficult if the spectrum does not factorinto separable products For a given factorization, the whitening filter transfer func-tion may be set to
(19.2-19)
The resultant input to the second-stage filter is , where
represents unit energy white noise and
Trang 8Calculation of the product shows that the optimum filterexpression of Eq 19.2-7 can be obtained by the whitening filter implementation.The basic limitation of the normal matched filter, as defined by Eq 19.2-7, is thatthe correlation output between an unknown image and an image signal to bedetected is primarily dependent on the energy of the images rather than their spatialstructure For example, consider a signal image in the form of a bright hexagonallyshaped object against a black background If the unknown image field contains a cir-cular disk of the same brightness and area as the hexagonal object, the correlationfunction resulting will be very similar to the correlation function produced by a per-fect match In general, the normal matched filter provides relatively poor discrimi-nation between objects of different shape but of similar size or energy content This
drawback of the normal matched filter is overcome somewhat with the derivative matched filter (8), which makes use of the edge structure of an object to be detected The transfer function of the pth-order derivative matched filter is given by
W N(ωx,ωy) -
=
H0(ωx,ωy) F * ω( x,ωy)exp{–i ω( xε ω+ yη)}
W N(ωx,ωy) -
=
H p(ωx,ωy) ωx2
ωy2
+( )H0(ωx,ωy)
=
Trang 9MATCHED FILTERING OF CONTINUOUS IMAGES 621
Hence the derivative matched filter may be implemented by cascaded operationsconsisting of a generalized derivative operator whose function is to enhance theedges of an image, followed by a normal matched filter
19.2.2 Matched Filtering of Stochastic Continuous Images
In the preceding section, the ideal image to be detected in the presence ofadditive noise was assumed deterministic If the state of is not knownexactly, but only statistically, the matched filtering concept can be extended to thedetection of a stochastic image in the presence of noise (13) Even if isknown deterministically, it is often useful to consider it as a random field with amean Such a formulation provides a mechanism for incorpo-rating a priori knowledge of the spatial correlation of an image in its detection Con-ventional matched filtering, as defined by Eq 19.2-7, completely ignores the spatialrelationships between the pixels of an observed image
For purposes of analysis, let the observed unknown field
S ε η( , )2 = E F x y{ ( , )} 䊊ⴱ H x y( , )2
S ε η( , )2
E F ω{ ( x,ωy)}H ω( x,ωy)exp{i ω( xε ω+ yη)}dωx dωy
∞ –
∞
∫
∞ –
∞
=
Trang 10The variance of the matched filter output, under the assumption of stationarity andsignal and noise independence, is
(19.2-32)
where and are the image signal and noise power spectraldensities, respectively The generalized signal-to-noise ratio of the two equationsabove, which is of similar form to the specialized case of Eq 19.2-6, is maximizedwhen
A special case of common interest occurs when the noise is white,
, and the ideal image is regarded as a first-order nonseparableMarkov process, as defined by Eq 1.4-17, with power spectrum
(19.2-35)
where is the adjacent pixel correlation For such processes, the resultantmodified matched filter transfer function becomes
(19.2-36)
At high spatial frequencies and low noise levels, the modified matched filter defined
by Eq 19.2-36 becomes equivalent to the Laplacian matched filter of Eq 19.2-25
N [W F(ωx,ωy ) W+ N(ωx,ωy)] H ω( x,ωy)2
ωx
d dωy
∞ –
∞
∫
∞ –
=
Trang 11MATCHED FILTERING OF DISCRETE IMAGES 623 19.3 MATCHED FILTERING OF DISCRETE IMAGES
A matched filter for object detection can be defined for discrete as well as ous images One approach is to perform discrete linear filtering using a discretizedversion of the matched filter transfer function of Eq 19.2-7 following the techniquesoutlined in Section 9.4 Alternatively, the discrete matched filter can be developed
continu-by a vector-space formulation (13,14) The latter approach, presented in this section,
is advantageous because it permits a concise analysis for nonstationary image andnoise arrays Also, image boundary effects can be dealt with accurately Consider anobserved image vector
(19.3-1a)or
(19.3-1b)
composed of a deterministic image vector f plus a noise vector n, or noise alone.
The discrete matched filtering operation is implemented by forming the inner uct of with a matched filter vector m to produce the scalar output
prod-(19.3-2)
Vector m is chosen to maximize the signal-to-noise ratio The signal power in the
absence of noise is simply
(19.3-3)and the noise power is
Trang 12where the term in brackets is a scalar, which may be normalized to unity Thematched filter output
(19.3-7)reduces to simple vector correlation for white noise In the general case, the noisecovariance matrix may be spectrally factored into the matrix product
(19.3-8)
with , where E is a matrix composed of the eigenvectors of and
is a diagonal matrix of the corresponding eigenvalues (14) The resulting matchedfilter output
Trang 13IMAGE REGISTRATION 625
, respectively (14) In the special but common case of white noise and aseparable, first-order Markovian covariance matrix, the whitening operations can beperformed using an efficient Fourier domain processing algorithm developed forWiener filtering (15)
19.4 IMAGE REGISTRATION
In many image processing applications, it is necessary to form a pixel-by-pixel parison of two images of the same object field obtained from different sensors, or oftwo images of an object field taken from the same sensor at different times To formthis comparison, it is necessary to spatially register the images, and thereby, to cor-rect for relative translation shifts, rotational differences, scale differences and evenperspective view differences Often, it is possible to eliminate or minimize many ofthese sources of misregistration by proper static calibration of an image sensor.However, in many cases, a posteriori misregistration detection and subsequent cor-rection must be performed Chapter 13 considered the task of spatially warping animage to compensate for physical spatial distortion mechanisms This sectionconsiders means of detecting the parameters of misregistration
com-Consideration is given first to the common problem of detecting the translationalmisregistration of two images Techniques developed for the solution to this prob-lem are then extended to other forms of misregistration
19.4.1 Translational Misregistration Detection
The classical technique for registering a pair of images subject to unknown tional differences is to (1) form the normalized cross correlation function betweenthe image pair, (2) determine the translational offset coordinates of the correlationfunction peak, and (3) translate one of the images with respect to the other by theoffset coordinates (16,17) This subsection considers the generation of the basiccross correlation function and several of its derivatives as means of detecting thetranslational differences between a pair of images
transla-Basic Correlation Function Let and for and ,represent two discrete images to be registered is considered to be thereference image, and
Trang 14for m = 1, 2, , M and n = 1, 2, , N, where M and N are odd integers This
formu-lation, which is a generalization of the template matching cross correlation sion, as defined by Eq 19.1-5, utilizes an upper left corner–justified definition forall of the arrays The dashed-line rectangle of Figure 19.4-1 specifies the bounds ofthe correlation function region over which the upper left corner of moves inspace with respect to The bounds of the summations of Eq 19.4-2 are
expres-(19.4-3a)(19.4-3b)
These bounds are indicated by the shaded region in Figure 19.4-1 for the trial offset
(a, b) This region is called the window region of the correlation function
computa-tion The computation of Eq 19.4-2 is often restricted to a constant-size windowarea less than the overlap of the image pair in order to reduce the number of
FIGURE 19.4-1 Geometrical relationships between arrays for the cross correlation of an
Trang 15IMAGE REGISTRATION 627
calculations This constant-size window region, called a template region, is
defined by the summation bounds
(19.4-4a)(19.4-4b)
The dotted lines in Figure 19.4-1 specify the maximum constant-size templateregion, which lies at the center of The sizes of the correlation func-tion array, the search region, and the template region are related by
(19.4-5a)(19.4-5b)
For the special case in which the correlation window is of constant size, the relation function of Eq 19.4-2 can be reformulated as a template search process Let denote a search area within whose upper left corner is at theoffset coordinate Let denote a template region extracted from whose upper left corner is at the offset coordinate Figure 19.4-2relates the template region to the search area Clearly, and The normal-ized cross correlation function can then be expressed as
cor-(19.4-6)
for m = 1, 2, , M and n = 1, 2, ., N where
(19.4-7a)(19.4-7b)The summation limits of Eq 19.4-6 are
(19.4-8a)(19.4-8b)