TELKOM NIKA , Vol.12, No .3, Septembe r 2014, pp. 6 83~688   ISSN: 1693-6 930,  accredited  A  by DIKTI, De cree No: 58/DIK T I/Kep/2013   DOI :  10.12928/TELKOMNIKA.v12i3.108    683      Re cei v ed  Jan uary 29, 201 4 ;  Revi sed Ma y 26, 201 4; Accepted  Jun e  10, 2014   Resear ch on Keyhole Diameter’s Vision  Measur e ment Based on Parallel Technology      Zhang Chua n-chu a n, Ze ng Zhi-qiang , Wang Jun - y u an, Du We n-hua    North Univ ersi t y  of Chi na    Schoo l of Mechan ical a nd Po w e r Eng i ne eri n Xu e y u an R d .3,  T a i y u an, 03 00 51 Ch ina   e-mail: zhcc 22 060 06 0@1 63.c o     A b st r a ct    A keyh ole  di a m eter  of the c a rtridg e me a s ure m e n t bas e d  on  mach ine  vision  is a  par t of the   cartridg e s g e o metry measu r ement syste m , accor d in to the system requir e me nts, to complete  the   me asur e m ent  w i thin 5 seco nds.   A Image  Collecti on Sy stem w a con s tructed usin g  comp uter, CCD  camera,  LED s ource,  meanw hile  a  meas ure m e n t syste m  w a s co mpil ed  by  C#  on  VS20 1 0 pl atfor m  b a s e d   on  mac h in e vi sion. Use t he  Otsu algor ith m  to extracts  the keyhol e edg e an d ne ar the  pixels  in or der  to   reduc e the c o mp utatio nal  C anny  op er ator,  and  use p a ra l l el co mputi ng i n  the C anny  o perator to  i m pr ove  computi ng sp e ed p u rpos es. Use Quer yPerf o rmanc eCo unt er timer for eac h modu le ti mi n g  Can n y op era t or,  Can n y op erato r  impr ove d  co mp utatio n time  is reduc ed fr om th e ori g in al 6s to n earl y  a hun dre d  ms   improve d . Mee t  the time req u ire m e n ts of c a rtri dg e ge o m etry me asur e m e n t syste m , and  other  mac h in e   vision i n  w h ich  the proj ect can  be w i dely use d   Ke y w ords ma chin e visio n ; trigger key hol e d e tection; e dge  detectio n ; sub- pixel; thres hol d  calcul ation       1.   Introduc tion   The ann ual output of so me type cart ridge  rea c he d more than  one million, but the  diamete r  of t h is type  ca rtridge  keyhol e  is o n ly  1m m, Produ ctio n processe can’t  com p let e ly  guarantee  th e quality of t he  keyhole   machi n ing.  when the  keyh ole tole ran c e ,  likely to  ca use  cart ridge launch fail ure, so the military require  the  production units to  accurately measure the  keyhol e dia m eter  for ea ch  ca rtridg e to  ensure  the  o v erall q uality of the cartri d ge. Acco rdin g to   the ch ara c te ristics of the  measurement  obje c t,  the propo se d met hod u s ing th e machine vi sion   measurement . Firstly sh oo ting Partial i m age of th keyhol e an pro c e ssi ng th is imag e, the n   Cal c ulating  t he di amete r   of the  keyhol e, finally  co mpari ng  with  the tole ran c e of the  dia m eter  values a nd d e termini ng whether  com p li ance with the  requi reme nts.  In orde r to improve the  accuracy an d pr e c isi on  of the measurem ent, usi ng ca nny  operator  edg e dete c tion  algorith m  to detect  cart rid ge keyhole  edge  point a r e u s ed  wh e n   pro c e ssi ng t h is i m age  [1 ]. Canny  op erato r  at  th e  sa me time   improve  the  accuracy  of  the  comp uter  ha s in cre a sed  the amou nt of comp ut ation. Un der th e co ndition s of the exist i ng   laboratory e q u ipment, run n ing time  of  Gau ssi an f ilter i s  67.2 8   ms, ed ge  co ntour  extracti on is  5719.2 3 ms i n  Ca nny o p e r ator. So  the  whol e time   of Can n y op erato r  is 57 8 6 .61ms,  ca rtridge  measurement   syste m  can’t meet  t he tim e  req u irement s. Therefore,   in orde r to im prove  dete c tion   efficien cy, a  method  of u s i ng Ot su  op erator  edg e co arse po sitioni ng  to   re du ce the  comp utation   [2] and  parall e l processin g  tech nolo g y i s  p r op osed  t o   ma ke su re   the system  perfo rman ce  to   meet the actu al requi rem e n t s.      2. The main parame ters  of the  CCD c a mera and c o mputer   The m a in fl ows of m e asu r ing  sy stem a r e im a ge a c q u isitio n, image  a nalysi s measurement , and output s the result. To achi eve  high-sp eed  measurement  of the keyh ole   diamete r  m u st be  in  full  knowl edge  of  the si ze  of th e CCD  cam e ra to  captu r e  imag es of t he  situation fully hard w a r e p e rforman c e of your comp uter.  The hardware consist s  of an optical  illu mination system, CCD cam e ra, computer  hardware and related  auxiliary equi pment  el em ents. A c cording to the  keyhol e imaging  requi rem ents and th e de si gn of the  me asu r ing  sy ste m , Adjust the  colle cted  im age, the im a ge  pixel si ze  of  512  × 512,  while the  cam e ra' s  S N R i s   40dB.  Comp uter i s   usi ng  AMD A8 -45 0 0 M   Evaluation Warning : The document was created with Spire.PDF for Python.
                          ISSN: 16 93-6 9 30   TELKOM NIKA   Vol. 12, No. 3, September 20 14:  68 3 – 688   684 quad -core p r oce s sor,  Wi n dows  o p e r ating  system.  Image  Mea s urem ent Syst em p r og ram   is   written  i n  C #  un der  the VS2010 platform.  Imag e acq u isitio sy stem schem a t ics and   keyh ole  origin al imag e are sho w n i n  Figure 1 an d Figure 2.                          Figure 1. image a c qui sitio n  system  sch e matics                      Figu re  2. keyhole o r i g inal imag e       3.  C# Parallel Computing   Emerge nce o f  parallel  com puting i s  th e i nevit able  re sult of the  dev elopme n t of  compute r   s c i e n c e , is  th e   s a me pr oc es s us in g a va r i e t of  computing  resource s to  so lve com putin probl em s.  Un der  the pre m i s e of simulta neou s,  the   p r oce s can  be  cal c ul ated i n to sm all p a rts, to   solve comp utational p r obl ems in  Con c urrent way.   This i s  an ef fective mean s to improve  the  comp uter sy stem calculate s  the   spe ed  and  processi ng p o wer.  Th e ba si c id ea  i s  to  u s multi p le   pro c e s sors t o  solve the  same  proble m  coll abo rati ve, that the  probl em i s  b r oken  do wn  into  several pa rts,  each p a rt by a sep a rate p r oce s sor to pa rallel comp uting.  With the ra pi d developm e n t of comput er ha rd ware  , image pro c essing o n  m u lticore   pro c e s sors h a s al rea d y become a f a ct of  existi ng, but the  traditional im age p r o c e ssi ng  prog ram m ing  mode m u st  b e  co mpatible   with the n e hard w a r env ironm ent to  make  the ima g e   pro c e ssi ng  speed to  achie v e the be st a pplication results [3]. C# i s  integrated T P L (Ta s k Parallel   Library) and PLINQ (Paral lel  LINQ ), parallelized appli c ations  can  be  achieved, whi c h will  greatly  enha nce the spe ed of the appli c ation is  runni ng.   Static cla s named  syste m . Threading. Parallel  provides thre e i m porta nt wa ys  Fo r Fore ach  and  I n vo ke  lo cated two n a m esp a ces  which a r e n a m ed  System .Threa ding  an d   System .Thre ading.Ta sks     3.1 Guas s filter par a llel computing   Gau ssi an filter is a linea r filtering, the value  of each pixel, both by  itself and the other  pixel values  throu gh the n e ighb orh ood  to get a  weig hted avera g e  [4]. The main feature is t he  Gaussi an function i s   still a Gaussian function  after F ourier transform, so th application of fast  Fouri e t r an sf orm ca p u t convol ution o f   airspa ce  t r a n sformed  int o  the  pro d u c t operation s   o f   freque ncy do main,  which greatly red u ces  th e comp u t ation time. In  pra c tical a p p lication, th e t w o- dimen s ion a Gau ssi an fu n c tion  G(x, y)  is d e compo s ed into  on e-d i mensi onal  G aussia n  fun c t i on   G(x)a nd G ( y)i n  the x directi on and y dire ction for ima g e  filtering:      ) 2 ex p( 2 1 ) , ( 2 2 2  y x y x G                                (1)     22 () 1 2 e x p ( 2 ) Gx x                                       (2)     22 ( ) 1 2 e xp( 2 ) Gy y                                       (3)    Image acqui sition  H o od  Tested part s     Bas e   Adjustabl e ba ckli ght   Evaluation Warning : The document was created with Spire.PDF for Python.
