8
A fast, memory-efficient and parallelizable arc/circle segmentation algorithm Fei Wang * , Zejian Yuan, Nanning Zheng, Yuehu Liu Institute of Artificial Intelligence and Robotics, Xian Jiaotong University, No. 28 Xianning Road, Xi’an 710049, Shaanxi, PR China article info Keywords: Graphics recognition Arc segmentation Discrete curvature abstract This paper presents a fast parallelizable arc/circle segmentation method with small mem- ory cost. Firstly the proposed method extracts the edge and skeleton information in image space, records every line fragment in a multi-fork tree as a node which can be processed concurrently. For simplifying the computation, every line fragment is approximated by its piecewise linear polygon (PLG). After that local discrete curvature of each dominant point (DP) on the PLG is calculated and used to estimate the local arc’s existence approx- imately, the arc’s parameters are calculated simultaneously. Finally the inveracious arcs would be erased according to the results of arc verification and the arc fragments would be jointed by the arc combination and tracking. This proposed method can deal with the edge rupture, intersection and overlapping conditions. Furthermore it requires small mem- ory space and the parallel processing technology can be implemented to make it faster. Ó 2008 Elsevier Inc. All rights reserved. 1. Introduction Arc segmentation is an important aspect in the graphics recognition field because of omnipresent circular/round shapes existing in the real world. In image analysis and understanding, especially for extracting graphic objects from scanned engi- neering drawings, arc segmentation is a necessity and it has received great attention in the past several decades [1–6,9,10]. Current segmentation methods can be classified into two groups: raster image based and vector image based methods [8]. The first group includes algorithms that implement arc segmentation based on raster images, such as the hough transform (HT) [11,14], Curvature Estimation, statistical and pixel tracking algorithms. Such a kind of methods directly segment arc elements from raster images via pixel-level processing. As a large quantity of pixel data should be processed, these methods are very time-consuming and space-consuming. They are not applicable for actual industrial applications. The second group consists of arc segmentation methods based on vector images, including arc-fitting, circular HT and stepwise arc extension methods. These vector image based methods greatly reduce time–cost and space-complexity greatly by vectorization com- paring to the raster image based ones. Currently, arc segmentation is far from satisfying due to some difficulties, such as noise introduced during scanning pro- cess and narrow angle, tangency, intersection with other geometry objects in the complex environment, which result in great algorithm complexity. For example, if the circular objects are isolated and have clear edges, they can be recognized fast and the geometry parameters can be predicted accurately and quickly. However, in real world there are so much noise that leads to blurry and coarse edges; and several circular/round objects may overlap each other. All these make arc segmentation be- come difficult. 0096-3003/$ - see front matter Ó 2008 Elsevier Inc. All rights reserved. doi:10.1016/j.amc.2008.05.129 * Corresponding author. E-mail address: [email protected] (F. Wang). Applied Mathematics and Computation 205 (2008) 841–848 Contents lists available at ScienceDirect Applied Mathematics and Computation journal homepage: www.elsevier.com/locate/amc

A fast, memory-efficient and parallelizable arc/circle segmentation algorithm

Embed Size (px)

Citation preview

Page 1: A fast, memory-efficient and parallelizable arc/circle segmentation algorithm

Applied Mathematics and Computation 205 (2008) 841–848

Contents lists available at ScienceDirect

Applied Mathematics and Computation

journal homepage: www.elsevier .com/ locate/amc

A fast, memory-efficient and parallelizable arc/circlesegmentation algorithm

Fei Wang *, Zejian Yuan, Nanning Zheng, Yuehu LiuInstitute of Artificial Intelligence and Robotics, Xian Jiaotong University, No. 28 Xianning Road, Xi’an 710049, Shaanxi, PR China

a r t i c l e i n f o

Keywords:Graphics recognitionArc segmentation

Discrete curvature

0096-3003/$ - see front matter � 2008 Elsevier Incdoi:10.1016/j.amc.2008.05.129

