TELKOM NIKA , Vol. 13, No. 4, Dece mb er 201 5, pp. 1319 ~1 329   ISSN: 1693-6 930,  accredited  A  by DIKTI, De cree No: 58/DIK T I/Kep/2013   DOI :  10.12928/TELKOMNIKA.v13i4.1899    1319      Re cei v ed Au gust 26, 20 15 ; Revi sed O c t ober 2 5 , 201 5; Acce pted  No vem ber 1 3 ,  2015   A Neighbor-finding Algorithm Involving the Application  of SNAM in Binary-Image Representation      Jie He 1 , Hui Guo 1 , Defa Hu* 2   1 School of Infor m ation a nd El e c tronic Eng i ne erin g,  W u zhou  Univers i t y , W u zhou 5 4 3 002,  Guang xi, Chin 2 School of Co mputer an d Informatio n  Engi n eeri ng,  Hun an  Univers i t y   of Commerce, Ch a ngsh a  41 020 5,   Hun an, Chi n a   *Corres p o ndi n g  author, e-ma i l : hdf666 @1 63. com      A b st r a ct   In view  of the low  executio n  efficiency a n d  poor  practic a bility of the ex isting n e ig hb or -findi ng   meth od,  a fast  ne igh bor-fi ndi ng  alg o rith m is  put forw ard  o n  the  b a sis  of  Squar e N on-sy mmetry  an d A n ti- packi ng M o d e (SNAM) for b i n a ry-i mag e . F i rs t of al l, the  i m p r oved  min o r-di ago nal  sca nni n g  w a y is  ap pli e d   to strength en  SNAM s  a dapt abil i ty to vari o u s textur es, th us red u cin g  th e total n u m b e r  of nod es aft e codi ng; then th e storag e struc t ures  for its su b-patterns  are  standar di z e d  a nd a gr id arr a is used to r e co ver  the sp atial- pos ition r e lati ons h i ps a m on g su b-patterns,  s o  as to furth e r  reduc e th e c o mpl e xity of t he  nei ghb or-fin din g   al gorith m . Experi m ental result  sh ow s that this  method s  ex ecu t ion effici ency  i s   signific antly h i g her than th at of the classic Li n ear Quad T r ee  (LQT )-based n e ig hbor-fi ndi ng  meth od.      Ke y w ords : Ne igh bor-F in din g ;  SNAM for Binary-Ima ge;  Min o r-Dia go nal Sc ann ing Mo de;  Grid Array      Copy right  ©  2015 Un ive r sita s Ah mad  Dah l an . All rig h t s r ese rved .       1. Introduc tion  As the basi s  of a variety of image operatio ns  su ch a s  the calcul ation of images’   geomet ric p r opertie s , the  labeling  of con n e c ted d o main s, ima ges’ e dge  d e tection, et c. [1],  neigh bor-findi ng algo rithm  can di re ctly affect t he execution effici e n cy  of these  operation s . The  expre ssive   method s a d opted i n  dig i tal image   a nd thei r a d j a ce nt definiti ons de cide   the   perfo rman ce  and spa c e-ti me com p lexity of neighbor  sea r ching al g o rithm. The o r iginal n e ighb or- finding al go rithm is execut ed in th e two - dime nsi onal  array of imag e, however,  due to th e la rge   stora ge  spa c e the two - di mensi onal  array occu pi e s   and the  wide  sea r ch sco p e involved in  the   pixel-pixel tra v ersal, the n e ighb or-findin g  algor ith m  b a se d on pixel  array ha s a n  unsatisfa ctory  efficien cy. The widely use d  Method s su ch as  q uadtree [2], linear quadtree [3] can redu ce b a si image  rep r e s entatio n uni ts, save th e  storage  sp ace  and  en able the  ra p i d “bl o ck-blo ck”  executio n of  image o p e r ation. Lite ra ture [4 -6] separately pu ts forward  neigh bor-findi ng   algorith m ba sed  on the  q uadtre e an d l i near  qua dtre e rep r e s e n tations,  whi c h h a ve sig n ifican tly  improve d  the  efficiency of  some ima g e  pro c e s sing  operations [ 7 -9]. Ho weve r, becau se the  neigh bor  rela tionshi p is n o t a one-to -o ne rel a tion sh ip, this kin d  of method cannot be  ea sily   perfo rmed i n  the actual  image o pera t ion. T herefo r e,  as ne w and  mo re si mplified  ima g e   expre ssive m e thod s emerge co nt inuou sly, people a r e still see k in g for highe r-e fficient neigh bor  sea r ching m e thods.    The metho d   of non-symm etry and anti - packin g   imag e rep r e s entat ion  achieves optimal  asymmet r ic i m age  segm e n tation so  as to obtain a  h i gher  efficien cy of rep r e s e n tation than t hat  of the quadt ree metho d  [10], and de rives a  se ries   of high-efficient  image p r o c e ssi ng alg o rith ms  [11-14]. Lite rature [15] p r opo se s a bi n a ry im ag re pre s entatio n method whi c uses sq ua re,  isolate d  poi nt, line segme n t  as the  ba sic rep r e s entati on unit s  in th e NAM m e th od. With  reg u l ar  sha pe an d si mple structu r e, these ba si c re pre s e n tation units  can  serve a s  ex celle nt basi s   for  further devel o p ing  other im age  pro c e s si ng al gorith m s. Ho wever,  th ere  rem a in  so me defi c ien c i e with this met hod, restri cti ng its  su ppo rtive ab ility for othe r ima g e  processing  pro c e dures:  Its   raste r   scanni ng mea n s i s  pron e to produ cing  m o re  su b-schem es when performing reverse   arrang ement  in image with rich ma ssive text ures; th e se parate st andal one storage stru cture   of  the three sub - sche me s also increa se s the algo ri thm’ s sp ace-time  compl e xity. Besid e s, altho ugh  the coordinat es  of the  sub - schem e s   hav e bee re corded, the r e i s   a la ck  of de scription  abo ut the  Evaluation Warning : The document was created with Spire.PDF for Python.
                             ISSN: 16 93-6 930   TELKOM NIKA  Vol. 13, No . 4, Decem b e r  2015 :  131 9 – 1329   1320 relation  of sp atial po sition  among th em,  whi c h typica lly entails trav ersal ove r  all  stora ge q ueu es  in the derivati v e algorithm.    Since the efficien cy of neighbo r se arch ing  algo rithm  depend s directly on the relative   positio nal  rel a tion b e twe e n  an d q uantit y of ba sic re pre s entative   units,  solutio n s to  the  ab ove   probl em s are  the key to  high-efficient  neigh bor  se arching  on S N AM. The  a u thor  begin s  by  utilizing the  structu r al cha r acteri stic  of squar e to incl ude sub-scan ning alo ng th e back-diag o nal   dire ction in raster  scanni n g  and en han ce the ad apt ability of reverse arran g e m ent to massive  textures; an d then uses a  same data  structure to  re cord three different  sub - sch e mes  so that  the  stora ge and  operating mo de can   be   u n iforme a c ross different  sub - sch e me s; next the a u t hor  con s tru c t s  gri d  matrix, an  interme d iate  stru ctur e, to  resto r e th e p o sition al rel a tion am ong th e   sub - sch e me s and redu ce t he sea r chin g  range for ne ighbo r. Thro u gh the above  measu r e s , the   neigh bor  sea r chin g is imple m ented on th e result of SNAM codin g , and com p a r ed  experim entall y   with the LQT - based nei ghb or se archi ng  method to  de monst r ate the  efficacy of this wo rk.        2. SNAM fo r Binar y -Image and Its Op timization     2.1. Square NAM -Bas ed Repr esen ta tion Metho d  o f  Binary  Ima g e   The imag e e x pressive me thod of tran sform dom ain  usually ha s highe r com p re ssi on   ratio than me thods of sp atial domain [1 6], but t he latter can reserve the image’s origi nal local   textural  cha r acteri stics an d po sition al relation  m o re  effectively. SNAM for bi nary-im age  i s  a   nond estructiv e  re presentat ion meth od,  whi c i s   based o n  the  sp ace  dom ain  and  uses three  types of su b-patte rn s - squ a re, lin e se gment  and i s olated  point - a s  the ba sic i m age   rep r e s entatio n unit. Its proce s s is  as  follows:  sq ua re, line  se g m ent an d isolated p o ints at  different scales  a r e extracted  in  a ra ster sc an mo d e  from a  pa cked  bina ry image th rou g h  the   anti-pa cking  algorith m , an d corre s p ond ing paramet e r s of the s e sub-p a ttern s a r e re co rde d  and   store d , thus f o rmin g the re pre s entat io n of the given binary imag e.   Figure 1   sho w s the  re sult  of a n ti-pa cking, codin g   and  sto r ing   a bin a ry i m a ge  with  SNAM. Figu re 1(a) i s  the  given ori g inal  bina ry imag T  with  size of 2 n ×2 n   ( =3). Fi gu re 1 ( b )   sho w s the re sult of SNAM  anti-pa cki ng  in t he rast er scan mo de. Six square su b-pattern s (s 1 , s 2 s 3 , s 4 , s 5  and  s 6 ), two line segm ents  ( l and   l 2 ) an d two isolated p o ints ( p an d  p 2 ) are extra c ted  from the  ori g i nal ima ge. Fi gure  1 ( c) i s  t he rep r esent ation of  T  by  usi ng the  a bove-m ention e d   sub - pat t e rn s.          (a) An 8 × 8 bi nary imag T     (b)   Th e SNA M  anti-pa ckin g T ={ s 1,  s 2,  s 3,  s 4,  s 5,  s 6,  l 1   , l 2,  p 1,  p 2 (c )   T he result  of of  T   Figure 1. The  process of a n ti-pa cki ng a  binary ima ge  with SNAM       Acco rdi ng to   SNAM, the it ems nee d to  be recorded   are: fo squ a re, the  coo r di nates  sp   of the upp er  left vertex (i.e., the  startin g  point)  and  the sid e  leng th  side ; for line segment, the  c o or d i na te s   p 1  of the starti ng poi nt and  the co ordi nat es  p of the  end p o int; for isolate d  poin t,  only the coordinate s  of th e vertex. The  stora ge  st r u c t u r es  for  a ll  s u b- p a tter n s   a r e  as   s h ow n in   Figure 2.  Evaluation Warning : The document was created with Spire.PDF for Python.
TELKOM NIKA   ISSN:  1693-6 930     A Neighb or-finding Algo rith m  Involving the  Applicatio n of SNAM in Binary-im ag e …   (Defa Hu 1321 sp   side     p 1   p 2     i_ p   (a) squ a re    (b)  lin e     (c) isol ated p o int     Figure 2. The  process of a n ti-pa cki ng a  binary ima ge  with SNAM       SNAM can al so b r in g som e  problem s f o r ima ge p r o c e ssi ng. Lite rature [1 7] not es that  the ra ster  scan mod e  ha s a good p e rf orma nce towa rd ima g e s  with unobviou s  blocky features,   but sho w s lo w efficien cy towa rd ima g e s  with obvio u s  blo cky featu r es. In ad ditio n , the diversit y o f   SNAM’s sto r a ge stru ctures for  th ree type s of  sub - p a tterns an d its ori g inal a n ti-p acking  algo rith m   lead to the  e m erg e n c e of  both ho rizont al and ve rt ica l  line segme n t s in the  codi ng re sult, furt her  increa sing th e compl e xity  of sub s eq uen t image pro c e ssi ng.     2.2. Optimization of the  Scanning M ode   Ra ster sca n  is ch ara c te rized by the line-by -li ne ho ri zontal  scan, and a combi nation of   raste r   scan a nd blo ck  sca n  will produ ce a strong er  adapta b ility to image s wit h  blocky texture.   The ho rizont al dire ction i s  still the mai n  scanni ng di rectio n, but  whe n  unm arked bla ck  poin t  is   detecte d, the  stru ctu r al  ch ara c teri stics  of sq uare a r e  used  and  de terminin g the  pixel value s   of   pixels on th e mino r-di a g onal i s  re garded a s  the  core alg o rith m - thu s  th e mino r-di a g onal   scanni ng mo de is fo rme d . Its prin cipl e i s  sho w n in  Fi gure  3. The r e i n, Figure 3 ( a )  is th e dia g ram  of the minor-diago nal sca nning di re ctio n, whe r e t he  dotted line in dicate s that a fter these p o i n ts   form a  squa re, they need n’t go thro ug h hori z o n ta l scan  any more. Figure 3(b) sho w s the seria l   numbe rs of al l pixels in the  minor-dia gon al sc anni ng p r ocess. Thi s   mode n o t onl y has a st ron ger  adapta b ility,  but only lowers th e com p lexity of  SNAM by onl y produ cing  hori z ontal li ne   segm ents.         (a)  Dire ction f o r mino r-diag onal sca n   (b) Pixel se qu ence in mino r-diag onal  sca n                         Figure 3. Prin ciple of mino r-diag onal  sca n       The spe c ific  pro c ed ure of the SNAM a l gorithm b a sed on min o r-diago nal sca n  (Mino r   Diag onal -SNAM, or MD-S NAM) is  as fo llows:   Input:  a bi nary image  T  with a s i ze of  n × n.    Outpu t :   V_s —the set of  squa re sub - patterns,  V_l —the set of  line segm e n t sub- patterns ,   V_p —the set of isolated poi nt sub-p a ttern s.   Step 1   Sea r ch fo r the  un marked  point  with  ze ro pix e l value  by st arting f r om th e pixel   f i rst  see n  wh en  a c ce ssi ng   T  in  this ci rcle, and  u s e t he fou nd  pixel a s  the  up p e r ve rtex of t he  squ a re  sub-p a ttern, then  reco rd it s coo r dinate s  ( sp _x sp_ y ), a nd i n itialize th side len g th of t he  s q ua r e  s u b- pa tte r n   w i th   side   Step 2  Se arch for u n ma rked pixel s  on  the ba ck  dia gonal  of the  squ a re  with  side - l on side s, and ju dge whethe r their pixel valu es are 0:  if they are not 0, swit ch to Step 1.   Evaluation Warning : The document was created with Spire.PDF for Python.
                             ISSN: 16 93-6 930   TELKOM NIKA  Vol. 13, No . 4, Decem b e r  2015 :  131 9 – 1329   1322 Step 3  Make  side = s ide + 1,  and  contin u e  to pe rform  Step 2 until  no mo re  squ a re  su b- pattern forms; store the fo und squa re in   V_s , and ma rk all the pixe ls cove red  by the squa re  with  side -lon g sid e s.   Step 4  Rotate Steps 1 ~ until no ne w square  su b-pa tterns  can be  extracted o u t.   Step 5  S earch for the  un marked  point  with  zero pi xel value by  starting  from  the pixel   first se en wh en acce ssing  T  in this circle , and re cord its co ordi nate s  ( l _ x 1 l_y 1 ).   Step 6   Ju dg e wh ethe r th e value of th e neig hbo rin g  pixel at the  hori z o n tal ri ght sid e  of   the point  ( l _ x 1 , l_y 2 ) i s   ze ro: if it is, cont inue the  sea r ch to wa rd th e  hori z o n tal ri g h t sid e  until t h e   line segm ent  stop s enl argi ng, t hen re co rd  the   line se gment’s  rig h t endp oint’s co ordin a tes  ( l _ x 2 l_y 2 ), a nd  sto r e the  line i n   V_l , and the n  mark all  the  pixels that it   covers; if it is not zero, go  to  Step 5.   Step 7   Rota te Step 5 a nd Step 6 u n til no ne w l i ne segme n t sub - patte rn s can  be  extracted o u t.   Step 8  S earch for the  un marked  point  with  zero pi xel value by  starting  from  the pixel   first seen  wh en a c cessin g   T  in this ci rcl e , and  re cord  its coordinat es  ( p _ x p_ y ); then sto r e it  in  V_p  and ma rk this poi nt.   Step 9  Rotate Step 9 until no ne w isol ated-p o int su b-pattern  can b e  extracted o u t.    Step 10  Output  V_s V_l  and  V_p .     2.3. Optimization of the  Storag e Stru cture   SNAM ha s d e sig ned  storage st ru cture s  se pa ra tely for three  different type s of basi c   rep r e s entatio n unit s , which, whil can   ensure   comp act storage, mean the  sa me  SNAM -ba s e d   image ope rati on  alg o rithm need to se p a rately  p r o c e ss differe nt  sub-p a ttern s. Therefore, using  the same  ki n d  of  simpl e  d a ta st ru cture   to re co rd  different  sub-pat terns i s  the  key to lo we rin g  the  compl e xity of  the sub s e que nt  image processing al gorit hm.   For the three  types of sub - patterns -  sq uar e, line  seg m ent and isol ated point - i n volved  in SNAM, a uniform sto r ag e stru cture ca n be define d  as follo ws:        x y  Length     Figure 4. The  uniform sto r a ge stru ctu r e for SNAM sub - patterns      Therein,  x  re pre s ent s the absci ssa of the st artin g  p o int of the su b-patte rn,  y  re p r es en ts  its ordi nate,  and  L ength   repre s e n ts th e su b-p a ttern ’s si de len g th . In the codi n g , the  Len gth  of  squ a re  and i s olate d  point  is stored a s  int data, whi l e the  Length  of line segm ent is sto r ed  as  st ring  data.  T hus the  su b-p a tterns  can  b e  di stingui she d  by the   Le ng th  value  and   data type: if t he  sub - patte rn is sq uare, its  Length  must be greater  than 1 and b e long to int data; if the sub- pattern i s  isol ated poi nt, which  ca n be  regarded  as  a  squ a re  with  a sid e  Le ngt h of 1, then i t s   Length  mu st be equ al to 1 and belon g to int data; and if the sub-p a ttern is line  segm ent, its sid e   length (i.e., its length )   L eng th  is al so g r eater tha n  1  but belon gs t o   st ing  data. In this  way,  a   uniform su b-pattern set can  be esta bl ishe to  r eal ize  rapid t r a v ersal, th us  providin g mo re  effective sup ports fo r vario u s imag e ope ration s.       3. Neighbor -Finding Bas e d on MD-SNAM     3.1. Definition of Neighbor  The  wo rd  “ne i ghbo r” i s   use d  for  depi ctin g the  adja c en t relation  amo ng ima ge  are a s th at   image  rep r e s entation u n its co rre sp ond  to, and it s def i n ition vari es  depe nding  on  spe c ific ima g e   rep r e s entatio n method s. Literature [18] has p r e s ente d  the definition of neighbo r in the quadtree  method, an d  con s id erin that both SNAM  and  the quadtree rep r esent ation method  exp r ess  image source  as the record set of local image bl o c ks, a similar def inition can b e  made herein :  if  there  exist s  a t  least  on e pi xel in  both  su b-patte rn s th at ma ke s the  two  adj oin  e a ch  othe wit h in   the 4-neig h b o r d o main, th ese  two  su b-pattern s a r neigh bors. T he ba si rep r ese n tation u n i ts in   SNAM a r sq uare, li ne  se gment a nd i s olated p o int.  Each i s ol ated  point i s  e s se ntially a squa re  Evaluation Warning : The document was created with Spire.PDF for Python.
TELKOM NIKA   ISSN:  1693-6 930     A Neighb or-finding Algo rith m  Involving the  Applicatio n of SNAM in Binary-im ag e …   (Defa Hu 1323 with the si de  length of 1, thus S N AM a c tually  involves only two types of  sub-pattern s, na mely,  squ a re a nd li ne se gment. The sp ecifi c  definition is a s  follows:   Defini tion 1  In the SNAM-ba s ed  bi nary ima ge  rep r e s entatio n, if  s j ={ x j , y j , Length j neigh bors   s i ={x i ,y i ,Length i }   in the direc t ion D=(EAST ,SOUTH,WEST,NORTH):    (1)  When  s i   is sq ua re an d   s j  is sq ua re, their neig hbo r relatio n ship  is sh own in F i gure 5   and follo ws th e followin g  formula:      i i j j i i i j Length y y Length y Length x x 1        (1)     i i j j i j i j Length y y Length y Length x x 1        (2)       (a)   Th e scop e  of  s i ’s  east nei ghb ors  (b)   Th e scop e  of  s i ’s  we st neigh bo rs  (c) The  scope  of  s i ’s  south n e igh b o rs  (d)   Th e scop e  of  s i ’s  north nei ghb o r   Figure 5. The  process of a n ti-pa cki ng a  binary ima ge  with SNAM       j i j i i j j i Length y y Length x x Length x 1        (3)     j i j i i j j i Length y y Length x x Length x 1        (4)     ( 2 ) When  s i  is squ a re  o r  point  a nd  s j   is lin seg m ent, their nei ghbo relatio n shi p  i s   sho w n in Fig u re 6 an d follows the follo wing formula:           (a)   Th e scop e  of  s i ’s  east nei ghb ors  (b)   Th e scop e  of  s i ’s  we st neigh bo rs  (c) The  scope  of  s i ’s  south n e igh b o rs  (d)   Th e scop e  of  s i ’s  north nei ghb o r   Figure 6. The  neighb or rela tionshi p between squa re  s i  and line seg m ent  s j     Evaluation Warning : The document was created with Spire.PDF for Python.
                             ISSN: 16 93-6 930   TELKOM NIKA  Vol. 13, No . 4, Decem b e r  2015 :  131 9 – 1329   1324   i i j i i i j Length y y y Length x x         ( 5 )     j i j i j i j Length y y y Length x x         ( 6 )     j i j i i j j i Length y y Length x x Length x 1       ( 7 )     1 1 i j i i j j i y y Length x x Length x       ( 8 )     ( 3 ) When  s i  i s  lin segm e n t and   s j  is square o r   poin t, their n e igh bor rel a tion sh ip follo ws  the followin g  formul a:    i j j i i i j y y Length y Length x x 1          (9)     i j j i j i j y y Length y Length x x 1          (10 )     j i j i i j j i Length y y Length x x Length x 1        (11 )     1 1 i j i i j j i y y Length x x Length x        (12 )      (4)  Wh en  s is li ne  se g m ent an s is li ne  se g m ent, be cau s e th e min o r-di ago nal  scanni ng m o de o n ly gen erates  hori z o n tal line s   whi c h  only h a ve  so uth an d n o rth  neig hbo rs, th eir  neigh bor  relat i onship follows the followi n g  formula:     1 1 i j i i j j i y y Length x x Length x        (13 )     1 1 i j i i j j i y y Length x x Length x        (14 )     3.2. Grid Arr a y   SNAM doe not involve the re co rdin g  of the  spati a l-po sition rel a tionship  wit h   cod e s,  thus  neigh bo r-findi ng b e comes an i n e fficient pr oce s s of repe ated defin itio n-based sea r ches  Evaluation Warning : The document was created with Spire.PDF for Python.
TELKOM NIKA   ISSN:  1693-6 930     A Neighb or-finding Algo rith m  Involving the  Applicatio n of SNAM in Binary-im ag e …   (Defa Hu 1325 throug hout the co de array. Therefore, the nei gh bor-findin g  process  can  be simplifie d  by  con s tru c ting   an inte rmedi ate structu r e  and  re st orin g the po sitio n  relatio n shi p s a m ong  sub- patterns .  A  n × n   matrix, namely grid matrix , c a n be  c o ns truc ted for  n × n  bina ry i m age. Ea ch   unit  is first a s sign ed with a val ue of 1; then  the  SNAM coding  re sult  of the image  is re ad, an d the   positio that each sub - patt e rn co rr espo nds to in th grid  matrix, th e structu r e  of  whi c h i s   sh o w n   in  Figure  7, is re-filled wi th  a value,  whi c h i s   equal to  “t he st orage serial   number for t he  corre s p ondin g  sub - p a ttern  + 2” be ca use the se rial n u mbe r  of the SNAM co de  array begin s  fro m   0 and also 1 has b een u s e d  for pre - fillin g; and then the SNAM co de and the filled value for e a ch   sub - patte rn  make  up  a  grid array,  with  the fille d  val ue a c ting  a s   the corre s po nding  index.  Thus  the only  step   for findin g  th e nei ghbo of som e  bl ock i s  to  scan  the  pixel value s   surro undi ng t h is  block  - if a  different valu e that is not  1 an dete c ted, the sub-pattern th at this in dex val u e   c o rres ponds  to in the grid  matrix is  t he neigh bor that  is bein g  se archin g for.           (a) SNA M -b a s ed  segm ent ation of an 8×8 image     (b) T he corre s po ndin g  grid  matrix     Figure 7. The  neighb or rela tionshi p between line  seg m ent  s an d line se gment  s j       Without th appli c ation  of the g r id m a trix  method,  neigh bor-findi ng  would  be  a very   time-con sumi ng pro c e s s of traversin g  the entire SNA M  code list to  make one -b y-one jud g me nt  as to  wheth e r th curre n tly acce sse d  SNAM   su b-patte rn  me ets the  cond ition for neig hbor  relations h ip. With grid matrix, the operation sc op e of  neigh bor-findi ng in  ce rtain dire ction ca n be   limited to the pixels on th e boun dary  block of  su b-pattern s, thu s  the ope rati on load  can  be  signifi cantly cut.    3.3. Grid Arr a y   After  the storage queu V  of the S N A M  algo rithm f o r bi na ry ima ge a s   well  a s  the  V- gene rated  gri d  matrix  M  an d  gr id  ar ra T  is give n, th e se arch fo r t he nei ghb or  R  of a  given  sub - pattern  r = ( x, y, Length ) wil l  becom e very easy. Take  the sea r ch for east nei ghb or for exampl e:  first of all, judge the sub-pattern type of  r  accordin g to its  Lengt h ; then determine wh ethe r  is  clo s e to  the  ri ght bo und ary  of the  ima ge  according  to t he a b sci s sa  x+Le ngth  of  r s  end point,  an if it is,  r ’s e a st neighb or  R  i s  an  empty set, otherwise  the value s  for the rig h t bou ndary of  r  su b- pattern  in th e  gri d  a r ray are ind e xes of  all its  neig h b o rs - then,  co mpare the m   with the  valu es  on  the rig h t bo u ndary  of the   grid  array o n e  by o ne,  a n d  ad d the s e   positio n-stora ge in dexe s  to  th e   neigh bor set  R  as l ong a s   there i s  no 1 - value index.  Becau s ea ch index in the  SNAM cod e   lis corre s p ond s t o  one  an d on ly sub - pattern , the indexe s   can  lead  to t he nei ghb orin g mod e ls. T h algorith m  pri n cipl es for  n e ighb or-findin g  in vari ou dire ction s  are  basi c ally the  same, thu s  the   east w ard  nei ghbo r-fin ding  is u s ed  he rei n  ag ain  as  a n  exam ple to  explain  the  specifi c  al gorit hm   executio n ste p s a s  follows:    Input:  gr id  ar r a T , the  gi ven coordina tes  ( x y ) of t he  starting  p o int of  sub - p a ttern  r image re sol u tion n, and code array  V={V_ s ,V_l,V_p} , where  V_s ,  V_l  and  V_p  re spe c tiv e ly   rep r e s ent the  code a r ray set for squ a re,  line segm ent  and isol ated  point.   Outpu t :  the  set  E_R  of sub - patterns of  r s  ea st neigh b o rs    Step 1  Custo m ize a  set  E_R  and initiali ze it to be empty.    Evaluation Warning : The document was created with Spire.PDF for Python.
                             ISSN: 16 93-6 930   TELKOM NIKA  Vol. 13, No . 4, Decem b e r  2015 :  131 9 – 1329   1326 Step 2  Inp u t  the given  co ordin a tes  ( x y ) of th e sta r ting point of  sub - patte rn  that is  use d  for   nei ghbo r-fin ding,  and match t he startin g  p o int’s coordin a tes with the  code a r ray to   prod uce the b a si c inform ation and  seri al numbe r (in d e x ) of sub-pattern  r .   Step 3   Use t he ba si c information of the  sub - patte rn  t o  judg e the b a si c type of it: if it is  squ a re  or i s ol ated-p o int, ju mp to Step 4;  if it is line se gment, whi c h  mean s it ha s no ea st o r  west  neigh bors, ju mp to Step 5.   Step 4  Via t he  coo r din a tes  ( x y )   of  r ’s   s t arting point, find  r s  right -mo s t e ndpoi nt  (x+len gth,y)  in the grid matrix  M . I f   is close to the rig h t bounda ry of the image, that is,  x+len g t h   is eq ual to n ,  then it doe s not h a ve e a st o r  we st  neigh bors, th us g o  to Ste p  5; othe rwi s e,  thorou ghly scan M for pixe l units lo cate d within the  area  ( x+le ngt h+ 1, y+ l engt h -1 ) on the  ri ght  side of the i m age’ ri ght boun dary, an d judge wh e t her its num erical value  (index ) m is 1   (re pre s e n ting  white  poi nt):  if it is not  1,  use  m  to  find  the  co rre sp o nding  sub-pat tern i n  the  gri d   array  T , and reco rd it in  E_R .   Step 5  O u tput th e   E_R .       4. Experiments and  Anal y s is  The expe rim ental enviro n m ent is mad e  up by  Intel Core i3 -31 1 0 M 2.4GHz p r ocesso r,  2G me mory,  Microsoft Win dows 7  Profe ssi onal  + SP 3 ope ratin g  system an d M A TLAB7.0-ba s e d   IDE. Figure 8  sho w eight  256 ×25 6  bina ry image s wi t h  different co mplexities to  be tested i n  the  experim ent. The definition  of image co m p lexity is as follows:   Defini tion 2  Compl e x i ty   C  of any  bin a ry image  can  be  define d  i n  the  followi ng  way:  cal c ulate,  ba sed o n  the  giv en im age  re p r esent ation  m e thod, the  tot a l nu mbe r  of  i t s no de N Q  as   well a s  the total pixel numb e N f , and p u t them in the formul a of:     C= Q N / f N            (15 )     In this pa pe r, the LQT   rep r e s entatio n method  is rega rd ed a s  a b e n c hm ark for  comp ari s o n , and  i m age  complexity  is measured  by the n u mb er  of LQ T  segm entation  blo c ks.  Table  1 i s  th e comp ari s on  of the  codin g  pe rfor man c es  of L Q T, S N AM a nd  MD-SNAM. T herein,   N re pre s e n ts the numbe of sub - patterns o r  nod es,  SNAM is th e origi nal sq uare  NAM-ba sed   rep r e s entatio n meth od, M D -S NAM i s   SNAM b a sed  on th e mi no r-di ago nal  scan,  _ L QT T  is the  ratio  of the  total data  am ou nt of L Q T to  that of T N AM,   _ L QT R  i s  the  ratio o f  the total  dat a am ount   of LQT to th a t  of RNAM,  _ LQ T S  is the  ratio of  the total data  amou nt of L Q T to that of  SNAM,  and  SNAM MD LQT _  is the ratio of the total  data amou nt of  LQT to that of MD-SNA M. The spe c if ic  data in th e e x perime n tal result i s   sho w n in Fi gure 8 .  Table  1 sh ows that, for  the above  ei ght  image s, SNA M  an d M D -S NAM h a ve o u tperfo rmed   LQT, tho ugh   these  two  al so have  si gnifi cant  differenc es  in performanc e   The o r igin al SNAM nee ds three field s   - coo r din a tes  of the sta r ting  point an d si d e  length   - for re co rdin g squ a re, fou r  fields - coo r dinat e s  of the starting p o i n t and of the endpoint - f o recording line  segme n t, and only 2 fields, namely the point coo r d i nates, for re cording i s olat ed   point. By co mpari s o n , M D -S NAM p r o v ides a  unifo rm  stora ge  st ructu r e  for  all  these types:  for  recording  sq uare, it i s  the  sam e  a s  S N AM; bec ause  it only gen erates  hori z o n tal line s , it on ly  need s three fields  - co ordin a tes of  the  starting p o int a nd the len g th  - for re co rdin g line segme n t;  and it also n eed s thre e fields fo r re co rding i s olated  point, whi c h i s  re ga rded  a s  squa re  with  a  side len g th o f  1. Obviously, MD-SNAM  involves  one  less field than the origin al SNAM for line  segm ent, but  one  mo re fie l d for i s ol ated  point. After  coding, th e n u m bers  of line  se gment s a n isolate d  point s vary form  o ne imag e to anothe r,  leadi ng to the differen c e i n  the  data amo unt  in  the co ding  result. The r ef ore, the diff eren ce i n  st orag e st ru ctu r e a c tually d oes  not hav e a   deci s ive im pa ct on th e codi ng pe rforman c e s  of  M D -S NAM an d SNAM. Furthe rmore,  com p a r ed   with the ori g inal SNAM, MD-S NAM not only has  a n  o p timized  storage st ru cture,  and also ado pt an imp r oved  scanni ng mo de -  namely,  the mino r-di agon al sca n n i ng mod e , providing it wit h  a   stron g e r  ad a p tation to im age s’ lo cal bl ocky texture s , so a s  to i n crea se  sq uare s  an d d e crea se   node s. Acco rding to th e e x perime n tal result, rega rdl e ss of ima g e  com p lexity, MD-S NAM h a Evaluation Warning : The document was created with Spire.PDF for Python.
TELKOM NIKA   ISSN:  1693-6 9 30     A Neighb or-finding Algo rith m  Involving the  Applicatio n of SNAM in Binary-im ag e …   (Defa Hu 1327 fewer no de s,  highe comp ression  ratio  a nd b e tter  spa t ial efficien cy  than the  ori g i nal SNAM, th us  it can furthe r redu ce the ti me com p lexi ty of the subseque nt image  processin g .       (a)   Le na  (b)   Flight (c)  Building  (d)   Boat     (d)   Map ( e )   Pictu r e s   (f) Baboo n   (g) Bri dge     Figure 8. Eight 256 x 256 binary ima g e s       Table 1. Co m pari s on of the  performan ce s of LQT, SNAM, MD-SNA M algorithm s   Image  C  _ LQ T T   _ LQ T S   SNAM MD LQT _   LQ T SNAM  MD-SNAM   Map 0.0882   5780   2708   1090   3.9609   4.2647   10.1613   Pictures 0.0835   5470   742  459  12.9781   16.0064   22.8413   Baboon  0.2601   17047   8668   4204   3.1227   3.8013   7.7719   Bridge 0.1813   1 1881   6057   3411   2.8796   3.7987   6.6760   Lena  0.0981   6430   3077   2466   2.9902   4.0376   4.9976   Flight 0.0850   5568   2253   1946   3.5287   4.7537   5.4840   Building  0.0702   4602   1425   1728   4.0114   6.0236   5.1044   Boat 0.1313   8604   3515   2731   3.3743   4.6094   6.0384       For  squ a re  a nd line  seg m ent, MD-S NA M gives different definition s  of neig hbo r , but the   prin ciple s  of  sea r ching fo r their neig h b o rs i n  t he gri d  matrix are i dentical. In fact, the ope rat i on  amount of fin d ing the n e ig hbor  of a line  segm ent, wh ich is  1 pixel  in width, is le ss th an that  of  fin d i n g  a sq ua r e ’s  ne ig hbo r .  Sinc e  LQT s  ba s i c   r e pr e s e n t a t io n un it is   s q ua r e  ima g e   b l oc k, a   squ a re  su b-p a ttern is  cho s en as  a ben chmark for M D -SNAM in the  experime n t. The expe rime nt  is aime d at compa r ing the  performan ce s in an e a st ward n e ighb or-find pro c e s s, and the result is  sho w n in Ta ble 2, whe r e,   T LQT  and  T MD - S N A M  repre s ent the execution time of neighbo r-fin ding   based  re spe c tively on LQT  and  on M D -SNAM, and  t L-MS  repre s e n t s the  spe ed-up ratio of M D - SNAM-b ased  neighb or-find i ng to LQT-ba sed n e igh bor-finding.   It can b e   se en fro m  the  Table  2 that  highe r  im ag e complexity ca n result in long e r   exec ution of  the eas t ward nei ghbor-finding with t h e two algorithms ,  indic a ting that image  compl e xity is propo rtion a l to the execut ion ti me of the co rrespon ding  alg o rith m. The average  executio n time of LQT - ba sed  neig hbo r-finding i s  4. 275 ~13.7 16 t i mes th at of neigh bor-findi ng   w i th  SN AM ba s e d  on  gr id a r r a y,  w h ich fu lly d e m on strate s th at the n e igh bor-f inding  alg o rit h based  on M D -S NAM i s   simple r, fa ster, a nd m o re supp ortive  for  other  subsequ ent i m age   pro c e ssi ng.     Evaluation Warning : The document was created with Spire.PDF for Python.
                             ISSN: 16 93-6 930   TELKOM NIKA  Vol. 13, No . 4, Decem b e r  2015 :  131 9 – 1329   1328 Table 2.   Com pari s on of the  execution ti me of an eas t w ard neig hbo r-findi ng pr ocess re spe c tively  with the LQT - based alg o rit h m and with  MD-S NAM-b a se d algo rith Image  C  Execution time ( m s)  Speedup ratio   T LQ T  T MD - S N A M  t L- M S   Map 0.0882   18.764   1.368   13.716   Pictures 0.0835   17.976   1.872   9.602   Baboon  0.2601   24.653   3.896   13.190   Bridge 0.1813   22.889   2.769   9.930   Lena  0.0981   19.774   1.608   5.611   Flight 0.0850   18.991   1.347   4.275   Building  0.0702   17.437   1.246   4.552   Boat 0.1313   20.988   2.157   6.581       5. Conclusio n   This p ape r, firstly, improv es the  scann ing mo d e  of the origi nal  SNAM so th at it can  handl e imag e s  with va rio u s texture characteri stics;   se con d ly, optim ize s  the  stora ge st ru cture f o sub - patte rn s so a s  to elim inate the sto r age differen c e in variou sub - patte rn s; thirdly, reali z es  the de scriptio n of the po sit i on rel a tion sh ips am ong  su b-patte rn s wit h  the gri d  a r ray; and finall y use s  the grid  array to limit the range of  one-di re ction a l neighb or-finding to the boun dary of the  grid a r ray that the ben ch mark blo c ks corre s po nd  to, thus crea ting a ne w neigh bor-findi ng   algorith m , wh ich ha s hig h e r  executio n ef ficien cy  than the cla s sic L Q T-ba se d met hod an d ca n be   applie d in i m age  ope rat i ons  su ch  a s   cal c ulation  of geo metric p r op ertie s  and  mome nt  gene ration.       Ackn o w l e dg ements   This  work wa s sup p o r ted by  Gua ngxi Natural  S c ien c e Fou ndatio Pro g ram (Grant   No.   2013 GXNSF BA01927 5, Grant No. 201 3GXNSFBA0 1927 6) , Gu a ngxi Unive r sit y  of Science  and   Tech nolo g Re sea r ch Progra m  (Gra nt No. 2 013YB 227, G r ant   No. 20 13YB2 28)  and  Nati onal   Natural Scie n c e Fou ndatio n of China (G rant No: 61 20 2464 ).      Referen ces   [1]    Xi ng Z ,  Shui L.  Image Edg e  F eature E x tracti on  an d Refi ni n g  Base d on Ge netic-Ant Co lo n y  A l gor ithm.   T E LKOMNIKA (T eleco m mu ni cation C o mputi ng Electro n ics  and C ontrol) . 2 015; 13( 1): 118 -127.   [2]    JJ La guar di a,  E Cu eto, M D obl are. A  Natu ral N e i ghb or G a lerki n  M e thod   w i th Q uadtre e  Structure.   Internatio na l Journ a l for Nu merical Met hods  in Eng i ne eri n g .  2005; 6 3 (6): 7 89-8 12.   [3]    I Garganti n i. A n  Effective W a y to  Re pres ent  Quadtre es.  C o mmunic a tio n s  of the A C M . 1 982;  25(1 2 ):  905- 910.   [4]    V Kha n n a , P  Gupta, JC   H w an g. Ma int a ini n g  Co nn e c ted C o mpo n ents i n  Qu ad tree-Base Repr esentati o n  of Images.  Irania n  Journ a l of  Electrical a nd  Co mp uter Engi neer ing . 2 003;  2(1): 53-6 0 [5]    BP Kumar, P  Gupta, CJ H w a ng. An Effici ent  Q uadtre e D a ta Structure f o Neig hb or F i n d i ng Al gor ithm.   Internatio na l Journ a l of Ima g e  and Grap hics . 2001; 1(4): 61 9-63 3.  [6]    P Bhattac har ya. Efficient  N e ig hbor-F i ndi n g  Al gorithm  i n  Qua d tree  a nd Octree.  K anp ur: Ind i an   Institute of  T e chno log y , 2 002.   [7]    S De Bruin, W De Wit, J Van  Oort, et.al. Using Quadtree Segmenta tio n  to  Supp ort Error  Mode lin g i n   Categ o rica l R a ster Data.  Int e rnati ona l Jo u r nal of Ge ogr aph ical Infor m ation Sc ienc e . 200 4; 18(2):   151- 168.   [8]    CL W ang, SC  W u , YK Chang. Quadtre e and St atistic a l  Model-B ased  Lossless Bi n a r y  Ima g e   Compress io n Method.  Imagi ng Scie nce Jo urna l . 200 5; 53 (2): 95-10 3.  [9]    G  Minglu n , Y Yee-H ong.  Quadtree-B a se d Genetic  Al g o rithm an d Its Applic atio ns to Comp ute r   Vision.  Pattern Recognition . 2 004; 37( 8): 172 3-17 33.   [10]    Chu anb o C. St ud on A  No n- S y mmetr an d  Anti -Packi ng   Pattern R epre s entatio n Met h od. W u h an:  Huaz hon g Un i v ersit y  of Sci e n c e and T e chno log y , 20 05.   [11]    Peng W ,   Chu anb o C, Yun p in g Z .  Image  Set-Operatio n Alg o rithm  base d  on  N A M and It s   Exp e rim ental Rese arch.  Jour nal of Yan g t z e   Univers i ty (Natural Sci ence E d itio n) . 200 9; 6(2): 76-79.    [12]    Weiju  H. Stud y on M u ltip le S u b-Pattern Ima g e   Re pres entati on a nd  Retri e v e  Metho d s b a s ed o n  NAM.  W uhan: Hu azh ong U n ivers i t y   of  Science a n d   T e chnol og y, 2 009.   Evaluation Warning : The document was created with Spire.PDF for Python.