Professional Documents
Culture Documents
www.elsevier.com/locate/patcog
of Mechanical Engineering, The University of Hong Kong, Room 7-9, Haking Wong Building,
Pokfulam Road, Hong Kong
b State Key Laboratory for Novel Software Technology, Nanjing University, Nanjing 210093, China
c Faculty of Mechanical Engineering, Dalian University of Technology, Dalian 116024, China
Received 26 June 2001; received in revised form 30 January 2002; accepted 25 February 2002
Abstract
After analyzing the existing methods, based on holo-extraction method of information, this paper develops a recognition
method of digital curves scanned from paper drawings for subsequent pattern recognition and 3D reconstruction. This method
is 5rst to construct the networks of single closed region (SCRs) of black pixels with all the information about both segments
and their linking points, to classify all the digital contours represented by SCRs into three types: straight-line segments, circular
arcs, and combined lines, and then to decompose the combined lines into least basic sub-lines or segments (straight-line
segments or circular arcs) with least 5tting errors using genetic algorithms with adaptive probabilities of crossover and mutation
and to determine their relationships (intersecting or being tangential to each other). It is veri5ed that the recognition method
based on the networks of SCRs and the genetic algorithm is feasible and e:cient. This method and its software prototype can
be used as a base for further work on subsequent engineering drawing understanding and 3D reconstruction. ? 2002 Pattern
Recognition Society. Published by Elsevier Science Ltd. All rights reserved.
Keywords: Engineering drawing; Digital curves; Curve 5tting; Combined lines; Pattern recognition; Genetic algorithms
1. Introduction
In engineering drawings, the outlines of projections of
parts and annotations all consist of many elements which can
be straight-line segments, circular arcs, elliptical arcs, other
curves, or combined lines. The other curves can be normally
5tted by spline functions, and are called as spline curves
hereafter. The combined lines may comprise straight-line
segments, circular arcs, elliptical arcs, and=or spline curves,
which intersect or are tangential to each other. After a paper drawing is scanned and inputted into a computer in the
form of raster (binary) image, these elements represented
Corresponding author. Tel.: +852-2859-2630; fax: +8522858-5415.
E-mail address: kzchen@hkucc.hku.hk (K.-Z. Chen).
0031-3203/02/$22.00 ? 2002 Pattern Recognition Society. Published by Elsevier Science Ltd. All rights reserved.
PII: S 0 0 3 1 - 3 2 0 3 ( 0 2 ) 0 0 0 6 7 - 5
124
125
Fig. 1. The run length graph and the closed region graph of digital
curves.
126
(2)
N
N
N
N
1
2
2
2
2
=
x 2 xi a + Na + yi 2 yi b+Nb ;
N i=1 i
i=1
i=1
i=1
(10)
where
2
N
N
a11 = 2
xi N
xi2 ;
i=1
a12 = a21 = 2
b1 =
i=1
xi2
N
N
i=1
N
yi
2
i=1 xi
N
i=1
N
xi
i=1
N
xi
i=1
)2
xi y i
(5)
(7)
where (a; b) and R denote the coordinates of the circles centre and its radius, respectively, and can be estimated using
the following formulas [20]:
b1 a22 b2 a12
a=
;
(8)
b2 a11 b1 a21
;
(9)
b=
xi2
i=1
and
N
xi y i
(12)
i=1
(13)
i=1
y = kx + c;
c=
yi N
i=1
2
N
2
yi N
yi ;
a22 = 2
b2 =
(
x
)
i
i
i=1
i=1
xi
i=1
(11)
i=1
i=1
xi N
i=1
xi2
xi3 +
i=1
yi N
i=1
i=1
xi
i=1
yi3 +
i=1
yi2 N
i=1
yi
i=1
xi yi2 ;
i=1
yi2 N
i=1
(14)
xi2 yi
(15)
(16)
127
Combined line
Initial population
Mating pool
Crossover
Mutation
Offspring
Selection
New
No
Are stopping
criteria
satisfied?
Yes
Elitist
Fig. 3. The block diagram of the algorithm.
(18)
(19)
Each segment in a combined line represented by a chromosome can be 5tted by a straight line or a circular arc.
Their approximation errors (ds and dc ) can be calculated
using Eqs. (6) and (17), respectively. The smaller error will
128
010 ...
26
010 ...
22
010 ...
010 ...
18
17
010 ...
010 ...
25
26
010 ...
010......
25
Di; j =
|gi (l) gj (l)|
(21)
l=1
t;
if Fit(Ci ) Fit;
where t =0:35; Fitmax is the maximum 5tness function value
in the population, and Fit is the average 5tness function
value of the population. In the mutation process, a random
number in [0; 1] for every gene position within the chromosome string is generated and checked. If the random number
is small than the probability of mutation, the bit values of
the gene is altered, otherwise, it is kept unchanged.
4.5. Selection
After crossover and mutation operations, an elitist selection scheme is used. The chromosome with the highest
5tness function value among the old population and its
oMspring is selected as an elitist and copied directly into
the new population of next generation. With the operation,
natures survival-of-the-5ttest mechanism can be guaranteed. The other chromosomes are selected by a roulette
selection scheme. A roulette wheel, on which each chromosome in the old population and its oMspring is represented
by a slot with slot size proportional to its 5tness function
values, is utilized. The probability, which a chromosome Ci
is selected as a member of the next generation, is:
Fit(Ci )
P(Ci ) = M
;
j=1 Fit(Cj )
(24)
129
number of iteration or error threshold. In this case, a threshold for the number of generations, which have the same best
chromosomes, is used. That is, if ni n is greater than a
threshold q =20, the iteration process can be stopped, where
ni is the current generation number and n denotes the generation number when the best chromosome, among all generations, is 5rst found. Then the best chromosome can be
output as the optimal solution. For the example of the combined line in Fig. 4, the best combined line represented by
the best chromosome was obtained as shown in Fig. 4(c).
It can be seen that the elliptical arc (AB) consists of two
circular arcs (AH and HB), and that the spline curve (FG)
comprises two circular arcs (FK and LM) and two short
straight-line segments (KL and MG).
4.7. Determination of the relationships between the
segments
In the best chromosome, the point corresponding to the
gene being 1 is a break point. The segment bounded by two
break points has been 5tted by a straight-line or a circular arc
with the least error. The relationship between two adjacent
segments can be determined using the following rules:
(1) If they are both straight-lines, they intersect each other.
(2) If they are both circular arcs, the distance between their
centers will be calculated. When the distance is equal to
the sum of their radii, the two arcs are externally tangent
to each other. If the distance is equal to the diMerence
of their radii, the two circular arcs are internally tangent
to each other. Otherwise, they intersect each other.
(3) If one segment is a straight-line and another a circular
arc, the distance from the center of circular arc to the
straight-line will be calculated. If the distance is equal
to the radius of the circular arc, the straight line is
tangential to the circular arc. Otherwise, they intersect
each other.
With the types of segments and their relationships determined, the combined line can thus be reconstructed.
5. Software prototype
Based on the method introduced above, a software prototype has been made in C++. Many digital curves have been
recognized successfully by using this software prototype. As
an example for it, Fig. 6(c) shows the results of running the
software prototype for a view of a drawing shown in Fig.
6(a). Fig. 6(b) shows its closed region graph for illustration. It is obvious that the recognition method based on the
genetic algorithm is feasible.
6. Conclusions
The research on the conversion from 2D paper drawing
to 3D computer feature model has been stuck in low-level
coding [24]. One of the reasons for it is that the three phases
of understanding process has been isolated and people have
been doing their research on only one of the phases since
the whole conversion is complicated and more di:cult. For
instance, the vectorization methods for the 5rst phase were
developed only for getting straight lines, arcs, circles, etc. so
that much information contained in the drawing has been lost
after the vectorization. In fact, the understanding processes
for its subsequent 3D reconstruction is an iterative process
for searching diMerent level relationships and performing
corresponding connections. In order to facilitate the iterative processes, a holo-extraction of information from raster
image is needed, and a compact representation of raster image should be generated as a bridge from raster image to
understanding. Such holo-extraction method of information
from paper drawings has been developed [18] by constructing the networks of single closed regions (SCRs) of black
pixels. The networks of SCRs are diMerent from the vectors
recognized by vectorization. A network of SCRs represents
a set of connected segments or elements and contains not
only the information about the related segments themselves
but also the types of linking points among these segments
for diMerent relationships of the related segments (e.g., tangential point, intersecting point, and merging junction) to
provide necessary information for extracting lexical, syntactic, and semantic information in the subsequent phases.
Therefore, the networks of SCRs are the bridges from raster
image to understanding. The recognition method of digital
curves introduced in this paper is developed based on the
new holo-extraction methods and used for subsequent pattern recognition and 3D reconstruction. This method is 5rst
to construct the networks of single closed regions (SCRs)
of black pixels with all the information about both segments
130
References
[1] W. Wan, J.A. Ventura, Segmentation of planar curves into
straight-line segments and elliptical arcs, Graph. Models
Image Process. 59 (6) (1997) 484494.
[2] A. Rosenfeld, E. Johnston, Angle detection on digital curves,
IEEE Trans. Comput. C-22 (1973) 875878.
[3] A. Rosenfeld, J.S. Weszka, An improved method of angle
detection on digital curves, IEEE Trans. Comput. C-24 (1975)
940941.
[4] C.H. Teh, R.T. Chin, On the detection of dominant points on
digital curves, IEEE Trans. Pattern Anal. Mach. Intell. 11 (8)
(1989) 859872.
[5] A.M.N. Fu, H. Yan, K. Huang, A curve bend function based
method to characterize contour shapes, Pattern Recognition
30 (10) (1997) 16611671.
[6] F. Moktarian, A.K. Mackworth, A theory of multiscale-based
shape representation for planar curves, IEEE Trans. Pattern
Anal. Mach. Intell. 14 (8) (1992) 789805.