Deparametrization of a Discrete Convex Corner Detection Algorithm J.A. Staples J.B. Hood

advertisement
Deparametrization of a Discrete Convex Corner Detection Algorithm
J.A. Staples
J.B. Hood
Department of Computer Science
Midwestern State University
Wichita Falls, Texas, 76308, USA
jacob.staples@gmail.com
Department of Mathematics
Midwestern State University
Wichita Falls, Texas, 76308, USA
jeffrey.hood@mwsu.edu
Keywords: Discrete Closed Curves, Corner Detection, Deparametrization
Abstract
A corner detection algorithm proposed by Hood, et al. [6]
which detects corner points on a discretely defined curve represented by x, y-coordinates is de-parameterized and its corner
detection accuracy is improved. The accuracy of the original
algorithm is sensitive to several user-defined parameters. This
paper details the process of automated de-parameterization of
the algorithm using inverse methods, analyzes the results of
the de-parameterization, and proposes a new geometric test for
discrete cornerliness that eliminates extraneous corners found
by this and other corner detecting algorithms.
1 INTRODUCTION
The ability to reliably detect the corner points on a closed
curve represented by discrete points is useful in applications
of image processing, collision detection and pattern matching,
among others. In all but the most trivial of cases where human
analysis is a feasible option, the detection of corners must be
entirely automated and reliably accurate. Due to the relatively
specious nature of detecting corners in discrete curves as
described in [8], no corner detection algorithm will be able
to achieve perfect accuracy on every data set it encounters.
Instead, a good algorithm can be said to behave well across a
wide range of data sets.
The most direct measure of a corner detection algorithm’s
success is the number and location of corners it detects on a
given data set. In this regard, there are three distinct types of
corner detection error that can occur:
1) A corner displacement error in which the detected corner
is displaced from its actual position.
2) No corner is detected at an actual corner (false negative).
3) A corner is detected where no actual corner exists (false
positive).
Of the three types of error, the first is generally the least
severe provided the displacement is small relative to the size of
the closed curve. The severity of errors of type two and three
is typically application dependant, although they are generally
more severe than errors of the first type. For example, in
a curve matching application a single missed corner might
have little impact on the overall accuracy of the matching
whereas the addition of an extraneous corner might result in
an unacceptable degree of inaccuracy.
Typically, applications of computational corner detection
require the digitization of a physical object (e.g., a digitally
scanned fragment of pottery), extraction of xy-coordinates
from the digital data, and additional processing to remove
noise. A large amount of research has been conducted concerning the techniques of digitization, extraction, and noise
removal (see [1], [2], [3], [4], [5], [7], [9], [10], [12], [13]).
This paper explores the operation of a single corner detection
algorithm on data, which hereafter shall be assumed to have
been suitably processed as described above.
2 THE ALGORITHM
The corner detection algorithm explored in this paper was
developed by Hood, et al. and is described fully and compared
to several other prominent corner detection algorithms in [6].
This section briefly describes the operation of the algorithm
and the areas in which it is to be improved.
First, an arbitrary centroid point for the closed curve is
computed. The x-coordinate of the centroid point is taken to
be the mean of all x values on the curve. Similarly, the y
value of the centroid point is the mean of all y values on the
curve. The centroid point is used as a reference for curvature,
as described below.
For each point on the closed curve, the squared distance to
the centroid is computed. The squared distance data is then
standardized (given a mean of zero) by subtracting the mean
radius to the centroid from the squared distance of each point
to the centroid. Next, an arbitrary constant, m, is chosen. For
each standardized element in the data, the sum of m slopes to
the left of the element and the sum of m slopes to the right
of the element are computed. The curvature of each element
is considered to be the difference between the sum of the m
slopes to the left and m slopes to the right of the element.
The curvature is then smoothed by taking the mean of each
element with its sequential neighbor in the indexing scheme.
This alleviates the majority of the large spikes in curvature that
occur at some transitions between vertically and horizontally
oriented portions of the closed curve. The original algorithm
proposed that two passes of smoothing be run. However,
research by Biemond et al [3] shows that an additional round
of smoothing, for a total of three rounds, will further alleviate
discrepancies in curvature while having a minimal impact on
corner detection accuracy.
After smoothing, the convex corner points on the curve
can be isolated by finding those points whose curvature is
greater than another arbitrary constant, λ, times the mean
of the curvatures of all elements on the curve. The original
algorithm proposed used a λ value of 5.5 as a reliable indicator
of a corner point.
Although this method is relatively effective at detecting
corner points, it has several shortcomings. Foremost among
these is the need to choose satisfactory values for m and
λ to provide acceptable accuracy on a given data set. For
example, one closed curve might require an m value of 12
and a λ value of 3.7 to detect the location of all corners
accurately, whereas another might require values of 10 and
4.1, respectively. In other words, there is no “magic bullet”
combination of parameters m and λ that will provide reliably
optimal results for any data set. This limits the automation
potential of the algorithm and, in many cases, hinders it from
achieving optimal accuracy. This paper proposes a method of
removing parameter dependence from the algorithm.
3 DEPARAMETRIZATION
In this section, the deparametrization of the original corner
detection algorithm is described.
First, a large and varied set of data is gathered on which
to test the performance of the original algorithm and the
x, y-coordinates of the corners on each curve are determined
subjectively. The test data used during de-parameterization
of the corner detection algorithm consists of 52 test curves
containing 201 corners chosen to represent a combination
of best and worst case corner scenarios from both real and
contrived (hand drawn) data. Of the test curves, 35 are digitally
scanned puzzle pieces. Twelve of the curves are generated
by scanning one of four cut pieces of paper at 100, 200 and
300 dpi. The remaining curves are hand drawn and digitally
scanned. Examples of each type are shown in Figure 1.
Fig. 1.
Test Case Set: Various Curves.
The test data, which is combined with the first 52 pieces
and used in Section 5 to verify the results of the deparameterization, consists of 10 hand generated curves created
by digitally scanning a square piece of paper that is cut into
10 pieces. Several of these curves are shown in Figure 2.
In the original algorithm, m was allowed to be arbitrarily
chosen. To ease the process of deparametrization, m is instead
chosen based on n, the number of discrete points on the closed
Fig. 2.
Test Case Set: Hand-Drawn Closed Curves.
curve:
√
n
.
2
A cost function was developed that compares the corners
detected by the algorithm for a given set of parameters to the
subjective corners isolated earlier and returns a cost based on
an analysis of this comparison. The cost function is useful
for rating the performance of the algorithm with various
parameters. In this fashion, two parameters can be compared
objectively to determine which value is optimal (has the least
cost). The cost function used in this deparametrization weights
the detection of an extraneous corner (false positive) much
more heavily than a corner that is missed (false negative).
The magnitude of the square of this difference between the
number of corners detected by the number of actual corners,
∆corners, is weighted by the variable σ, which is chosen to
be 100 if ∆corners > 0 and 50 if ∆corners ≤ 0. The cost
of a corner that is detected correctly but is displaced from
the location of the actual corner, is weighed according to
the squared displacement between them. The sum of these
displacements for each of α corners that were detected and
are actual corners is computed. The cost is determined to be
the sum of these two values:
α
X
C = σ · ∆2corners +
∆x2i + ∆yi2 .
m=
i=1
A Nelder-Mead simplex minimization is run on the cost
function to determine which values of λ result in the smallest
cost for a given closed curve in the data. Initially, a NelderMead simplex minimization was attempted on both λ and
m simultaneously. However, due to the sometimes erratic
behavior of the curvature data and the need for m to be an
integer value, it was determined that fixing m as described
above and optimizing only λ would be a more successful
procedure.
The following graph shows the ranges of λ for which few
false positive and false negative corners were detected and the
detected corners had a small total displacement (the maximum
and minimum acceptable bounds of λ) for m computed as
described above at various n values. It was found that λ values
significantly higher than this upper λ limit typically resulted
in significantly fewer candidate corners than actual corners
being detected, but there was a very high probability that the
corners detected were actual corners. However, λ values closer
to (but still above) the upper limit typically resulted in small,
but acceptable corner displacements and a larger probability of
detecting extraneous corners. Values below the λ limit resulted
in a large number of extraneous corners being detected and
often caused significant displacements in corners that were
detected correctly. An ideal λ value obviously lies somewhere
within the range of upper and lower bounds.
8
minimum−maximum λ value pairs
7
6
Fig. 4.
External versus internal approximating perimeters to a curve.
5
4
3
2
1
0
850
900
950
1000
1050
1100
N
Fig. 3. Spreads of λ values versus number of points per curve and an
appropriate bound curve.
Several nonlinear regression tests were run on these ranges
as described in [11] to determine a correlation between n and
λ that is capable of reliably predicting λ within or slightly
above the range of acceptable values. Although most of the
regressions resulted in satisfactory results, the best results were
achieved with a fourth-root fitting on n (or a square-root fitting
on m). The fitting is superimposed on the graph above and is
given by the formula
√
4
n
λ= √ .
2
4 NEW GEOMETRIC CORNERITY TEST
Hood’s algorithm [6], like the majority of corner detection
schemes, is capable of producing either significantly fewer
candidate corners than actual corners with a very high probability that each candidate corner detected is an actual corner,
or too many candidate corners with a significantly lower
probability that each candidate corner detected is an actual
corner. In order to obtain the maximum number of candidate
corners that are actual corners, a secondary check is required
that will reliably and quickly indicate whether a candidate
corner is, in fact, an actual corner.
Upon obtaining a set of candidate corner indices using a
corner detection algorithm, an additional geometric analysis
can be performed to verify that each candidate in the set
is, in fact, a corner. The proposed test calculates the ratio,
dratio , of a simple external approximating perimeter about a
candidate corner point to a simple internal perimeter about
the same candidate corner point. If this ratio is relatively large
or relatively small, then the candidate corner is very likely to
be a corner. Additionally, using only dratio , the convexity or
concavity of a closed curve (relative to a centroid of the curve)
can be determined. This process is explained below.
First, a single arbitrary candidate corner index, i, and its
corresponding point in the data set, Pa are isolated. Two points
from the data set, P1 and P2, each with an offset of m units
from i in the indexing scheme and positioned left and right of
Pa , respectively, are selected. A relative displacement, Davg ,
of two hypothetical points, Ph1 and Ph2 , from Pa is calculated.
For digitally generated data sets where the distance between
points is determined by the resolution of the device used to
obtain the data, the displacement between P1 and Pa should
be approximately equal to the displacement between P2 and
Pa and Davg . However, to provide robust behavior for both
regular and irregular data sets and to allow for the errors
commonly found in digital data, Davg is computed using:
Davg =
1 p
(xa − x1)2 + (ya − y1 )2
2
p
+ (xa − x2)2 + (ya − y2 )2 .
This is the average magnitude of displacement between
the candidate corner point and its neighboring points of
consideration, which is useful because it provides a relative
measure of displacement from the candidate corner point at
which we will place two new points. Next, the angular slope
of the line passing through the midpoint of L(P1 , P2) and Pa ,
ζ, is computed which is found using the equation:
y1 + y2 − 2ya
.
ζ = tan−1
x1 + x2 − 2xa
After obtaining Davg and ζ, the x and y displacement of
points Ph1 and Ph2 from Pa can easily be determined:
xdisp = Davg · cos(ζ)
ydisp = Davg · sin(ζ)
dratio can now be computed:
p
(xa + xdisp − x1)2 + (ya + ydisp − y1 )2
p
+ (x2 − xa − xdisp )2 + (y2 − ya − ydisp )2
dratio = p
(xa − xdisp − x1)2 + (ya − ydisp − y1 )2
p
+ (x2 − xa + xdisp )2 + (y2 − ya + ydisp )2
Fig. 5.
Quadrilateral from which the distance ratios are computed.
If the points P1, P2 and Pa lie on a straight or nearly straight
line (angle P1 Pa P2 is very near 180o ), dratio will be very
close to 1. If the points form a sharp corner at Pa , dratio will
be either very close to zero or very large, depending upon
the orientation of the hypothetical points with regard to the
centroid of the curve. To test for concavity, it is necessary to
ensure that either Ph1 or Ph2 is always oriented toward the
centroid. If Ph2 is oriented centroid-inward, a dratio >> 1
indicates a convex corner and a dratio << 1 indicates a
concave corner. Similarly, if Ph1 is oriented centroid-inward, a
dratio >> 1 indicates a concave corner and a 0 < dratio << 1
indicates a convex corner. If no test for concavity is required,
a non concavity-biased value of dratio can be computed by
taking the inverse of any dratio value less than 1. A cost
minimization analysis of dratio values (see Section 3 above)
showed that a minimum corner detection threshold of 1.75 for
dratio was a reliable indicator of convex corners for a centroidinward Ph2 orientation.
5 RESULTS
The proposed changes to Hood’s algorithm were implemented and the modified (and completely deparametrized)
algorithm was run on 62 closed curves comprised of 240 total
corners as described in (Section 3). Included in these 62 curves
were the original 52 curves used during the optimization of
the algorithm and another 10 curves that were chosen to test
the algorithm’s effectiveness. For each curve, the corners were
determined subjectively by hand to provide a comparison with
which to gauge the accuracy of the algorithm. The geometric
secondary check described above was applied to each candidate corner found by the primary detection algorithm.
The enhanced corner detection algorithm isolated 247 candidate corner points in the data. Fourteen of these were
determined to be non-corners by the geometric secondary
corner test. Of the 240 actual corners in the data, 233 were
correctly determined to be corners by the algorithman overall
accuracy of 97.1%. Of the seven missed corners, five were
undetected by the primary algorithm and two were erroneously
eliminated by the secondary check. The algorithm found no
false positive corners on any of the curves.
The five corners undetected by the primary algorithm fall
into one of two classifications of error:
I. Corners missed because of a problem in the primary
detection algorithm.
II. Corners missed because their status as corners is questionable.
The first type of error is more serious than the second, but a
reasonable explanation is documented by Hood et al. in [6].
These missed corners arise because corners are detected by
calculating the tendency of a point’s neighboring points to
have a large displacement from the centroid relative to that
point. In this case, the centroid’s displacement from the missed
corner’s neighbors occurs on-axis to the displacement of the
corner itself from the centroid, resulting in a smaller than
expected relative displacement. As described by Hood [6], this
problem is rare and is found more frequently in curves which
are hand drawn than curves resulting from the digitization of a
physical object. Of the five corners undetected by the primary
algorithm, only two fall into this category and both were hand
generated.
The second type of error is more common and, unfortunately, unavoidable. It arises because the human perception of
corners allows for some leeway between what is and what is
not a corner. These pseudo corners are typically rounder and
smoother than an ideal corner, which is sharp and non-smooth.
So long as the number of corners that fall into this category is
small relative to the total number of corners correctly detected,
missed corners of this type can be categorized as an acceptable
loss. Of the five corners undetected by the primary algorithm,
three are categorized as type II.
Two candidate corners were incorrectly determined to be
noncornerly by the secondary geometric corner test. In both
cases, the corners were very nearly flat with a dratio value
of approximately 1, resulting in the erroneous elimination of
the candidate corner. Interestingly, both of these curves were
generated from the digitization of a hand cut piece of paper
with shallow corner angles. Although both corners were sharp,
they lacked the strong curvature of an ideal corner and thus
were not detected. Arguably, these corners fit into the type II
category mentioned above and, as the number of corners of
this type which were falsely eliminated (.810 % of all corners
detected) is small, the loss is acceptable.
6 CONCLUSION
In this paper, a de-parameterization of an existing discrete
corner detection algorithm for closed curves is discussed.
Improvements to the original algorithm are proposed which
significantly enhance its corner detection accuracy. A new
geometric test for corners is proposed which is capable of
quickly eliminating extraneous corners detected by this and
other corner detection algorithms.
The accuracy of the original corner detection algorithm
has been improved slightly. More significantly, the original
algorithm has been completely de-parameterized, which allows
it to operate on virtually any set of data with minimal user
intervention. The additional corner check is found to be highly
effective at eliminating false positive corners. The enhanced
algorithm runs nearly as quickly as the original, with a
marginal time cost incurred from an extra round of curvature
smoothing and the additional corner test.
Future work could focus on improving corner detection
accuracy still further by loosening the corner detection sensitivity of the primary detection algorithm and imposing a more
stringent geometric secondary test to eliminate false positive
corners. Also, instead of simply determining whether a point
is or is not a corner, a probability of a point being a corner
could instead be determined. This would potentially alleviate
some of the problems with discrepancies between what is and
is not considered a corner as in the type II missed corners
described in Section 5.
7 REFERENCES
[1] K. Abe, R. Morii, K. Nishida, and T. Kadonaga. Comparison of methods
for detecting corner points from digital curves – a preliminary report.
IEEE, pages 854–857, 1993.
[2] I.M. Anderson and I.C. Bezdek. Curvature and tangential deflection of
discrete arcs; a theory based on the commutator of scatter matrix pairs
and its application to vertex detection in planar shape data. IEEE Trans.
Pattern Analysis and Machine Intelligence , 6:27–40, 1984.
[3] J. Biemond, R.L. Lagendijk, and R.M. Mersereau. Iterative methods for
image deblurring. Proceedings of the IEEE, 78:856–883, May 2001.
[4] H. Freeman and L.S. Davis. A corner finding algorithm, for chain coded
curves. IEEE Trans. Comput., pages 297–303, 1977.
[5] D.S. Guru, R. Dinesh, and P. Nagabhushan. Boundary based corner deterction and localization using new ’cornerity’ index: A robust approach.
Proceedings of the First Canadian Conference on Computer and Robot
Vision (CRV’04), pages 417–423, 2004.
[6] J.B. Hood, Y. Peng, and D. Sims. Locating convex corner points on
discrete closed curves. Proceedings 2007 International Conference on
Image Processing, Computer Vision, and Pattern Recognition , pages
309–313, 2007.
[7] Q. Ji and R.M. Haralick. Corner detection with covariance propagation.
IEEE, pages 362–367, 1997.
[8] R. Mehrotra, S. Nichani, and N. Ranganathan. Corner detection. IEEE;
Patern Recognition, 23:1223–1233, 1990.
[9] P.V. Sankar and C.V. Sharma. A parallel procedure for the detection
of dominant points on digital curves. Computer Graphics and Image
Processing, 7:403–412, 1978.
[10] M. Sarfraz, A. Rasheed, and Z Muzaffar. A novel linear time corner
detection algorithm. Proceedings of the Computer Graphics, Imaging
and Vision: New Trends (CGIV’05), pages 191–196, 2005.
[11] G.A.F. Seber and C.J. Wild. Nonlinear Regression. John Wiley and
Sons, New York, 1989.
[12] Cho-Huak Teh and Roland T. Chin. On the detection of dominant
points on digital curves. IEEE Transactions on Pattern and Machine
Intelligence, 11(8):859–872, 1989.
[13] X. Zhang, R.M. Haralick, and V. Ramesh. Corner detection using the
map technique. IEEE, pages 549–551, 1994.
Download