* Corresponding author.E-mail address: [email protected] (F. Wang

a b s t r a c t

This paper presents a fast parallelizable arc/circle segmentation method with small mem-ory cost. Firstly the proposed method extracts the edge and skeleton information in imagespace, records every line fragment in a multi-fork tree as a node which can be processedconcurrently. For simplifying the computation, every line fragment is approximated byits piecewise linear polygon (PLG). After that local discrete curvature of each dominantpoint (DP) on the PLG is calculated and used to estimate the local arc’s existence approx-imately, the arc’s parameters are calculated simultaneously. Finally the inveracious arcswould be erased according to the results of arc verification and the arc fragments wouldbe jointed by the arc combination and tracking. This proposed method can deal with theedge rupture, intersection and overlapping conditions. Furthermore it requires small mem-ory space and the parallel processing technology can be implemented to make it faster.

� 2008 Elsevier Inc. All rights reserved.

1. Introduction

Arc segmentation is an important aspect in the graphics recognition field because of omnipresent circular/round shapesexisting in the real world. In image analysis and understanding, especially for extracting graphic objects from scanned engi-neering drawings, arc segmentation is a necessity and it has received great attention in the past several decades [1–6,9,10].Current segmentation methods can be classified into two groups: raster image based and vector image based methods [8].The first group includes algorithms that implement arc segmentation based on raster images, such as the hough transform(HT) [11,14], Curvature Estimation, statistical and pixel tracking algorithms. Such a kind of methods directly segment arcelements from raster images via pixel-level processing. As a large quantity of pixel data should be processed, these methodsare very time-consuming and space-consuming. They are not applicable for actual industrial applications. The second groupconsists of arc segmentation methods based on vector images, including arc-fitting, circular HT and stepwise arc extensionmethods. These vector image based methods greatly reduce time–cost and space-complexity greatly by vectorization com-paring to the raster image based ones.

Currently, arc segmentation is far from satisfying due to some difficulties, such as noise introduced during scanning pro-cess and narrow angle, tangency, intersection with other geometry objects in the complex environment, which result in greatalgorithm complexity. For example, if the circular objects are isolated and have clear edges, they can be recognized fast andthe geometry parameters can be predicted accurately and quickly. However, in real world there are so much noise that leadsto blurry and coarse edges; and several circular/round objects may overlap each other. All these make arc segmentation be-come difficult.

. All rights reserved.

).

Page 2: A fast, memory-efficient and parallelizable arc/circle segmentation algorithm

842 F. Wang et al. / Applied Mathematics and Computation 205 (2008) 841–848

In this paper a novel fast arc/circle segmentation method is presented, which is based on the mechanism of hypothesisgeneralizing and validating, aiming at solving current problems in the arc/circle detection in engineering drawing under-standing field.

The rest of this paper is arranged as follows: in Section 2 the image vectorization method and line parameters computa-tion method are discussed. Section 3 describes details of our segmentation algorithm based on arc hypothesizing and vali-dating mechanism. The performance evaluation and comparison will be given in Section 4. Conclusion and future work areachieved in Section 5.

2. Image vectorization and line parameters computation

As Fig. 1 illuminates, we make use of the edge and skeleton information to construct vector images, and then compute arcparameters to carry on arc hypothesis and validation. In our proposed method, the arc validation of each arc tiles can be pro-cessed separately after arc hypothesis.

2.1. Image vectorization

Edges and skeletons can represent object outlines in a simple but very effective way [10]. So in our method we decide toconstruct the vector image based on edges and skeletons. Firstly, we detect the edges and skeletons of objects in originalimages, and then use a two-dimension list data structure to record them in memory [12] for fast indexing and convenientcomputation.

In detail, in our method we extract object edges with the Sobel operator and detect skeletons with distance transform(DT) technique. Fig. 2 shows the vectoring process with DT method. After the steps of edge extraction and skeleton detection,we use linear polygonal approximation (LPA) to characterize the object shape [7] and generate the vector image. In Fig. 2cthe two end points of the curve with single arrowhead represent two vertexes of the linear polygonal approximation, and thearrow means the two vertexes are connected by a pointer which is convenient for searching and indexing. Another thingwhich should be explained especially is that we choose the edge or skeleton to describe a line according to its linewidth.Tlinewidth is denoted as a threshold. If a line is wider than Tlinewidth, we should adopt the edge to characterize the line; other-wise the skeleton will be employed.

Fig. 1. The flowchart of our proposed method.

