TELKOM NIKA , Vol. 11, No. 8, August 2013, pp. 43 7 2 ~4 378   e-ISSN: 2087 -278X           4372      Re cei v ed Ma rch 1, 2 013;  Re vised  Ma y 12, 2013; Accepted Ma y 22 , 2013   Resear ch of CamShift Algorithm to Track Mo tion  Objects      Li Zhu*, Tao Hu   F a cult y   of Imformation En gin e e rin g , Hube i U n iversit y  for Na tiona lities   No. 39th  Xu e y uan ro ad, Ensh i,  Hube i, P.R.  Chin a    *Corres p o ndi n g  author, e-ma i l :   lier_z hu@ 16 3.com*, huta o _ 505 @hotma il.c o m       A b st r a ct   At prese n t, obj ects detecti on,  ide n tificati on  and  tr ackin g  a r e the v e ry  po pul ar res earch  are a i n   computing vis i on. A real-time objects  tracking system  was  proposed  in th is paper. This paper focuses  on  improve  Ca mShift al gorith m , w h ich can  track the  moti o n  ob jects w i th  hig h  a  acc u racy. An Ad apt i v e   Gaussia n  Bac k grou nd Mod e l  is propos ed in  the system,  which w a s estab lishe d in or der  to automatical l y   upd ate  the ba ckgrou nd and  detect  the  outli ne of  mov i n g   obj ects. By an aly z i n g d i ffere nt alg o rith ms,  this   pap er bri ngs  o u t appr oac hes  to pro m ote  th e perfor m anc e .  T he Ca mSh i ft algor ith m  to  compl e te  moti on   detectio n  a n d   obj ects trackin g , w h ich  app li e d  for stat ic  bac kgrou nd v i d eo  sequ enc es. An d the  exp e ri me nta l   results show  that this algor ith m  can  detect al l moti on o b ject s and track al most moti on ob je cts.    Ke y w ords : motion detection,  object tr acking,  Cam S hift, adaptive  gaussian backg round model     Copy right  ©  2013 Un ive r sita s Ah mad  Dah l an . All rig h t s r ese rved .       1. Introduc tion  Dete ction an d trackin g  of moving obj ects refe rs to a  widely u s ed  technol ogy  use d  for  automatically re co gnizi ng,  extr a c ting  a nd tracking   obje c ts f r om  a  seq uen ce  of video  im age  informatio n which  combi n e s  with imag e pro c e ssi ng, a u tomatic cont rol, informatio n sci ence an d   other  discipli nes [1]. Det e ction  and  trackin g   of  moving o b je cts te ch nolo g y is o ne  o f  the  techn o logie s  whi c h a r e i m porta nt to reali z the so-called ubiq u itous so ciet y,  which ca n   be  applie d t o  variou s ind u st ries  su ch a s  t r an spo r tat i on, astro n o m ical ob se rvation, scie n tific  resea r ch, national defe n se , and medi cin e , to ac hieve  advances  of prod uctivity and safety, and  improve the q uality of human life [2].  The pu rpo s of object dete c tion is to det ect  if there are the obje c ts  moving occu rred in  the su rveillan c e a r ea. If th at, then dete r mine the in fo rmation  of location an d si ze of the obj e c ts.  Obje ct tracki ng is also a n  important  appli c ati on b r an ch of Co mputer Visi o n  [4]. The goal o f   tracking  is to  recogni ze ta rget obje c ts f r om t he b a ckg r oun d an d ex tract featu r e s , then to de pi ct  the moving l o cu s of the m . How to t r a c k the o b je cts pre c isely an d fast is th key p r oble m   o f   obje c t s  t r a cki ng sy st e m .   In this paper,  the main obje c tive is to design  a real -time monitorin g  system for th e object  intere sted. After the imag e pretre atme nt, the sy stem firstly reco gnizes the m o ving target s in   video  seq uen ce s by  ba ckg r oun d diffe re nce  meth o d  and upd ates the  ba ckgrou nd  ima ge usi ng  Adaptive Gau ssi an Ba ckground M odel.  Acco rdi ng to  the outline a n d  colo r of the  moving targ ets,  the system  complete s the tracking of  th e obje c ts via CamShift alg o rithm.       2. Rese arch  Metho d   2.1. Mathem atical Morph o logical Filtering  The  prin cipl e  of math emat ical  morphol o g y re fe rs to  measure a n d  extra c t the  shape  of  obje c ts in ima ges a nd it ha s an excellent  mathem atica l  foundation  whi c h is  set theory. The r are   four ba si c op erato r of ma thematical  m o rph o l ogy, in cludi ng dilati on, ero s io n, openi ng, cl osing,  whi c h a r e u s ually defined  via set theo ry name s  [3, 6]. With the p a rallel implem e n tation struct ure,   mathemati c al  morp hology  filtering can  easily  a c hi eve morphol ogical analy s is  and p a rallel  pro c e ssi ng, thus it greatly im prove s  th e spe ed of i m age a nalysi s  and  pro c e s sing.  When it  is  used in image pre- processing, mathem atical  morphology filter ing, with  sm ooth contours,  filling   Evaluation Warning : The document was created with Spire.PDF for Python.
TELKOM NIKA   e-ISSN:  2087 -278X       Res e arch of CamShift Alg o rithm to  Track M o t i on Obj e ct (Li Zhu )   4373 hole s , conne cted fractu re  zo ne  cha r a c teri stics,  ca n sim p lify image  data to  maintain  obj ects’   basi c  shap e chara c te risti c s and rem o ve extraneo us  structu r e s .     2.2. Foregro und-b ackg ro und Subtra c t ion Meth od   In this pa per,  fore gro und -b ackgroud   sub t ract ion  meth od i s  a dopte d  for target d e tectio n   and extra c tio n  based on th e differen c e b e twee n t he current frame i n   the video seque nce ima g e   and the  ba ckgroud. T h e  flowcha r t is sho w n  in   Figure 1. According  to the meth od,  the  backg rou nd i m age  ado pte d  is first sto r e d  in th e   s y s t em. Be c a u s e  th e r e ar e   d i ffe r e nc es  be tw ee moving obj ects and  ba ckg r oun d in  gray scale o r   co lo r, the target  can be  distin g u ish ed from t h e   backg rou nd i m age by doi n g  sub s tractio n . Each pixel  value in the result will  be compa r ed  with  a  pre - set threshold value. If the value of the pixed  is g r eater than th e threshold, this poi nt belo ngs  to the foregro und, otherwi se  it belong s to backg rou n d .             Figure 1. The  Flow of Fore grou nd -ba c kg roun d Subtra ction Metho d       2.3. Adap tiv e  Gaus sian Bac k grou nd Model   Ho wever, the  backg rou nd i s  relatively se nsitiv e to external  co nditio n su ch a s  ill umition.   There are m any false target point whi c h will  redu ce the corre c t  rate. So, we adopte d  the  Adaptive G a ussian  Ba ckgrou nd  Mod e l to  adapt   to ch ang es i n  the  ba ckg r oun d. Ada p tive   Gau ssi an Ba ckgro und M o del applie s to  the case of  the cam e ra st ationary. It firstly establi s h ed  a   backg rou nd  model fo r a  stationa ry ba ckgro und, a n d  then auto m atic up date s  the b a ckg r ound  model a c cord ing to the cha nge of the en vironme n t.  The mo del e s tabli s he s th e ori g in b a ckgrou nd m ode 0 B  via Equatio n 1. The  0  ref e rs   to the pixel average valu e and  2 0  refers  to pixel variance.  ] [ B 2 0 0 0 .                                                                                                                                  (1)    It defines a  p a ram e ter   to pre s ent the  u pdate rate u s i ng Equatio 2. In the form ula, K  is   a  co nst  b e long s to  [0, 1 ] and  the  ch ara c ter t p r e s ents th e fram e t. The     ) , | ( 1 1 t t t f means the Gaussian  Probability Densit y Function i n   whi c 1 - t  refers  to the  avera g e  value  an d   1 - t  refers  to the varianc e .   ) , | ( K 1 1 t t t f                                                                                                                   (2)    The Equatio n  3 sho w s the  method to ca culate  the pix e l averag e value of the fra m e t.      t t f 1 t ) 1 (                                                                                                                       (3)    The varia n ce of the frame t is ca culate d usin g Equatio n 4.     ) ( ) ( ) 1 ( 2 1 2 t t t T t t t f f                                                                                   (4)    The equ ation  5 discrib e s h o w to esta blishes the b a ckgrou nd mo del  of frame t.    ] [ B 2 t t t                                                                                                                                    (5)  Evaluation Warning : The document was created with Spire.PDF for Python.
                               e-ISSN: 2 087-278X   TELKOM NIKA  Vol. 11, No . 8, August 2013:  4372 –  4378   4374 3. Ke y  Algorithm   3.1. MeanShift Algo rithm   MeanShift is non-pa ramet r ic method ba sed on d e n s ity function est i mation. On basi s  of  the pro babilit y distributio n  gradi ent, M eanShift  find s the n earest extremum  and impl eme n ts   efficiently tracking throug h color probability distri bution of objects [5] .     3.2. CamShift Algorithm   On ba si s of MeanShift al gorithm,  Cam S hift Algor ithm achi eves  o b ject s tra cki n g  throu gh  iterative cal c ulation, whi c h mean s Ca mShift defi nes the initial value of sea r ch  wind ow for  MeanShift al gorithm  usi n g the re sult s gotten in th e previo us frame [7]. The  formula  of the   algorithm is as follows.   Ca culate th e  se con d -m on ment of the  ma tch  wind o w . The Eq ua tion 6 di scrib e s the  se con d -m om ent of X direction. The equ ation 7 di scri bes the  se co nd-m o ment o f  Y direction  and   the Equation  8 discrib e s th e se con d -m o m ent of XY directio n.      I(x,y) x M xy 2 20                                                                                                                          (6)                                                                                                                                                             xy 02 I(x,y) y M 2                                                                                                                          (7)                                                                                                                                                                                                                                     xy 11 y x xyI M ) , (                                                                                                                          (8)    Ca culate thre e operational  para m eters u s ing Equ a tion  9.       2 c 00 20 x M M a                                                                            (9-a)  ) y x M M 2( b c c 00 11                                                                             (9-b)  c y M M c 00 02                                                                                                                                          (9-c   Ca culate the l ength an d wi dth of t he match wi ndo w u s ing Equation  10.     2 ) ( ) ( 2 2 c a b c a length                                                                                           (10-a)    2 ) ( ) ( 2 2 c a b c a width                                                                                      (10-b)    3.2. Compari s on   MeanShift algorithm  can  match the tra cki ng ra nge,  but the initial value of the search  wind ow  ca not be a d ju sted. Whe n  the tra cki ng t a rget s move  towards  or  away fro m  the  aqui siton dev ice s , the targ et’s are a  will  enlarg e   or redu ce in vari ous d egree s. If  the search   wind ow rema ins the  same  size, the ta rget’s a r ea  wil l  essily exce ed the search wind ow o r   be   within  a n a rrow  ran ge.  Howeve r, Cam S hift Algorith m  complete s the  real -tim e an d a c curacy  tracking tho u gh the ada ptive adjus tme n t  of the search wind ow.   CamShift alg o rithm  sea r ch  the obje c ts a l ong t he  aradi ent direction,  con s id erin g o n ly the  colo r di stribut ion rath er tha n  obje c t co ntours. Th e r efo r e, CamS hift can  well ad a p t to the external  environ ment.  The time  complexity of CamShift is   O(N2),  whi c h  is a fa st, re al-time tracki ng  algorith m  an d ca n re du ce the tra cki n g  cycl e. Bea c au se  CamS hift sho w g ood a n ti-jam ming   ability, a considerable degree of noi se, partial oc clusi o n of disruptors an d the light changes can   Evaluation Warning : The document was created with Spire.PDF for Python.
TEL K   be i g been  4.Sy s 4.1.  S movi n back g su cc e movi n the  v influ e math enha colo HSV  imag e throu accu r   4.2. I platf o Wind the  d follo w 1.  S reali z K OM NIKA    g no red. Ca m us ed  in  th e       s tem  De sig n S ys t e m  S t r u The p r o p n g obje c ts  t g rou nd met h e ss  rate. In  n g obje c ts r a     Firstly, t h v ideo i m ag e e nc es  s u c h   emati c al  m o nce the stru c RGB col o similarit y  e a colo r s p ac e e s int o  col o gh  Me an Sh i r acy tra c kin g mplement a t A  came r a o r m s  ar e c o m ows  XP, V S d ifferent ex p w s.    S ingle movin g The exp e z ed m o ving  o m Shift s h ow s sy st em t o  i m n  and Imple u cture   p os e d  sy st e m t rac k in g. In  t h od wa s us e the other p a a ther than th e h e sy st em e s e s to sepa r as illuminat o rphology filt e c ture.  o r sp ace   is   c a s ily. Then,  e . After that,  o r pro babi lit y i ft algorithm  g t ion and  Ex p a  w a s set  in  m p o s e d of  a S 2010, Op en p erim ental  e n g  obje c t det e e rim ental re o b j ec ts  dete c e-I Re sea r c h   o s  excell en e m prove tra c k i menta t io m  is   co m p os e t he part of   e d in o r de a rt of the sy s e  whole o n e Figure  2 s tabli s hes th e r ate the  ba c ion. After t h e r is used t o c onverted in t build a col o acco rdi n g  t o y  distributio n a nd Cam S h p eriments   a stat ionar y a  comp uter  a CV2.3 and   v n vironment,  e ction an d tr a sults ar s h c tion an d tra c SSN: 2087 - 2 o f CamShift  A e ffic i enc y, a c i ng a c curac y e of two p a moving obj e to reduce t h s tem, CamS . The flow o f     2 . Sys t em P r     e  Adaptive  G c kg rou nd a n h at, in orde r o  eliminate t h t o HSV   col o o r hi stog ram  o  the color  h n s imag es,  w h ift algorith m y  pl ace t o  m o a nd  a  we bc a v ideo parse three  grou p a ck ing  h own i n  Fig u c king with  A d 2 78 X A lg orithm  to c cur a cy  a n d   y a rts th at are  e ct s det e c t i n h e extern al  hift applied  t f the pro c es s r ocess Flow G aussian  Ba c n d foregrou r  to obtain  h e noise, si m r sp ace so  t throug h de t h is togram, t h w hi ch mea n m t he sy st e m o nitor a  sce n a m. And t h e xvid and Vi r p s of  expe ri u re 3,  whi c h d aptive Gau s Track M o t i o r o bu s t ne ss m o ving obj e g,  the auto m i n terferen ce  t o tracking t s es  is  sh ow n     c kgro und M o nd and  re d the conto u m plify the sh a t ha t h u m an   e t ac h i ng  H   p a h e sy st em  c s r e ver s p m  completes  n e. In this   p a e  s o ftw ar p r turalDub 1. 1 mental re su h  p r ove  tha s sian B a ck g r   o n Obj e ct ( L , therefore,  e ct s d e t e c t in m at ically up d an d  impr o v h e  cent roid  in Figure  2.  o del after in p d u c e the e x more effe c a pe  of objec t e ye c a jud g a ra meter fr o c o n verts the  p roj e ction.  A the real -tim a pe r, the ha r d p latf orm s  co n 1 0. 1.  A cco r d lts  ar e sh o w t the s y s t e m r o und Mod e l L i Zhu)  4375 it  has  g and  d ating   v e the  of the  p utting  x te rnal  c tively,   t s  and   g e th m t h or ig in   A t las t,  e a nd  d ware   n c l ude   d ing to   w n a s   m  ha .   Evaluation Warning : The document was created with Spire.PDF for Python.
                               e-ISSN: 2 087-278X   TELKOM NIKA  Vol. 11, No . 8, August 2013:  4372 –  4378   4376     Figure 3. Single Moving O b ject Detectio n and  Trackin g  in Different  Weath e r Con d ition                       In different test scena rio s , we can get th e experim ent al results sho w n in Tabl e 1 .       Table 1. Experime n tal Re sults in  Different  Weath e r Con d ition   scene  Object detection   Object tracking  sunn     r a ining        2.  Two movin g  obje c ts dete c tion and tra c king   Whe n  the m o ving target s i n crea se to t w o and th e two  target s are cl ose,  we find t hat the  search window will  automatically  expand and the cont our  of two targets  detected will  be joined   together. Th e  rea s on fo r this is th at mathematic al  morp holo g y filter ca n fill some sm all h o les  throug h cl osi ng op erato r In Figure 4,  if the  distan ce between t he targ ets i s  not clo s e, t h e   system h a d e tected t w o o b ject s; ho wev e r, it has  t r a c ked  only one  target a c cordi ng to the o r d e r   scanni ng fro m  top down.          Figure 4. Two  Moving Obje cts De tectin g and Trackin g  Re sults    3.  Multiple movi ng obje c ts d e t ection an d tracking    Whe n  all th e  target s a r clo s e, the  se ar ch wind ow will  auto m ati c ally  expa nd and  th conto u r of th e target s det ected  will be j o ined tog e the r . In addition,  the system  h a s d e tecte d  two  obje c ts; ho wever, it has tracked o n ly one target  a ccordin g to the orde r sca nnin g  from top do wn.  Figure 5 sho w s th at the result of movi ng obj e c ts d e tection  a nd tracking ba se on  CamShi ft  algorith m     Figure 5. Multiple Moving O b ject s Det c tio n  and Trackin g  Re sults    The re sult for different num ber of moving  targets i s  sh own in Ta ble  2.    Table 2. Experime n tal Re sults fo r Diffe rent Nu mbe r  of Target The numbe r of ta rgets  Object detection   Object tracking  single       tw o    Distant  objects  multiple    Distant  objects  Evaluation Warning : The document was created with Spire.PDF for Python.
TELKOM NIKA   e-ISSN:  2087 -278X       Res e arch of CamShift Alg o rithm to  Track M o t i on Obj e ct (Li Zhu )   4377 4.  Accu ra cy rate  analysi s    In ord e r t o  de tect the  accu racy of th e alg o rithm,  we u s ed 5 0  sets  of video  scene   whi c h   are re sp ectiv e ly compo s e d  by a different numbe r of moving objects. The re sult is sh own  in   Figure 6.     A: Target det ected a nd tra c ked in the  s a me  ar ea   B:Target dete c ted an d tracked in the  different area s     Figure 6. Accura cy Rate A nalysi s       From   the ab ove  results, we ca n sp eculate  that  th e alg o rithm  i s  a b le  to d e t ect the  moving o b je cts in th e m oni tored  area. B u t the a c cu ra cy rate of th e  algo rithm  de cre a ses line a r ly  with the incre a se in the n u m ber of movi ng obje c ts.    5.  Dete ction an d tracking u n der continu o u s  video sce n e    For fu rthe r a nalyzin g the  accuracy  rat e  of  the  algo rithm, we ha ve com p leted  the te st   unde r so me sets of comtin uou s video scene. The results are  sho w n in Figure 7.       A: detecting a nd trackin g  al l target  B:  detecting  all target, tracking the mo st   C: detectin g  all target, tracking the mo st   D: detectin g  all target, tracking the mo st   E: detecting a ll, trackin g  the remote ta rg et   F: detecting a nd trackin g  al l target     Figure 7. Analysis of Multip le Moving Obj e cts T e a ckin g     0% 50% 100% 150% Accuarcy Trace   people 0% 50% 100% 150% Accuarcy Trace   people Evaluation Warning : The document was created with Spire.PDF for Python.
                               e-ISSN: 2 087-278X   TELKOM NIKA  Vol. 11, No . 8, August 2013:  4372 –  4378   4378 From   the ab ove  results, we ca n sp eculate  that  th e alg o rithm  i s  a b le  to d e t ect the  moving obj ects und er  co mtinuou s vid eo sce ne, ho wever, the  a c cura cy rate  of the algo rithm  decrea s e s   wit h  the in crea se in the  comp lexity of  the chang es i n  the  monite red  area. Tho ugh  the  algorith m  ca n track the  remote target  well, it  is no t effective to track the  clo s e-ra nge m o ving   target, whi c is one of the follow-up  work in the proje c t.        5. Conclusio n   In this pape r, we have pro posed a mon i tori ng sy ste m  for the static backg rou n d  video  seq uen ce s.  T h is s u rv eilla n c e sy st em m a inly   com b in es two  su b-systems, moti on dete c tion  and   obje c t tra cki n g . Ho w to  de tect an d track the  obj ect s  pre c i s ely a n d  fast i s  th key p r obl em  of  obje c ts  dete c tion an d tra c king  sy stem.  By analyzi n g  the d e tectin g an d tra c kin g  alg o rithm, t h is  pape r b r in gs out m e thod s to  promote  the p e rf o r m ance. Experi m ents show  our metho d   can   achi eve the pre - dete r min ed target s. Furthe r improv ement of the system is  o u r cu rr ent wo rk to  deal with p o rt rait and shad ow overl ap.       Ackn o w l e dg ements   This wo rk  wa fina ncially suppo rted by  the  Program o f  Educatio Commissio n of  Hu bei  Province (B2 0122 905 ) an d the Progra m  of Ethni c and Reli giou s Affairs Co mmission of Hub e Province (HBMW20 120 06 ). Moreove r , we would li ke to thank T ang Yulei  for her work in  this  term.      Referen ces   [1]  Z hang h eng ju a n . Research of  target detectio n   and trackin g  base d  on bloc ked Gaussia n  backgr oun d.   T i anjin N o rmal  Univers i t y . 20 0 8 [2]  Z heng j i an gb in g, zhang  ya nn i ng, F eng da ji n g , Z hao  rongc h un. Movin g  Obj e ct Detection a nd  T r acking   Algorit hm for V i deo Mo nitori ng Systems Engi neer ing a nd El ectronics . 20 02 ; 10(24): 34-3 7   [3]  Dorin Comaniciu, V i sva n a tha n  Ramesh, Pet e r Meer . Real- T ime  T r acking of Non-Ri gid O b jects usin g   MeanS hift.  IEEE Confere n ce  on Co mputer V i sion  and P a ttern Reco gniti on .  2000; 2: 14 2-1 49.   [4]  D Coma nici u, P  Meer Mea n S hift Analysis  and Ap plic atio ns . Proc. Int'l Conf. Computer V i sion. 1999:   1 1 97 -1 20 3 .   [5]  MJ Sw ain, DH Ballard.  Index i ng via col o r hi stogra m s . Proc. of  the  T h ird Internati o n a l C onfere n ce on   Comp uter V i si o n . 1990; 3 90-3 93.   [6]  Gao Ch ong. I n vestig atio n a nd  Ana l ysis of   Ar ithmetic of Human M o ti on Det e ction  and  T r acki ng.   Engi neer in g C ontrol C o mput ers . 2008; 2 1 (1 0): 49-50.   [7]  Cha o -Ch i ng  H o , Chin g-L ong  Shih.  A  Real-T i m e F u zz y  R e a s oni ng Bas ed  Contro l S y ste m  for Catchin g   a Moving Goldf i sh.  Internatio n a l Jour nal of C ont rol,  Aut o mat i on, an d Syste m s . 20 09; 7(5):  755-7 63.       Evaluation Warning : The document was created with Spire.PDF for Python.