TELKOM NIKA   ISSN:  1693-6 9 30       Re sea r ch on  Keyhol e Dia m ater's Visio n  Measurem ent Based on  …. (Zhan g  Chuan - Chua n)  685 In actual prog rammin g , method of  Forea c h  an d metho d  of   Partitioner.Create   whi c h are in stati c   cla ss n a med  System .Thre ading.Pa rallel  is com b ined  for parallel co mputing of al gorithm   [5].   Whe n  the  ho rizo ntal filteri ng, two - dim e nsio nal  array  of ima g e s  i s  autom aticall y  divided  into several  small two - dime nsi onal  array  by Parallel.ForEach (Pa r titioner. C reate  (0,  BmpData. Hei ght), (H) => { } ).The lo op of  each  sma ll t w o-dimensional array in  h e ight directio n is  for (j = H.Item1; j <H.Item2;   j + +), in width direc t ion is   for (i  = 0; i  < B mpData. W idt h ; i + +).  When  the vertical filtering, two-di mensi onal  array of  image is auto m atica lly divided int o  seve ral  sm all  two-di men s io nal array by  Parallel.Fo rE ach (Pa r ti tion er.Create (0, BmpData. Wi dth), (H) => {}).   The loop of eac h   s m all two-dimens ional array in  widt h direc t ion is   for (i  =   W.Item1; i<   W.Item2;   i++), in  heig h t  dire ction  is for  (j= 0; j <  B m pData.  Hei ght; j++).  The  filtering  state m ent of  a p o i n on the image  is temp +  = grayValues  [i  * length1  + rem ]  * filter [k + radiu s ].      3.2 Parallel computing of  edge con t ou r extra ction   The e dge  co n t our extra c tio n  procedu re i s  a  se rial o p e r ation  before  multi-core  co mputers  appe are d . Wi th the advent  of multi-core  techn o logy, the metho d  of   Parallel. Invoke  i n  C #  pu t a  picture into  fo ur p a rt s to th e ed ge  conto u r extractio n   [6]. Method  of  P a rall el. I n vo ke  i s  th e ea si est   way to parall e lize the  seri al cod e Parallel.Invoke  pu t a cartrid ge  keyhol e ca pture o r igin al imag e   is divided into  four se ction s  for paral l e l proce s sing a s  shown in Figu re 3.          Figure 3.  parallel pro c e s si ng image  seg m entation       4. Threshold  segmentati on and edg e  detec t ion   For  pixel  si ze  of 5 12  ×  5 12 im age  fire -hole  of th cartrid ge,  whi c h is only  a fe w p o ints  arou nd the  e dge p o int an d the ed ge contour  of edg e point s  nee d to be p r o c e s sed. Setting  two   con c e n tric ci rcle s with  the  outline,  on e slightly large r  t han the  cont our  edg es,  sli g htly more  th an   one  contou edge. As  sh o w n in Fi gure  4, only the pi xels within th e red  circle  o n ly have the  edge   conto u r featu r e is the obj e c t sho u ld be  extracted.           Figure 4.  position of the edge to be pro c essed   Evaluation Warning : The document was created with Spire.PDF for Python.
                          ISSN: 16 93-6 9 30   TELKOM NIKA   Vol. 12, No. 3, September 20 14:  68 3 – 688   686 4.1 Impro v e d Otsu thres hold calculation  Adding Ot su  algorith m  after Ga ussian  filter  in Cann y operato r  ca n achi eve au tomatic  threshold  cal c ulatio n, this method is   rel a tively simple  and fast[7,8].  The  ba sic ca lculatio n met hod i s : the  g r ay rang e [ L m in, Lm ax ] o f  the ima g e,  the g r ay  value of the pixel is divid ed into two categori e C 1   and  C2  in accordan ce  with the thre sh old   value  T C1  i s   con s i s ted  b y  the pixel  which  the  gray  ran g e i s  [ Lm in, T ],  C2   i s  con s i s ted by the   pixel which th e gray rang is [ T +1, Lm ax ], by the fo rmula  (4) cl asse squ a re  e r ror bet wee n  t w types of cal c u l ations.     )] ( ) ( )[ ( ) ( 2 1 2 1 2 t t t t                                    (4)    In the formula  (4),  1 ( t ) is the  numbe r of pixels of  C 1 2 ( t ) is the num b er of pixels of   C 1 1 ( t )   is the averag e gray va lue  of the pixels  of  C 1 2 ( t )   is the avera ge  gray value of  the pixels of   C 2 . Cal c ulati ng the  opti m al thre sh ol d at the  sa me time o b taining  an im age of th same   maximum pixel value.  Achieving Ot su algo rithm  in C #, fin d ing the mi nimum pixel  values  L mi n   and the  maximum pix e l values  L ma x   by cycle  com pari s on  , a nd  then  cal c ulati ng the  optim a l thre shol T  of  the image. th e gray’ s  ra ng e of the edg e   point and  ne ar is i n  the in terval [ T, L ma x ], at the sam e   time recordi n g positio n of these pixels.   Extracting the  image e dge  points  and te n point s gr adi e nt dire ction  near th e pixel  values  of the pixel s  t h rou gh  a p r o g ram. A s   sh o w n i n  Ta ble  1 ,  the g r adie n t is th e bi gge s t whe n  the  g r ay  value of the pixel is 204,  so this p o int is dete r mine d  as an ed ge  point. Optima l threshold of  the   image is 1 29.  As sho w n in  Figure 5, the  intermediat e  circula r  part  is extracte d e d ge point s and   near.       Table 1. Gray and gra d ient  near the e d g e  of  a ten-poi n t and point-p ixel gradie n t dire ction   Gra y   55  64  73  91  109  154 204 252  254 254  Gradient   18 18  45 50 48          Figure 5.  improved Ot su o perato r  Figu re      4.2 Edge Extraction   Origin al im ag e contain s   a t o tal of 2 62,14 4 pi xel s , the i m prove d  Ot su op erato r   extracting   the numbe of pixels and  near a r e ab out 2560.  Used by the edge contou r extraction p o i nt  decrea s e d  from 262,14 4 to 2,560. Thi s  can g r eatly  increa se the e dge contou extraction  sp eed.  Therefore,  when u s ing th e  C # lan gua g e , don’t ne ed   to traverse e a ch  pixel of the whole im a ge,  only need to  cal c ulate  Otsu o perator  extracted  pi xels. Figu re  6  is imp r oved  arou nd the  e dge   conto u r extra c tion compa r i s on  cha r t, it can be  seen from Figure extractio n  is no  different.   Evaluation Warning : The document was created with Spire.PDF for Python.
TELKOM NIKA   ISSN:  1693-6 9 30       Re sea r ch on  Keyhol e Dia m ater's Visio n  Measurem ent Based on  …. (Zhan g  Chuan - Chua n)  687                 (a) T he effect  of no improv ed Ca nny                          (b) The effect of improved Ca nny   Figure 6. improved Canny   operator b e fo re and afte r the treatme nt effect com p arison  cha r     5. Measurem e nt res u lts a nd analy s is   Usi ng a  timer  whi c h  the lo west ide n tified is 1m s in  C#  name d   QueryPe r form anceCount er  re co rd the  time of improved Can n y operator befo r e and after  each  module. And  for the evalua tion of the performa n ce  of parall e l com p uting, includi n g  spe e dup a n d   effic i enc y Speedu p is  defined a s : if the executio n time  of an algorithm e x ecution time  of th e   optimal serial  algorithm i s   T s , parallel al gorithm s is  T p , the ratio of parallel  sp e edup al gorith S = T s / T p   [9].  Parallel effici ency is defin ed as:  If a speed up of parallel al gorit hm is  S , parallel   executio n thread s of node s is  N , the parallel efficiency is  S p = S/N [10].    (a)  Re cord the  ti me of t w kin d of G a u ssi an filt er op erations which  use  technol o g y of pa rall el  comp uting an d don’t use techn o logy of p a rallel  co m p u t ing, the resul t s are  sho w in Table 2.       Table 2 the time of Gau ssi an f ilter impro v ed and unim p roved  (ms)  Gaussian filter  unimproved   improved  time 67.28   16.45       (b)  Re cord th e ti me of th re kinds of  edge   conto u r extra c tion  algo rith m, incl uding   unimp r oved  algorith m , th reshold  seg m entation  al gorithm  only  and  the  al gorithm s th a t  thre shol d   segm entation  and p a rallel  comp uting a r e usi ng at th e sa me time.  The  re sults  are  sh own  in   Table 3.       Table 3 the time of edge e x traction imp r oved and u n i m prove d  (m s)  edge extraction   unimprove d  threshold  segme ntation  threshold segme ntation  and parallel computing  time 5719.23   645.26   145.47       By experimen tal data in Table 2 and Ta b l e 3 Comp ari s on follo wing  con c lu sio n s:   (a)    The time of Gau ssi an filter red u ce from   67.28ms to  16.45m s  by improve d . By  analyzi ng the   time of techn o logy whi c only take th re shol d se gme n tation and t he time of techn o logy bot h   take threshol d se gmentati on and  parall e l com puti ng,  the time of parallel te ch no logy dro ppe from 645.2 6   ms to14 5.47 msTh e speed up of Gau s si an filtering a n d  edge  extraction is 4, and   then the paral lel efficien cy of Gaussia n  filtering an d ed ge extractio n  is 1.  Evaluation Warning : The document was created with Spire.PDF for Python.
                          ISSN: 16 93-6 930   TELKOM NIKA   Vol. 12, No. 3, September 20 14:  68 3 – 688   688 (b)  The time of edge contou r e x traction, whi c h th re sh old  segm entation  firstly, decre ase fro m  the   origin al 57 19. 23ms to 64 5.26ms. F a ll ti me of this  m e thod d epe n d s o n  the m a gnitude  of the   numbe r of poi nts nea r the e dge of the ed ge and thresh old se gmenta t ion extracted .   (c)  Thro ugh im proving Ca nny  algorith m , co mputing  time  from the o r i g inal 57 86.61 ms redu ced   to 161.92m s.      6. Conclusio n   Usi ng imp r ov ed Otsu  algo rithm extra c t ke yhole’ s e dge poi nts a nd nea r, ca n  greatly  redu ce   the a m ount  of co m putation Can n ope rato r.  On the  ba si of multi-core t e ch nolo g y, using  parall e l te chn o logy on  Ga ussian  filterin g an d c ontou r extra c tion  a l gorithm  in  Canny o perato r signifi cantly redu ced  the ti me  Canny  op erato r   ima g e   pro c e ssi ng to  improve the   operating  sp e ed.  Make full  use of Can n y o perato r  ed ge  extrac tion  a c cura cy adva n tage s whil e  overcoming  the  disa dvantag e s  of  Ca nny o perato r   co nsumes a l ong   time. The  im proved  Cann y operator m eet  time requi rem ents of the m easure m ent system.      Ackn o w l e dg ment  This p ape suppo rted by  the Gra dua te  Innovation  Program of  Shanxi (2 0 1330 95),  Shanxi Provi n ce S c ien c Found ation 2013 0110 25 -1 , th e  Sp ecia liz ed  Re s ear c h  F u nd  fo r   th e   Do ctoral Prog ram of Hig her E ducation of  Chin a (20 131 4201 2000 2)      Referen ces   [1]  John C a n n y . A  computatio n a ppro a ch to ed ge detecti on.  IEEE Trans Patten Analysis a nd Machin Intelli genc e.  19 86; 8(11): 6 79-  697.   [2]  Xi an g y an g X, Enmin  S, Lia n gha J.  Ch aract e rist ic a nal ys is  of thresh old  b a sed  on Otsu c r iterion.  Acta  Electron ica Sin i ca.  200 9; 37(1 2 ): 2716- 27 19.   [3]  Bele an B, Bor da M, LeGa l   B, et al.  F P GA techno logy  and  para lle l c o mputi ng tow a rds auto m atic   micr oarray i m age pr ocess i n g T e lecommu nicati ons a n d  Signa l Proc essin g  (T SP), 2011  34t h   Internatio na l C onfere n ce  o n  IEEE. 2011: 60 7-61 0.  [4]  W ang W en- yu an. Sel e cting t he Optimal Ga ussi a n  F ilterin g Scale v i a th e SNR of Ima ge.  Jour nal o f   Electronics & Informa tio n  T e chno logy.  2 009; 10: 248 3-2 487.   [5]  Bing jin g M, Bo  X,  Xi aome i  C,  et al.  Par a ll el  Co mp uting  Re nder ing  In Sp e c ific Re mote S ensi ng I m a g e   Processi ng . Proc. of SPIE. 7850: 785 02 8-1.   [6]  Praja pati HB,  Vij SK.  Analytic al study of p a r a lle a nd d i strib u ted i m age  pro c essin g . Image Information  Processi ng (IC IIP), 2011 Internatio nal  C onfer ence o n  IEEE. 201 1: 1-6.  [7]  Kumar S, Pant M, Ray  A.  Differenti a l ev oluti on e m bed ded Otsu' s method for o p ti mi z e d i m ag e   thresho l di ng . Informatio n  an d  Commun i cati o n  T e chnol o g i e s (WIC T ) , 2011 World C o n g r e ss on IEEE.  201 1: 325- 329.   [8]  XU  Xi an g- ya n g , Song En-m i n , Jin Lia ng- h a i. Char acteris t ic Anal ysis of   T h reshol d Ba sed on Otsu  Criterio n.  Acta Electron ica Sin i ca . 200 9;12: 2 716- 271 9.   [9]  T ang S, Lee B S, He B.  Spee du p for Multi-L e vel Par a llel C o mp uting .   Paralle l and  Distribute d   Processi ng S y mposi u m Workshops &  PhD  Forum (IPDPS W), 2012 IEE E  26th Inter n a t iona l IEEE.   201 2: 537- 546.   [10]  Hao  Xia o - y u n , F an Yu-mei. Ho w  to De monstrate Par a lle l Efficienc w i th Pictur e.  Comput e r   Engi neer in g an d Appl icatio ns . 200 3;19: 11 8-1 19+ 23 2.     Evaluation Warning : The document was created with Spire.PDF for Python.