Fig. 2. Skeleton image and list data structure: (a) two arcs in the original image; (b) after vectorization the two arcs can be described as two skeletons in thevector image; (c) two-dimension list data structure in the computer’s RAM to presents the two skeletons.

Page 3: A fast, memory-efficient and parallelizable arc/circle segmentation algorithm

Fig. 3. Linewidth computation method. Gray part is the original line, black broken-line means the skeleton, point Pij is a pixel on the skeleton, LPij denotes the

linewidth at point Pij.

F. Wang et al. / Applied Mathematics and Computation 205 (2008) 841–848 843

2.2. Local slope and linewidth computation

Edge and skeleton image can be regarded as a collection of polygons which is composed of many short straight lines. Anystraight line has two important attributes: line-slope and linewidth. In our proposed method we compute the slope andwidth of every short straight line as the line’s features. In Fig. 3, we denote the points in the ith line as Pi = {Pijjj = 1, . . ., N}.The width on point Pij can be expressed as LP

ij ¼ Lþij þ L�ij þ 1, where the Lþij and L�ij stand for the partly width of point Pij ondifferent perpendicular directions, respectively. The constant 1 means the self-width of skeleton. Thereby the ith linewidthcan be expressed as linewidthi ¼ 1

N

Pj2½1;N�L

Pij.

3. Local arc hypothesis

3.1. Local arc segmentation and hypothesis

Under ideal conditions, the arc/circle in plane geometry has the following characters: (1) each edge of the arc/circle’s lin-ear polygonal approximation should have the same length and the polygon should have regular form; (2) the curvatures ofeach point in the arc/circle edge should be an constant; (3) the number of the approximate polygon’s edges should be largerthan threshold Tedge_num. In this paper the threshold Tedge_num is initialized with 3.

Assume that the sequence of approximate polygon’s edge is (k1,k2, . . ., kh) and the vertex sequence is (v1, v2, . . ., vm).According to the three characters of arc/circle in plane geometry above, we hypothesize that vectors meeting the followingcriteria are considered arc/circle:

Condition A: The approximate polygon’s edge number should be greater than or equal to 3,

Tedge num ¼ 3: ð1Þ

Condition B: The length of each approximate polygon’s edge should be equal to each other,

LenðkiÞ ¼ Lenðkiþ1Þ i ¼ 1;2; . . . ;h� 1: ð2Þ

Condition C: Define Curva(vi) as the curvature of vi, where the vi is the ith vertex of approximate polygon. Then any twovertexes’ curvatures should be the same. That is

CurvaðviÞ ¼ CurvaðvjÞ i; j ¼ 1;2; . . . ;m� 1: ð3Þ

The method we adopt to calculate the Curva(vi) is THE-CHIN algorithm described in [13], in which k is initialized with 5experientially. Based on the three conditions above, we search the sub-skeletons and label them as arc hypotheses which

Fig. 4. Label sub-skeleton as arc hypothesis.

Page 4: A fast, memory-efficient and parallelizable arc/circle segmentation algorithm

844 F. Wang et al. / Applied Mathematics and Computation 205 (2008) 841–848

satisfy the condition A, B and C at the same time. Fig. 4 shows that the sub-skeleton PiPj is labelled as an arc hypothesisarcðPiPjÞ.

3.2. Arc verification

While labelling a sub-skeleton as an arc hypothesis, the arcs’ parameters, such as radius, center, start-angle and end-an-gles, could be calculated. According to the theorems of plane geometry we learn that the perpendicular bisector of any chordshould across its circle center. So abstractly we can get the center of an arc by calculating the coordinate of the perpendicularbisector’s intersection. However, due to heavy noise, the perpendicular bisectors may not intersect on the center point ofcircle. Actually, we employ a round region Ccenter, center region showed in Fig. 5, to denote the region in which the centermay exist. In Fig. 5, the arc hypothesis’ radius is presented as Rradius 2 [RMIN,RMAX], in which RMIN and RMAX are the possibleminimal and maximal value of the radius range.

3.2.1. Arc parameters computationThe edges of the approximate polygon can be regarded as the arc/circle’s chords because the vertexes overlap on the arc/

