Sensors & ransducers 013 b IFSA http://www.sensorsportal.com Straght Lne Detecton Based on Partcle Swarm Optmzaton Shengzhou XU, Jun IE College of computer scence, South-Central Unverst for Natonaltes, Wuhan, 430074, Chna E-mal: whkaoca@gmal.com Receved: 3 September 013 /Accepted: November 013 /Publshed: 30 December 013 Abstract: In order to reduce the computatonal tme and mprove the performance for straght lne detecton, a method based on partcle swarm optmzaton (PSO) s proposed n ths paper. Frst, each partcle, whch represents a straght lne, s ntalzed b randoml selected two edge ponts from the bnar mage. hen, the accumulated number of the edge ponts on the straght lne s obtaned b calculatng the dstance between the edge pont and the straght lne, and as the ftness value of the correspondng partcle. At last, f the ftness value of the global best soluton s larger than the pre-set threshold, extract the straght lne from the poston of the best partcle, otherwse, the algorthm ends. Comparng wth Hough transform and mproved randomzed Hough transform, the proposed method can effectvel reduce the problem of double countng and mprove the accurac and effcenc. Coprght 013 IFSA. Kewords: Straght lne, Detecton, Hough transform, Partcle swarm optmzaton, Ftness. 1. Introducton Straght lne detecton s a fundamental feld n computer vson. So far, man methods have been proposed, and Hough transform (H) s the most mportant and popular algorthm [1]. In H, each edge pxel s voted upon a quantzed parameter space. Each cell n the accumulator arra for the quantzed parameter space corresponds to a straght lne. he cell wth the local maxmum of scores s selected, and ts parameter coordnates are used to represent a lne n the mage space. H s ver robust to the presence of addtonal structures, nsenstve to nose, sutable for parallel processng, and could search several lnes n one process []. It has been appled wdel to mage processng, pattern recognton [3], character recognton [4], and defect detecton [5], etc. However, H also has the followng lmtatons as Xu et al. ponted out [6]: 1) he accumulator arra s practcall predefned b wndowng and samplng the parameter space n a heurstc wa. It usuall needs a large arra takng up much computng tme and storage. ) For one pxel, not onl the correct cell, but also man other cells are accumulated. hs brngs dffcultes n fndng the local maxma n the accumulator arra. Xu et al. proposed a Randomzed Hough ransform (RH) for detectng curves from a bnar mage [6]. Each tme, RH randoml chooses n edge pxels n the bnar mage wth equal probablt and fts them to a parameterzed curve. hs method can overcome the above mentoned lmtatons of H. However, RH performs better onl on the clean and smple mages; and ts performance degraded greatl on nos and complex mages. Furthermore, nose ncreases the number of ponts to be processed, whch n turn ncreases the computng tme and the number of erroneous detectons [7]. Artcle number P_1670 653
Cheng et al. proposed an elmnatng partcle swarm optmzaton Hough transform (EPSOH) []. he parameters of the soluton after H are consdered as the partcle postons, and the EPSO algorthm searches the optmum soluton b elmnatng the weakest partcles to speed up the computaton. An accumulaton arra n H s utlzed as a ftness functon of the EPSO algorthm. In order to reduce the computatonal tme and mprove the performance for straght lne detecton, a method based on PSO s proposed n ths paper. In ths method, each partcle of PSO represents a straght lne. he number of the edge ponts on the straght lne s counted, and the straght lne ndcated b the peak parameter s checked. he expermental results show the effectveness of the algorthm.. Related Work.1. Hough ransform H s recognzed as a powerful tool for graphc element extracton from mages due to ts global vson and robustness n nos or degraded envronment [8]. he standard H for straght lne s depcted b equaton (1). xcos sn, (1) where x, and, represent a pont n the mage space and ts parameter n the H parameter space, respectvel. All ponts on the same lne n the mage space wll ntersect at one pont n the H parameter space. Generall, the H for straght lne detecton and ts varants consst of three basc steps: 1) Feature ponts n the mage space are transformed nto a parameterzed curve of the parameter space. ) Accumulate hts for each parameter n the H space. 3) Detect peaks n the H parameter space, verf the lne ndcated b the peak parameter. Conventonal H requres huge parameter space, heav computaton and less-salent peaks. Randomzed Hough transform has been proposed to mprove the conventonal H [6]... Randomzed Hough ransform A straght lne can be expressed b follows. kx b, () where x, and kb, represent a pont n the mage space and ts parameter n the H parameter space, respectvel. wo ponts can determne a straght lne,.e. ponts x1, 1, x, can be mapped nto a pont kb, of the parameter space smpl b solvng the followng equatons: 1 kx1 b kx b (3) Based on ths dea, RH has been proposed [6]. Frst, two ponts x,, x 1, 1 are randoml selected from all the brght ponts of the bnar mage. hen, a parameter pont p k, b s gven smpl b solvng equatons (3), and put nto a parameter data set P. Repeat ths process, after a certan number of steps, there wll be a number of p ponts wth the same value accumulated. As a result, b fndng out those accumulated ponts n the set P, all the straght lnes n the mage space can be detected. In ths paper, we propose an mproved RH (IRH) method. In ths method, all the edge ponts lng on the straght lne currentl detected are removed from the pxel data set before the detecton of the next straght lne start. As a result, the storage can be greatl reduced, and t wll also mprove effcenc. 3. Proposed Approach 3.1. Partcle Swarm Optmzaton Algorthm Partcle swarm optmzaton (PSO) algorthm s a stochastc optmzaton method based on the smulatng the movement organsms n socetes such as brd flock and fsh school [9]. he fundamental hpothess of PSO suggests that socal sharng of nformaton among a group offers an evolutonar advantage. In other words, an ndvdual can proft from the dscoveres and prevous experence of all other members n that group. Each brd and fsh adjusts ts poston accordng to the postons of tself and other fellows to produce socal movement. Suppose the swarm s formed b n partcles. Each partcle conssts of two edge ponts n mage space, representng a straght lne. hen, the poston and veloct of the th partcle s denoted b x x1, 1, x, and v v1, v, v3, v4 respectvel, where 1,,, n, and x 1, denote the abscssa and ordnate value of one pont, and x, for the other pont. v 1, v, v 3, v 4 are veloctes of the two pont of the th partcle n the horzontal drecton and the vertcal drecton, respectvel. Each partcle fl n a 4-dmensonal space. PSO has a ftness functon to compute each poston s ftness value. In ths paper, the number of edge ponts on a straght lne denoted b a partcle s utlzed as the ftness of ths partcle. 654
It s mportant to determne the strateg to adjust postons of partcles. he veloct of a partcle s changed dependng on ts flng nerta, current poston, the best poston tself occurred n the past, and the optmal poston of the whole socet. he man evaluaton process of the swarm can be descrbed as follow. 1) Create n partcles to form an ntal swarm P { x1, x,..., x n }. Intalze the poston x and veloct v of each partcle randoml, and ntalze the best postons vsted so far b the th partcle P and the entre socet P g, as follows. the correspondng partcle, s obtaned b calculatng the dstance between the edge pont and the straght lne. At last, f the ftness value of the global best soluton s larger than the pre-set threshold, extract the straght lne from the poston of the best partcle. Otherwse, the algorthm ends. he algorthm flowchart s shown as Fg. 1. P P g x,1 n arg max f ( P ) 1 n ) Compute ftness value for each partcle and update ts veloct and poston as follows. For [1, n], v v cr( P x ) cr( P x ), (4) 11 g x x v, (5) If f( x) f( P) then P x, (6) If f( x) f( Pg) then Pg x, (7) where c1 and c are the learnng factors, r 1 and r are the random numbers unforml dstrbuted n the range of [0, 1]. 3) Repeat step untl termnaton crtera s met. Owng to ts smplct, eas mplementaton and relable convergence, PSO and ts varants have been used n a wde range of optmzaton problems. In ths paper, PSO s used to detect straght lne n mage, where, c1 c 1.5, w 0.7. 3.. Straght Lne Detecton As prevousl analzed, the conventonal H requres huge parameter space, heav computaton and less-salent peaks. RH performs better onl on the clean and smple mage. For complex mages, the number of ponts to be processed ncreases, and n turn ncreases the computng tme and the number of erroneous detectons. In order to mprove the performance of straght lne detecton, a method based on PSO s proposed n ths paper. In ths method, for pont pars randoml selected from the mage space, we do not map them nto parameter space lke RH, but use them to construct partcles of PSO, whch represent straght lnes. hen, the accumulated number of the edge ponts lng on the straght lne, whch s the ftness value of Fg. 1. he algorthm flowchart for straght lne detecton. he detaled process of the algorthm s as follows: For each partcle x x1, 1, x,, substtutng x, and x, nto equaton (3): 1 1 k x 1 x 1 b x 1 1 1 x x 1 (8) (9) hen, the straght lne represented b the partcle x can be expressed as: kx b x x x x x x 1 1 1 1 1 1 (10) Let, p x denotes an edge pont to be detected. If t s on the straght lne represented b (10), the 655
dstance of the pont p to the straght lne should be less than 1,.e. d k x b 1 k 1 (11) varous methods. In Fg. (384 88), H and IRH mssed a straght lne located n the center of the mage, but PSO does not. he effcenc of these methods s shown n able 1. he number of actual lnes n able 1 means the straght lne can be dstngushed b ees. hat s: k x b 1 k (1) Due to 1 k 1 (13) Inequalt (1) can be replaced wth the followng nequalt k x b 1 (14) hen, the nequalt (11) can be calculated smpl b substtutng (8) and (9) nto nequalt (14): Fg. (a). Results of straght lne detecton for smple mage: orgnal mage. x x 1 x x x x 1 1 1 1 1 1 (15) If the pont p x, satsfes nequalt (15), t ndcates that the pont p on the straght lne whch determned b partcle x x,, x,. 1 1 Otherwse, the pont s not on the straght lne. Repeat ths process on the other edge ponts of the bnar mage, and the accumulated number of the edge ponts on the straght lne can be obtaned. hs accumulated number s used to be the ftness value of partcle x. Accordng to the ftness value, the personal best soluton P and the global best soluton P can be selected from all the partcles. hen, all partcles are updated n accordance wth the formula (4) and (5). Repeat the above process untl the maxmum teraton number s reached. At last, the ftness value of the global best soluton P g s extracted and compared wth a pre-set threshold. If the ftness value s larger than the threshold, extract the straght lne represented b the poston of partcle P g, as the lne to be detected. Otherwse no straght lne meets the requrement, and the algorthm ends. g Fg. (b). Results of straght lne detecton for smple mage: detecton result of H. 5. Expermental Results Fgs. to 4 are results of straght lne detecton for smple mage, nos mage and real mage b H, IRH and PSO respectvel. In Fg. and Fg. 3 (both 9 93 pxels), there s no sgnfcant dfference n appearance between the results of the Fg. (c). Results of straght lne detecton for smple mage: detecton result of RH. 656
Fg. (d). Results of straght lne detecton for smple mage: detecton result of PSO. Fg. 3 (b). Results of straght lne detecton for nos mage: detecton result of H. able 1. Results contrast for dfferent methods. Fgure Method me(ms) Fg. Fg. 3 Fg. 4 No. of detected No. of actual H 51 6 RH 18 PSO 15 H 17 7 RH 18 PSO 61 H 456 37 9 RH 68 9 9 PSO 15 9 9 In order to verf the effectveness of the proposed algorthm, we compare the proposed method wth the tradtonal H and IRH algorthm on smulated and real mages. Expermental tools uses Matlab R008, and all the experments are completed on a PC wth Intel 3 3. GHz, memor 4 G. Fg. 3 (c). Results of straght lne detecton for nos mage: result of RH. Fg. 3 (d). Results of straght lne detecton for nos mage: detecton result of PSO. Fg. 3 (a). Results of straght lne detecton for nos mage: orgnal mage. It can be summarzed from able 1 as follows. For H, there are a lot of double-countng whch reduce the computatonal effcenc and effectveness, and t s dffcult to determne whch lne s double countng. Whle for IRH and PSO, we remove all the edge ponts on the straght lne currentl detected from the pxel data set E before 657
the detecton of the next straght lne. It helps to avod double countng, and reduce the computatonal tme. For complex mage, the number of ponts to be processed b IRH ncreases, and n turn ncreases the computng tme and the number of erroneous detectons. herefore, IRH performs well onl on the clean and smple mage, but PSO performed well n varous crcumstances. Fg. 4 (d). Results of straght lne detecton for real mage: detecton result of PSO. 6. Conclusons Fg. 4 (a). Results of straght lne detecton for real mage: orgnal mage. In order to reduce the computatonal tme and mprove the performance for straght lne detecton, a method based on PSO s proposed n ths paper. he straght lnes to be detected are consdered as the partcles postons, and the number of edge ponts lng on the straght lne s used to be the ftness of partcle. he expermental results ndcate that our method s potentall useful. Acknowledgements hs work was supported n part b the Natonal Natural Scence Foundaton of Chna (NO. 613019). References Fg. 4 (b). Results of straght lne detecton for real mage: detecton result of H. Fg. 4 (c). Results of straght lne detecton for real mage: detecton result of RH. [1]. P. V. C. Hough, Method and means for recognzng complex patterns, US Patent, 196. []. H. Cheng, Y. Guo, and Y. Zhang, A novel Hough transform based on elmnatng partcle swarm optmzaton and ts applcatons, Pattern Recognton, Vol. 4, Issue 9, 009, pp. 1959-1969. [3]. S. Shlaja, K. N. B. Murth, S. N. Nschth, R. Muthuraj, and S. Aja, Feed forward neural network based ee localzaton and recognton usng Hough transform, Internatonal Journal of Advanced Computer Scence and Applcatons, Vol., No. 3, 011, pp. 104-109. [4]. J. an, K. G. Hemantha, and H. Chethan, Skew correcton for Chnese character usng Hough transform, Internatonal Journal of Computer Applcatons, Vol., Issue, 011, pp. 33-36. [5]. W. C. L and D. M. sa, Defect nspecton n lowcontrast LCD mages usng Hough transform-based nonstatonar lne detecton, IEEE ransactons on Industral Informatcs, Vol. 7, Issue 1, 011, pp. 136-147. [6]. L. Xu, E. Oja, and P. Kultanen, A new curve detecton method: randomzed Hough transform (RH), Pattern Recognton Letters, Vol. 11, Issue 5, 1990, pp. 331-338. 658
[7]. E. Duqueno and A. aleb-ahmed, Applng the Hough transform pseudo-lneart propert to mprove computng speed, Pattern Recognton Letters, Vol. 7, Issue 16, 006, pp. 1893-1904. [8]. J. Song and M. R. Lu, A Hough transform based lne recognton method utlzng both parameter space and mage space, Pattern Recognton, Vol. 38, No. 4, 005, pp. 539-55. [9]. J. Kenned and R. C. Eberhart, Partcle swarm optmzaton, n Proceedngs of the IEEE Internatonal Conference on Neural Networks, Perth, WA, Vol. 4, 7 Nov 1995-01 Dec 1995, pp. 194-1948. 013 Coprght, Internatonal Frequenc Sensor Assocaton (IFSA). All rghts reserved. (http://www.sensorsportal.com) 659