To specify template matching in image algebra, define an invariant pattern template t, corresponding to the pattern p centered at the origin, by setting The unnormalized correlation algo
Trang 2
Search Tips
Advanced Search
Handbook of Computer Vision Algorithms in Image Algebra
by Gerhard X Ritter; Joseph N Wilson
CRC Press, CRC Press LLC
ISBN: 0849326362 Pub Date: 05/01/96 Search this book:
Previous Table of Contents Next
Image Algebra Formulation
The exact formulation of a discrete correlation of an M × N image with a pattern p of size (2m - 1)
× (2n - 1) centered at the origin is given by
For (x + k, y + l) X, one assumes that a(x + k, y + l) = 0 It is also assumed that the pattern size is generally
smaller than the sensed image size Figure 9.2.5 illustrates the correlation as expressed by Equation 9.2.1
Figure 9.2.5 Computation of the correlation value c(x, y) at a point (x, y) X.
To specify template matching in image algebra, define an invariant pattern template t, corresponding to the pattern p centered at the origin, by setting
The unnormalized correlation algorithm is then given by
The following simple computation shows that this agrees with the formulation given by Equation 9.2.1
By definition of the operation •, we have that
Title
Trang 3
-Since t is translation invariant, t(x, y) (u, v) = t(0, 0)(u - x, v - y) Thus, Equation 9.2.2 can be written as
Now t(0, 0)(u - x, v - y) = 0 unless (u - x, v - y) S(t(0, 0)) or, equivalently, unless (m 1) d u x d m 1 and (n -1) d v - y d n - 1 Changing variables by letting k = u - x and l = v - y changes Equation 9.2.3 to
To compute the normalized correlation image c, let N denote the neighborhood function defined by N(y) =
S(ty) The normalized correlation image is then computed as
An alternate normalized correlation image is given by the statement
Note that £t(0, 0) is simply the sum of all pixel values of the pattern template at the origin
Comments and Observations
To be effective, pattern matching requires an accurate pattern Even if an accurate pattern exists, slight variations in the size, shape, orientation, and gray level values of the object of interest will adversely affect performance For this reason, pattern matching is usually limited to smaller local features which are more invariant to size and shape variations of an object
9.3 Pattern Matching in the Frequency Domain
The purpose of this section is to present several approaches to template matching in the spectral or Fourier domain Since convolutions and correlations in the spatial domain correspond to multiplications in the
spectral domain, it is often advantageous to perform template matching in the spectral domain This holds especially true for templates with large support as well as for various parallel and optical implementations of matched filters
It follows from the convolution theorem [3] that the spatial correlation a•t corresponds to multiplication in the
frequency domain In particular,
where â denotes the Fourier transform of a, denotes the complex conjugate of , and the inverse
Fourier transform Thus, simple pointwise multiplication of the image â with the image and Fourier
transforming the result implements the spatial correlation a •t.
One limitation of the matched filter given by Equation 9.3.1 is that the output of the filter depends primarily
on the gray values of the image a rather than on its spatial structures This can be observed when considering
the output image and its corresponding gray value surface shown in Figure 9.3.2 For example, the letter E in the input image (Figure 9.3.1) produced a high-energy output when correlated with the pattern letter B shown
in Figure 9.3.1 Additionally, the filter output is proportional to its autocorrelation, and the shape of the filter output around its maximum match is fairly broad Accurately locating this maximum can therefore be difficult
Trang 4The image is now given by , the Fourier transform of p The correlation image c can therefore be
obtained using the following algorithm:
Using the image p constructed in the above algorithm, the phase-only filter and the symmetric phase-only
filter have now the following simple formulation:
and
respectively
Comments and Observations
In order to achieve the phase-only matching component to the matched filter approach we needed to divide the complex image by the amplitude image Problems can occur if some pixel values of are equal to zero However, in the image algebra pseudocode of the various matched filters we assume that
, where denotes the pseudoinverse of A similar comment holds for the quotient
Some further improvements of the symmetric phase-only matched filter can be achieved by processing the spectral phases [6, 7, 8, 9]
9.4 Rotation Invariant Pattern Matching
In Section 9.2 we noted that pattern matching using simple pattern correlation will be adversely affected if the pattern in the image is different in size or orientation then the template pattern Rotation invariant pattern matching solves this problem for patterns varying in orientation The technique presented here is a digital adaptation of optical methods of rotation invariant pattern matching [10, 11, 12, 13, 14]
Computing the Fourier transform of images and ignoring the phase provides for a pattern matching approach
that is insensitive to position (Section 9.3) since a shift in a(x, y) does not affect |â(u, v)| This follows from
the Fourier transform pair relation
which implies that
where x0 = y0 = N/2 denote the midpoint coordinates of the N × N domain of â However, rotation of a(x, y) rotates |â(u, v)| by the same amount This rotational effect can be taken care of by transforming |â(u, v)| to
polar form (u, v) (r, ¸) A rotation of a(x, y) will then manifest itself as a shift in the angle ¸ After
determining this shift, the pattern template can be rotated through the angle ¸ and then used in one of the standard correlation schemes in order to find the location of the pattern in the image
The exact specification of this technique — which, in the digital domain, is by no means trivial — is provided
by the image algebra formulation below
Trang 5Previous Table of Contents Next
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc All rights reserved Reproduction whole or in part in any form or medium without express written permission of
EarthWeb is prohibited Read EarthWeb's privacy statement.
Trang 6This step is vital for the success of the proposed method Image spectra decrease rather rapidly as a function
of increasing frequency, resulting in suppression of high-frequency terms Taking the logarithm of the Fourier spectrum increases the amplitude of the side lobes and thus provides for more accurate results when
employing the symmetric phase-only filter at a later stage of this algorithm
Step 5 Convert â and to continuous image.
The conversion of â and to continuous images is accomplished by using bilinear interpolation An image algebra formulation of bilinear interpolation can be found in [15] Note that because of Step 4, â and are real-valued images Thus, if âb and denote the interpolated images, then , where
That is, âb and are real-valued images over a point set X with real-valued coordinates.
Although nearest neighbor interpolation can be used, bilinear interpolation results in a more robust matching algorithm
Step 6 Convert to polar coordinates.
Define the point set
and a spatial function f : Y ’ X by
Next compute the polar images
Step 7 Apply the SPOMF algorithm (Section 9.3).
Since the spectral magnitude is a periodic function of À and ¸ ranges over the interval [-À = ¸0, ¸N = À], the output of the SPOMF algorithm will produce two peaks along the ¸ axis, ¸j and ¸k for some and
Due to the periodicity, |¸j| + |¸k | = À and, hence, k = -(j + N/2) One of these two angles
corresponds to the angle of rotation of the pattern in the image with respect to the template pattern The complementary angle corresponds to the same image pattern rotated 180 °
To find the location of the rotated pattern in the spatial domain image, one must rotate the pattern template (or input image) through the angle ¸j as well as the angle ¸k The two templates thus obtained can then be used in one of the previous correlation methods Pixels with the highest correlation values will correspond to the pattern location
Comments and Observations
The following example will help to further clarify the algorithm described above The pattern image p and input image a are shown in Figure 9.4.1 The exemplar pattern is a rectangle rotated through an angle of 15°
while the input image contains the pattern rotated through an angle of 70° Figure 9.4.2 shows the output of Step 4 and Figure 9.4.3 illustrates the conversion to polar coordinates of the images shown in Figure 9.4.2 The output of the SPOMF process (before thresholding) is shown in Figure 9.4.4 The two high peaks appear
on the ¸ axis (r = 0).
Trang 7Figure 9.4.1 The input image a is shown on the left and the pattern template p on the right.
The reason for choosing grid spacing in Step 6 is that the maximum value of r is
which prevents mapping the polar coordinates outside the set X Finer sampling grids
will further improve the accuracy of pattern detection; however, computational costs will increase
proportionally A major drawback of this method is that it works best only when a single object is present in the image, and when the image and template backgrounds are identical
Figure 9.4.2 The log of the spectra of â (left) and (right).
Figure 9.4.3 Rectangular to polar conversion of â (left) and (right).
Figure 9.4.4 SPOMF of image and pattern shown in Figure 9.4.3
9.5 Rotation and Scale Invariant Pattern Matching
In this section we discuss a method of pattern matching which is invariant with respect to both rotation and scale The two main components of this method are the Fourier transform and the Mellin transform Rotation invariance is achieved by using the approach described in Section 9.4 For scale invariance we employ the Mellin transform Since the Mellin transform of an image a is given by
it follows that if b(x, y) = a(±x, ±y), then
Therefore,
which shows that the Mellin transform is scale invariant
Implementation of the Mellin transform can be accomplished by use of the Fourier transform by rescaling the
input function Specifically, letting ³ = logx and ² = logy we have
Therefore,
Trang 8which is the desired result.
It follows that combining the Fourier and Mellin transform with a rectangular to polar conversion yields a rotation and scale invariant matching scheme The approach takes advantage of the individual invariance properties of these two transforms as summarized by the following four basic steps:
(1) Fourier transform
(2) Rectangular to polar conversion
(3) Logarithmic scaling of r
(4) SPOMF
Previous Table of Contents Next
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc All rights
reserved Reproduction whole or in part in any form or medium without express written permission of
EarthWeb is prohibited Read EarthWeb's privacy statement.
Trang 99.6 Line Detection Using the Hough Transform
The Hough transform is a mapping from into the function space of sinusoidal functions It was first formulated in 1962 by Hough [16] Since its early formulation, this transform has undergone intense
investigations which have resulted in several generalizations and a variety of applications in computer vision and image processing [1, 2, 17, 18, 19] In this section we present a method for finding straight lines using the Hough transform The input for the Hough transform is an image that has been preprocessed by some type of edge detector and thresholded (see Chapters 3 and 4) Specifically, the input should be a binary edge image
Figure 9.5.4 SPOMF of image and pattern shown in Figure 9.5.3
A straight “line” in the sense of the Hough algorithm is a colinear set of points Thus, the number of points in
a straight line could range from one to the number of pixels along the diagonal of the image The quality of a straight “line” is judged by the number of points in it It is assumed that the natural straight lines in an image correspond to digitized straight “lines” in the image with relatively large cardinality
A brute force approach to finding straight lines in a binary image with N feature pixels would be to examine
all possible straight lines between the feature pixels For each of the possible lines, N - 2
tests for colinearity must be performed Thus, the brute force approach has a computational complexity on the
order of N3 The Hough algorithm provides a method of reducing this computational cost
To begin the description of the Hough algorithm, we first define the Hough transform and examine some of
its properties The Hough transform is a mapping h from into the function space of sinusoidal functions defined by
To see how the Hough transform can be used to find straight lines in an image, a few observations need to be made
Any straight line l0 in the xy-plane corresponds to a point (Á0, ¸0) in the Á¸-plane, where ¸0 [0, À) and
Let n0 be the line normal to l0 that passes through the origin of the xy-plane The angle n0 makes with the positive x-axis is ¸0 The distance from (0, 0) to l0 along n0 is |Á0| Figure 9.6.1 below
illustrates the relation between l0, n0, ¸0, and Á0 Note that the x-axis in the figure corresponds to the point (0, 0), while the y-axis corresponds to the point (0, À/2).
Figure 9.6.1 Relation of rectangular to polar representation of a line
Suppose (x i , yi), 1 d i d n, are points in the xy-plane that lie along the straight line l0 (see Figure 9.6.1) The
line l0 has a representation (Á0, ¸0) in the Á¸-plane The Hough transform takes each of the points (x i , y i) to a
sinusoidal curve Á = x i cos(¸) + y i sin(¸) in the ¸Á-plane The property that the Hough algorithm relies on is that
each of the curves Á = x i cos(¸) + y i sin(¸) have a common point of intersection, namely (Á0, ¸0) Conversely,
the sinusoidal curve Á = x cos(¸) + y sin(¸) passes through the point (Á0, ¸0) in the Á¸-plane only if (x, y) lies
on the line (Á0, ¸0) in the xy-plane.
As an example, consider the points (1, 7), (3, 5), (5, 3), and (6, 2) in the xy-plane that lie along the line l with
Trang 10¸ and Á representation and , respectively.
Figure 9.6.2 shows these points and the line l0
Figure 9.6.2 Polar parameters associated with points lying on a line
Previous Table of Contents Next
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc All rights
reserved Reproduction whole or in part in any form or medium without express written permission of
EarthWeb is prohibited Read EarthWeb's privacy statement.