circle’s skeleton. Assume that the chords sequence of an arc can be presented as H = {hiji = 1, 2, . . ., K}, and the coordinates oftwo end points and line-slope of any chord are known. According to plane geometry theorem we can get the expression ofany chord’s perpendicular bisector. After that the intersections of any two perpendicular bisectors C = {ci} can be figured out.Denote the barycenter of the C as c0, then

r0 ¼ MAXðlenðc0; ciÞÞ

Dr ¼ 1K

XK

i¼1

linewidthi;

where K means the number of chords. The region Ccenter can be defined as a round whose center is c0 and radius is rc, whererc = r0 + Dr. If we denote R0 as

R0 ¼ 1K

XK

i¼1

distanceðc0;hiÞ;

it will represents the average distance from c0 to every vertex of the linear polygonal approximation, where the Distance(c0,hi)means the Euclidean distance between c0 and hi; if we order the RMIN and RMAX, respectively as:

RMIN ¼ R0 � Dr

RMAX ¼ R0 þ Dr;

where the R0 can be regarded as the possible radii. Until now both the center region Ccenter and radius range Rradius arecomputable.

In fact we employ a kind of coarse-to-fine method to gain the arc center and radius, from center region and radius rangeto real center and radius. We propose an improved CHT method, called LCHT (local circle hough transform) to calculate the

Fig. 5. Center region and radius range computation.

Page 5: A fast, memory-efficient and parallelizable arc/circle segmentation algorithm

F. Wang et al. / Applied Mathematics and Computation 205 (2008) 841–848 845

real arc parameters. We use the original image data to implement CHT method to vote arc parameters [15]. We improve thecomputing efficiency enormously by making use of the radius range Rradius to decrease the size of accumulation matrix andtaking advantage of the center region Ccenter to limit the searching area. The details of this part will be discussed in Section 4.

3.2.2. Arc combination, tracking and verificationDuring the scanning and pre-processing, some noises may be introduced into the scanned image, which probably break

the arcs [10]. In this instance combination should be done to recover the integrated arc if some small arcs have similar arcparameters, center and radius.

Assume that linewidthm denotes the mth arc’s linewidth, riarc and rj

arc denotes ith and jth arc’s radii, respectively, ðxiarc; y

iarcÞ

denotes the center coordinate of ith and jth arc. If ith and jth arcs satisfy the following condition D, E, F and G, we considerthat these two arc should be combined.

Firstly order linewidth ¼ linewidthiþlinewidthj

2 and �r ¼ riarcþrj

arc2 , combination qualifications are:

Condition D: Linewidth difference

jlinewidthi � linewidthjj 6MINðlinewidthi; linewidthjÞ: ð4Þ

Condition E:

Drarc 6 linewidth; ð5Þ

where Drarc ¼ jriarc � rj

arcj is the difference between ith and jth arc’s radius.Condition F:

Table 1Image i

Image

Size (piStorage

DCarc 6ffiffiffi2p� linewidth ð6Þ

where DCarc ¼ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiðxi

arc � xjarcÞ2 þ ðyi

arc � yjarcÞ2

qis the distance between two centers of ith and jth arc.

Condition G:

4� arcsinlinewidth

�r

!P D/ P 0 ð7Þ

where D/ ¼ j/iend � /j

startj is the rotate angle between ith and jth arc, /iend and /j

start is the end-angle of ith arc and start-angleof jth arc, respectively.

Fig. 6. The process of arc tracking.

nformation of test samples

S_1.bmp S_2.bmp S_3.bmp

xel � pixel) 1240 � 1020 2115 � 2807 2997 � 2084(MB) 1.19 5.77 5.98

Page 6: A fast, memory-efficient and parallelizable arc/circle segmentation algorithm

846 F. Wang et al. / Applied Mathematics and Computation 205 (2008) 841–848

After the two arcs are combined into a big one, the new radius, center, start-angle and end-angle should be recalculatedand the calculating formula can be denoted as follows:

Fig. 7. The samples and experiment’s results. (a–c) are the samples: S_1.bmp, S_2.bmp and S_3.bmp. The data in Table 1 show the basic information aboutthese samples. (d–f) are the results of our proposed method. In (d) we can see that all of arcs are detected. But in (e) there are some arcs omitted and in (f)there are some false detections. (g) is the corresponding part of combination of (b) and (e), the green arcs are the detection results. A part of (f) is shown in(h), we also combine the detection result with the original image (c), the same as above, the green curves are the detection results. The short straight linemeans the arcs’ radii and the ends of straight line mean the centers of arcs (For interpretation of the references to colour in this figure legend, the reader isreferred to the web version of this article.).

Page 7: A fast, memory-efficient and parallelizable arc/circle segmentation algorithm

Table 2Compar

Image

S_1.bmS_2.bmS_3.bm

F. Wang et al. / Applied Mathematics and Computation 205 (2008) 841–848 847

rnew ¼ �r ð8Þ

Cnew ¼xi

arc þ xjarc

2;yi

arc þ yjarc

2

!ð9Þ

/start new ¼ MINð/istart;/

jstartÞ ð10Þ

/end new ¼MAXð/iend;/

jendÞ ð11Þ

where the new start-angle /start_new should be updated by the small one between /istart and /j

start, and the new end-angle/end_new should be updated by the maximum one between /i

end and /jend shown as Fig. 6.

Sometimes an arc may be detected incompletely, which may be caused by excessive intersections or noises. After the arccombination we will take advantage of the new parameters to track the arc so that we can discover the little tiles owned bythe same arc. For example, as in Fig. 6, one circle is separated into tow arcs and one short tile. Firstly we employ the arc com-bination method to joint ARC1 and ARC2 as a new longer arc ARCnew. But the Tile1 failed to be combined. Then we will trackthe Arcnew in two directions: DIR1 and DIR2.

rnew and Cnew are the new radius and center of ARCnew. And a Sstep degrees rotation is executed as shown in Fig. 6. If oneblack pixels can be found along the direction DIR1, such as m0, we consider there is an arc tile. Then we will calculate theblack pixels percentage Bpercent in window W1, whose width and height are both equal to the linewidth of ARCnew. If theBpercent P 0.5 we consider that the m0 point belongs to the arc. Consequently the arc’s parameter should be updated becauseof a new point found. This arc tracking will not stop until either the black pixel can not be found or the Bpercent < 0.5.

The last step in this section is to validate the arc parameters. The major method is to take advantage of the arc parametersto figure out the arcs’ point collections and map the points back to the original image to validate the arc’s facticity. If thepercentage of points in collection corresponding to these of the same arcs in the original image is greater than the thresholdTverify, we assume that the arc is a real one, otherwise it is an unreal one. Samples and experiment’s results are shown inFig. 7. We initialize the Tverify with 0.75 in our proposed method.

4. Experiments and performance evaluation

The classical CHT method allocates memory for the accumulative matrix at the beginning and memory size depends onthe image size and radius range.

MemCHT ¼ widthorg � heightorg � ðM þ 1Þ � size ofðintegerÞ; ð12Þ

where the M is the amount of possible radius, the constant 1 represents the memory space for original image. In our pro-posed method, one arc-detection module just processes one arc segment, and the memory cost is

Memproposed ¼ ½width� heightþ K � ð8Dr � r2c Þ� � size ofðintegerÞ: ð13Þ

where the K denotes the number of arc-detection modules as showed in Fig. 1.The data in Table 2 also illuminate total cost time by the proposed method and CHT method, respectively. Our proposed

method shrinks the parameter space to a little range for accelerating the computation speed, and its benefits include:

(1) Decreasing the input data. The image skeleton we deal with is just 1/linewidth times of original data. And we takeadvantage of the parallel technology to make sure that anytime only a part of data is input into the arc-detectionwhich is the most time-consuming part;

(2) Reducing the searching range of radius. This method computes every possible radius in a limited range Rrange;(3) Reducing the searching area of center. We know that in CHT method the maximum point of the accumulative matrix

corresponds to the center of circle. That means every point of the matrix should be searched. If the original image’swidth and height are widthorg and heightorg, respectively, then we must search widthorg � heightorg �M points. Inour proposed method, we just search the points in the center region Ccenter, so we just need to search 2Dr � pr2

c pointsfor each arc segment, where Dr = RMAX � RMIN.

Compared with CHT, the proposed method has the following advantages: lower resource cost; higher processing speed;parallel processing and easiness for hardware implementation.

ison of performance of our proposed method with CHT

Memory cost (our method) (MB) Memory cost (CHT) (MB) Total time (our method) (s) Total time (CHT) (s)

p 2.76 120 1.75 83p 36 570 34 155p 49 630 73 180

Page 8: A fast, memory-efficient and parallelizable arc/circle segmentation algorithm

848 F. Wang et al. / Applied Mathematics and Computation 205 (2008) 841–848

5. Conclusion and future work

The outline of our proposed method is as follows: firstly, employ the edge extraction, DT and LPA algorithms to simplifydata collection; secondly, calculate the discrete curvature of the polygon vertexes based on the plane geometry features andthe arithmetic characters of arcs; thirdly, assuming some arcs exist in part image according to the features of vertex curva-tures, apply the LCHT algorithm to compute the parameters of arcs; finally, make use of the arc parameters to calculate thearc’s point coordinates and map the points back to the original image to validate the arc’s facticity.

As the analysis mentioned above, the proposed method can improve the processing effectively and reduce the necessarymemory cost in arc detection. But it is not stable in case of the distortion of skeleton on the junction places, which can beregarded as a kind of noises reducing the detection accuracy. In future work, we plan to improve the skeletonizing method toobtain better skeleton image and utilize special windows to process the junction regions. At the same time we want to adoptmulti-level zoom method to detect arcs with large different radius scale dynamically.

Acknowledgements

This work was supported partly by national key project funded of NSF (Project No.: 60021302) and national key project ofscientific and technical supporting programs of China (Project No.: 2006BAK31B04).

References

[1] D.H. Ballard, Generalizing the hough transform to detect arbitrary shapes, Pattern Recognition 13 (1981) 111–122.[2] I. Amir, Algorithm for finding the center of circular fiducials, Computer Vision, Graphics, Image Process 49 (1990) 398–406.[3] L. Moura, R. Kitney, A direct method for least-squares circle fitting, Computer Physics Communication 64 (1991) 57–63.[4] V.F. Leavers, The dynamic generalized hough transform: its relationship to the probabilistic hough transforms and an application to the concurrent

detection of circles and ellipses, Computer Vision, Graphics, Image Understanding 56 (1992) 381–398.[5] C. Ho, L. Chen, A fast ellipse/circle detector using geometric symmetry, Pattern Recognition 28 (1995) 117–124.[6] R.I. Debled-Rennesson, J.P. Salmon, L. Wendling, A new method to detect arcs and segments from curvature profiles, in: Proceedings of 18th

International Conference on Pattern Recognition, vol. 3, 2006, pp. 387–390.[7] P.L. Rosin, Techniques for assessing polygonal approximations of curves, IEEE Transactions on Pattern Analysis and Machine Intelligence 19 (1997)

659–666.[8] J.Q. Song, R.L. Michael, S.J. Cai, Effective multi-resolution arc segmentation: algorithms and performance evaluation, IEEE Transactions on Pattern

Analysis and Machine Intelligence 26 (2004) 1491–1506.[9] P. Dosch, G. Masini, K. Tomber, Improving arc detection in graphics recognition, in: Proceedings of 15th International Conference on Pattern

Recognition, vol. 2, 2000, pp. 243–246.[10] W. Liu, D. Dori, Incremental arc segmentation algorithm and its evaluation, IEEE Transactions on Pattern Analysis and Machine Intelligence 20 (1998)

424–431.[11] D.H. Ballard, Generalizing the hough transform to detect arbitrary shapes, Pattern Recognition 13 (1981) 111–122.[12] K. Tombre, C. Ah-Soon, P. Dosch, G. Masini, S. Tabonne, Stable and robust vectorization: how to make the right choices, Graphics Recognition 1941

(2000) 3–18.[13] C.H. Teh, R.T. Chin, On the detection of dominant points on digital curves, IEEE Transactions on Pattern Analysis and Machine Intelligence 11 (1989)

859–872.[14] D. Dori, Vector-based arc segmentation in the machine drawing understanding system environment, IEEE Transactions on Pattern Analysis and

Machine Intelligence 17 (1995) 1057–1068.[15] J. Lllingworth, J. Kitter, A survey of the hough transform. Computer vision, Graphics and Image Processing 44 (1988) 87–116.