/ *   
 
   *   P R O J E C T :   N y A R T o o l k i t ( E x t e n s i o n ) 
 
   *   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
   *   T h e   N y A R T o o l k i t   i s   J a v a   e d i t i o n   A R T o o l K i t   c l a s s   l i b r a r y . 
 
   *   C o p y r i g h t   ( C ) 2 0 0 8 - 2 0 0 9   R y o   I i z u k a 
 
   * 
 
   *   T h i s   p r o g r a m   i s   f r e e   s o f t w a r e :   y o u   c a n   r e d i s t r i b u t e   i t   a n d / o r   m o d i f y 
 
   *   i t   u n d e r   t h e   t e r m s   o f   t h e   G N U   G e n e r a l   P u b l i c   L i c e n s e   a s   p u b l i s h e d   b y 
 
   *   t h e   F r e e   S o f t w a r e   F o u n d a t i o n ,   e i t h e r   v e r s i o n   3   o f   t h e   L i c e n s e ,   o r 
 
   *   ( a t   y o u r   o p t i o n )   a n y   l a t e r   v e r s i o n . 
 
   *   
 
   *   T h i s   p r o g r a m   i s   d i s t r i b u t e d   i n   t h e   h o p e   t h a t   i t   w i l l   b e   u s e f u l , 
 
   *   b u t   W I T H O U T   A N Y   W A R R A N T Y ;   w i t h o u t   e v e n   t h e   i m p l i e d   w a r r a n t y   o f 
 
   *   M E R C H A N T A B I L I T Y   o r   F I T N E S S   F O R   A   P A R T I C U L A R   P U R P O S E .     S e e   t h e 
 
   *   G N U   G e n e r a l   P u b l i c   L i c e n s e   f o r   m o r e   d e t a i l s . 
 
   * 
 
   *   Y o u   s h o u l d   h a v e   r e c e i v e d   a   c o p y   o f   t h e   G N U   G e n e r a l   P u b l i c   L i c e n s e 
 
   *   a l o n g   w i t h   t h i s   p r o g r a m .     I f   n o t ,   s e e   < h t t p : / / w w w . g n u . o r g / l i c e n s e s / > . 
 
   *   
 
   *   F o r   f u r t h e r   i n f o r m a t i o n   p l e a s e   c o n t a c t . 
 
   * 	 h t t p : / / n y a t l a . j p / n y a t o o l k i t / 
 
   * 	 < a i r m a i l ( a t ) e b o n y . p l a l a . o r . j p >   o r   < n y a t l a ( a t ) n y a t l a . j p > 
 
   *   
 
   * / 
 
 u s i n g   j p . n y a t l a . n y a r t o o l k i t . c s . c o r e ; 
 
 u s i n g   j p . n y a t l a . n y a r t o o l k i t . c s . m a r k e r s y s t e m . u t i l s ; 
 
 u s i n g   S y s t e m . I O ; 
 
 u s i n g   S y s t e m ; 
 
 u s i n g   S y s t e m . D i a g n o s t i c s ; 
 
 n a m e s p a c e   j p . n y a t l a . n y a r t o o l k i t . c s . m a r k e r s y s t e m 
 
 { 
 
 / * * 
 
   *   S0n0000o00000000A R n06R_000g0Y00
 
   *   pen0A R 000h0N y I D n0iQ`1Xn0{t_j0dq_;uPn0S__j0cOW0~0Y00
 
   *   S0n0000o00A R T o o l K i t V	gn0^j|0QRW0~0Y00Nn0^j|0QRY00h0M0k0o00}b000g0	YcW0f0O0`0U0D00
 
   *   0000000000kk00000>muU0[0f0OD0~0Y00J a v a n04XTk0o00O p e n G L (un0{ @ l i n k   N y A R G l M a r k e r S y s t e m } 000L0B00~0Y00
 
   * / 
 
 p u b l i c   c l a s s   N y A R M a r k e r S y s t e m   :   N y A R S i n g l e C a m e r a S y s t e m 
 
 { 
 
 	 / * *  0[pe$P0RweE\$P0:yY0$Pg0Y00 0* / 
 
         p u b l i c   c o n s t   i n t   T H L E S H O L D _ A U T O   =   0 x 7 f f f f f f f ; 
 
 
 
         / * *   000m1YBfn00m1Y~0g0n0hr( 0000pe) n0Rg$Pg0Y00* / 
 
 	 p u b l i c   c o n s t   i n t   L O S T _ D E L A Y _ D E F A U L T = 5 ; 
 
 	 
 
 	 
 
 	 p r i v a t e   c o n s t   i n t   M A S K _ I D T Y P E = 0 x 7 f f f f 0 0 0 ; 
 
         p r i v a t e   c o n s t   i n t   M A S K _ I D N U M   =   0 x 0 0 0 0 0 f f f ; 
 
         p r i v a t e   c o n s t   i n t   I D T Y P E _ A R T K   =   0 x 0 0 0 0 0 0 0 0 ; 
 
         p r i v a t e   c o n s t   i n t   I D T Y P E _ N Y I D   =   0 x 0 0 0 0 1 0 0 0 ; 
 
 	 p r i v a t e   c o n s t   i n t   I D T Y P E _ P S I D = 0 x 0 0 0 0 2 0 0 0 ; 
 
 
 
 
 
 	 p r o t e c t e d   I N y A R M a r k e r S y s t e m S q u a r e D e t e c t   _ s q d e t e c t ; 
 
 	 p r i v a t e   i n t   _ l a s t _ g s _ t h ; 
 
         p r i v a t e   i n t   _ b i n _ t h r e s h o l d   =   T H L E S H O L D _ A U T O ; 
 
 	 p r i v a t e   T r a c k i n g L i s t   _ t r a c k i n g _ l i s t ; 
 
 	 p r i v a t e   A R M a r k e r L i s t   _ a r m k _ l i s t ; 
 
 	 p r i v a t e   N y I d L i s t   _ i d m k _ l i s t ; 
 
         p r i v a t e   A R P l a y C a r d L i s t   _ p s m k _ l i s t ; 
 
 	 p r i v a t e   i n t   l o s t _ t h = 5 ; 
 
 	 p r i v a t e   I N y A R T r a n s M a t   _ t r a n s m a t ; 
 
 	 p r i v a t e   c o n s t   i n t   I N I T I A L _ M A R K E R _ S T A C K _ S I Z E = 1 0 ; 
 
 	 
 
 	 
 
 	 / * * 
 
 	   *   0000000g0Y00{ @ l i n k   I N y A R M a r k e r S y s t e m C o n f i g } 0CQk000000000ubW0~0Y00
 
 	   *   @ p a r a m   i _ c o n f i g 
 
 	   *   RgSnn0{ @ l i n k   M a r k e r S y s t e m } 0c[W0~0Y00
 
 	   *   @ t h r o w s   N y A R E x c e p t i o n 
 
 	   * / 
 
         p u b l i c   N y A R M a r k e r S y s t e m ( I N y A R M a r k e r S y s t e m C o n f i g   i _ c o n f i g ) 
 
                 :   b a s e ( i _ c o n f i g . g e t N y A R P a r a m ( ) ) 
 
 	 { 
 
 	 	 t h i s . i n i t I n s t a n c e ( i _ c o n f i g ) ; 
 
 	 	 
 
 	 	 t h i s . _ a r m k _ l i s t = n e w   A R M a r k e r L i s t ( ) ; 
 
 	 	 t h i s . _ i d m k _ l i s t = n e w   N y I d L i s t ( ) ; 
 
                 t h i s . _ p s m k _ l i s t   =   n e w   A R P l a y C a r d L i s t ( ) ; 
 
 	 	 t h i s . _ t r a c k i n g _ l i s t = n e w   T r a c k i n g L i s t ( ) ; 
 
 	 	 t h i s . _ t r a n s m a t = i _ c o n f i g . c r e a t e T r a n s m a t A l g o r i s m ( ) ; 
 
 	 	 / / TBfk0$R[_a0k0g0M00wb_n0pe
 
                 t h i s . _ o n _ s q _ h a n d l e r   =   n e w   O n S q u a r e D e t e c t ( i _ c o n f i g ,   t h i s . _ a r m k _ l i s t ,   t h i s . _ i d m k _ l i s t ,   t h i s . _ p s m k _ l i s t ,   t h i s . _ t r a c k i n g _ l i s t ,   I N I T I A L _ M A R K E R _ S T A C K _ S I Z E ) ; 
 
         } 
 
 	 p r o t e c t e d   v i r t u a l   v o i d   i n i t I n s t a n c e ( I N y A R M a r k e r S y s t e m C o n f i g   i _ r e f _ c o n f i g ) 
 
 	 { 
 
 	 	 t h i s . _ s q d e t e c t = n e w   S q u a r e D e t e c t ( i _ r e f _ c o n f i g ) ; 
 
 	 	 t h i s . _ h i s t _ t h = i _ r e f _ c o n f i g . c r e a t e A u t o T h r e s h o l d A r g o r i s m ( ) ; 
 
 	 } 
 
 	 / * * 
 
 	   *   S0n0peo001 Pn0I d 00000000k0{v2W0f00iQSk0W0~0Y00
 
 	   *   peo0000k0[_W0_0I D $P0000$P	0ԏW0~0Y00
 
 	   *   @ p a r a m   i _ i d 
 
 	   *   {v2Y00N y I d 000n0i d $P
 
 	   *   @ p a r a m   i _ m a r k e r _ s i z e 
 
 	   *   000n0Ve000[ m m ] 
 
 	   *   @ r e t u r n 
 
 	   *   000I D 0000	$P0S0n0$Po0I D n0$Pg0o0j0O00000n00000$Pg0Y00
 
 	   *   @ t h r o w s   N y A R E x c e p t i o n 
 
 	   * / 
 
 	 p u b l i c   i n t   a d d N y I d M a r k e r ( l o n g   i _ i d , d o u b l e   i _ m a r k e r _ s i z e ) 
 
 	 { 
 
                 r e t u r n   t h i s . a d d N y I d M a r k e r ( i _ i d ,   i _ i d ,   i _ m a r k e r _ s i z e ) ; 
 
 	 } 
 
 	 / * * 
 
 	   *   S0n0peo001 Pn0{V0cd0i d 00000000k0{v2W0f00iQSk0W0~0Y00
 
 	   *   000000o00i _ i d _ s < = n < = i _ i d _ e n0{Vk0B000000iQW0~0Y00
 
 	   *   OH0p001 juK005 ju~0g0n00000iQY004XTk0OD0~0Y00
 
 	   *   peo0000k0[_W0_0I D $P0000$P	0ԏW0~0Y00
 
 	   *   @ p a r a m   i _ i d _ s 
 
 	   *   I d {Vn0Y$P
 
 	   *   @ p a r a m   i _ i d _ e 
 
 	   *   I d {Vn0B}N$P
 
 	   *   @ p a r a m   i _ m a r k e r _ s i z e 
 
 	   *   000n0Ve000[ m m ] 
 
 	   *   @ r e t u r n 
 
 	   *   000I D 0000	$P0S0n0$Po0N y I D n0$Pg0o0j0O00000n00000$Pg0Y00
 
 	   *   @ t h r o w s   N y A R E x c e p t i o n 
 
 	   * / 
 
 	 p u b l i c   i n t   a d d N y I d M a r k e r ( l o n g   i _ i d _ s , l o n g   i _ i d _ e , d o u b l e   i _ m a r k e r _ s i z e ) 
 
 	 { 
 
                 N y I d L i s t . I t e m   t a r g e t   =   n e w   N y I d L i s t . I t e m ( i _ i d _ s ,   i _ i d _ e ,   i _ m a r k e r _ s i z e ) ; 
 
 	 	 t h i s . _ i d m k _ l i s t . A d d ( t a r g e t ) ; 
 
 	 	 t h i s . _ t r a c k i n g _ l i s t . a d d ( t a r g e t ) ; 
 
                 t h i s . _ o n _ s q _ h a n d l e r . s e t M a x D e t e c t M a r k e r C a p a c i t y ( t h i s . _ t r a c k i n g _ l i s t . C o u n t ) ; 
 
 	 	 r e t u r n   ( t h i s . _ i d m k _ l i s t . C o u n t - 1 ) | I D T Y P E _ N Y I D ; 
 
 	 } 
 
 	 / * * 
 
 	   *   S0n0peo001 Pn0{V0cd0A R 00000000000k0{v2W0f00iQSk0W0~0Y00
 
 	   *   000000o00i _ i d _ s < = n < = i _ i d _ e n0{Vk0B000000iQW0~0Y00
 
 	   *   OH0p001 juK005 ju~0g0n00000iQY004XTk0OD0~0Y00
 
 	   *   peo0000k0[_W0_0I D $P0000$P	0ԏW0~0Y00
 
 	   *   @ p a r a m   i _ i d _ s 
 
 	   *   I d {Vn0Y$P  ( 1 < = n < = 6 ) 
 
 	   *   @ p a r a m   i _ i d _ e 
 
 	   *   I d {Vn0B}N$P  ( 1 < = n < = 6 ) 
 
 	   *   @ p a r a m   i _ m a r k e r _ s i z e 
 
 	   *   000n0Ve000[ m m ] 
 
 	   *   @ r e t u r n 
 
 	   *   000I D 0000	$P0S0n0$Po0I D n0$Pg0o0j0O00000n00000$Pg0Y00
 
 	   *   @ t h r o w s   N y A R E x c e p t i o n 
 
 	   * / 
 
 	 p u b l i c   i n t   a d d P s A R P l a y C a r d ( i n t   i _ i d _ s , i n t   i _ i d _ e , d o u b l e   i _ m a r k e r _ s i z e ) 
 
 	 { 
 
 	 	 D e b u g . A s s e r t ( i _ i d _ s > 0   & &   i _ i d _ s < = 6 ) ; 
 
 	 	 D e b u g . A s s e r t ( i _ i d _ e > 0   & &   i _ i d _ e < = 6 ) ; 
 
 	 	 A R P l a y C a r d L i s t . I t e m   t a r g e t = n e w   A R P l a y C a r d L i s t . I t e m ( i _ i d _ s , i _ i d _ e , i _ m a r k e r _ s i z e ) ; 
 
 	 	 t h i s . _ p s m k _ l i s t . A d d ( t a r g e t ) ; 
 
 	 	 t h i s . _ t r a c k i n g _ l i s t . a d d ( t a r g e t ) ; 
 
                 t h i s . _ o n _ s q _ h a n d l e r . s e t M a x D e t e c t M a r k e r C a p a c i t y ( t h i s . _ t r a c k i n g _ l i s t . C o u n t ) ; 
 
                 r e t u r n   ( t h i s . _ p s m k _ l i s t . C o u n t   -   1 )   |   I D T Y P E _ P S I D ; 
 
 	 } 
 
 	 / * * 
 
 	   *   S0n0peo001 Pn0A R 00000000000k0{v2W0f00iQSk0W0~0Y00
 
 	   *   peo0000k0[_W0_0I D $P0000$P	0ԏW0~0Y00
 
 	   *   @ p a r a m   i _ i d 
 
 	   *   P S A R 000000n0I D 01 - 6 ~0g0n0pe$Pg0Y00
 
 	   *   @ p a r a m   i _ m a r k e r _ s i z e 
 
 	   *   000n0Ve000[ m m ] 
 
 	   *   @ r e t u r n 
 
 	   *   000I D 0000	$P0S0n0$Po0I D n0$Pg0o0j0O00000n00000$Pg0Y00
 
 	   *   @ t h r o w s   N y A R E x c e p t i o n 
 
 	   * / 
 
 	 p u b l i c   i n t   a d d P s A R P l a y C a r d ( i n t   i _ i d , d o u b l e   i _ m a r k e r _ s i z e ) 
 
 	 { 
 
 	 	 r e t u r n   t h i s . a d d P s A R P l a y C a r d ( i _ i d , i _ i d , i _ m a r k e r _ s i z e ) ; 
 
 	 } 
 
 	 / * * 
 
 	   *   S0n0peo00A R T o o l K i t 0000n000000{v2W0~0Y00
 
 	   *   @ p a r a m   i _ c o d e 
 
 	   *   {v2Y000000000000000
 
 	   *   @ p a r a m   i _ p a t t _ e d g e _ p e r c e n t a g e 
 
 	   *   000rRT0A R T o o l k i t h0TX04XTo02 5 0c[W0~0Y00
 
 	   *   @ p a r a m   i _ m a r k e r _ s i z e 
 
 	   *   000n0s^e000[ m m ] 
 
 	   *   @ r e t u r n 
 
 	   *   000I D 0000	$P0
 
 	   *   @ t h r o w s   N y A R E x c e p t i o n 
 
 	   * / 
 
 	 p u b l i c   i n t   a d d A R M a r k e r ( N y A R C o d e   i _ c o d e , i n t   i _ p a t t _ e d g e _ p e r c e n t a g e , d o u b l e   i _ m a r k e r _ s i z e ) 
 
 	 { 
 
 	 	 A R M a r k e r L i s t . I t e m   t a r g e t = n e w   A R M a r k e r L i s t . I t e m ( i _ c o d e , i _ p a t t _ e d g e _ p e r c e n t a g e , i _ m a r k e r _ s i z e ) ; 
 
 	 	 t h i s . _ a r m k _ l i s t . a d d ( t a r g e t ) ; 
 
 	 	 t h i s . _ t r a c k i n g _ l i s t . a d d ( t a r g e t ) ; 
 
                 t h i s . _ o n _ s q _ h a n d l e r . s e t M a x D e t e c t M a r k e r C a p a c i t y ( t h i s . _ t r a c k i n g _ l i s t . C o u n t ) ; 
 
                 r e t u r n   ( t h i s . _ a r m k _ l i s t . C o u n t   -   1 )   |   I D T Y P E _ A R T K ; 
 
 	 } 
 
 	 / * * 
 
 	   *   S0n0peo00A R T o o l K i t 0000n00000000000K000`0W0f00{v2W0~0Y00
 
 	   *   @ p a r a m   i _ s t r e a m 
 
 	   *   00000000QY000000
 
 	   *   @ p a r a m   i _ p a t t _ e d g e _ p e r c e n t a g e 
 
 	   *   000rRT0A R T o o l k i t h0TX04XTo02 5 0c[W0~0Y00
 
 	   *   @ p a r a m   i _ m a r k e r _ s i z e 
 
 	   *   000n0s^e000[ m m ] 
 
 	   *   @ r e t u r n 
 
 	   *   000I D 0000	$P0
 
 	   *   @ t h r o w s   N y A R E x c e p t i o n 
 
 	   * / 
 
 	 p u b l i c   i n t   a d d A R M a r k e r ( S t r e a m R e a d e r   i _ s t r e a m , i n t   i _ p a t t _ r e s o l u t i o n , i n t   i _ p a t t _ e d g e _ p e r c e n t a g e , d o u b l e   i _ m a r k e r _ s i z e ) 
 
 	 { 
 
 	 	 N y A R C o d e   c = N y A R C o d e . c r e a t e F r o m A R P a t t F i l e ( i _ s t r e a m , i _ p a t t _ r e s o l u t i o n , i _ p a t t _ r e s o l u t i o n ) ; 
 
 	 	 r e t u r n   t h i s . a d d A R M a r k e r ( c ,   i _ p a t t _ e d g e _ p e r c e n t a g e ,   i _ m a r k e r _ s i z e ) ; 
 
 	 } 
 
 	 / * * 
 
 	   *   S0n0peo00A R T o o l K i t 0000n0000000000K000`0W0f00{v2W0~0Y00
 
 	   *   @ p a r a m   i _ s t r e a m 
 
 	   *   00000000QY000000
 
 	   *   @ p a r a m   i _ p a t t _ e d g e _ p e r c e n t a g e 
 
 	   *   000rRT0A R T o o l k i t h0TX04XTo02 5 0c[W0~0Y00
 
 	   *   @ p a r a m   i _ m a r k e r _ s i z e 
 
 	   *   000n0s^e000[ m m ] 
 
 	   *   @ r e t u r n 
 
 	   *   000I D 0000	$P0
 
 	   *   @ t h r o w s   N y A R E x c e p t i o n 
 
 	   * / 
 
 	 p u b l i c   i n t   a d d A R M a r k e r ( S t r i n g   i _ f i l e _ n a m e , i n t   i _ p a t t _ r e s o l u t i o n , i n t   i _ p a t t _ e d g e _ p e r c e n t a g e , d o u b l e   i _ m a r k e r _ s i z e ) 
 
 	 { 
 
 	 	 t r y { 
 
 	 	 	 N y A R C o d e   c = N y A R C o d e . c r e a t e F r o m A R P a t t F i l e ( n e w   S t r e a m R e a d e r ( i _ f i l e _ n a m e ) , i _ p a t t _ r e s o l u t i o n , i _ p a t t _ r e s o l u t i o n ) ; 
 
 	 	 	 r e t u r n   t h i s . a d d A R M a r k e r ( c , i _ p a t t _ e d g e _ p e r c e n t a g e ,   i _ m a r k e r _ s i z e ) ; 
 
 	 	 } c a t c h ( E x c e p t i o n   e ) { 
 
 	 	 	 t h r o w   n e w   N y A R E x c e p t i o n ( e ) ; 
 
 	 	 } 
 
 	 } 
 
 	 / * * 
 
 	   *   S0n0peo00;uPK00A R 00000000ubW0f00{v2W0~0Y00
 
 	   *   000000I{n0;uPK00ubW0_00000o00dq_;uPK00ubW0_000000000h0kW0f00dq_;uPn0r	YSk01_O0j00~0Y00
 
 	   *   laW0f0O0`0U0D00
 
 	   *   @ p a r a m   i _ r a s t e r 
 
 	   *   000;uP0<h
}W0_0000000000
 
 	   *   @ p a r a m   i _ p a t t _ r e s o l u t i o n 
 
 	   *   000n0P^
 
 	   *   @ p a r a m   i _ p a t t _ e d g e _ p e r c e n t a g e 
 
 	   *   000n0000Wn000000000000o00i _ r a s t e r K00000W0dD0_00000K00ubW0~0Y00
 
 	   *   A R T o o l K i t 0000n0;uP0(uD004XTo002 5 0c[W0~0Y00
 
 	   *   @ p a r a m   i _ m a r k e r _ s i z e 
 
 	   *   000n0s^e000[ m m ] 
 
 	   *   @ r e t u r n 
 
 	   *   000I D 0000	$P0
 
 	   *   @ t h r o w s   N y A R E x c e p t i o n 
 
 	   * / 
 
 	 p u b l i c   i n t   a d d A R M a r k e r ( I N y A R R g b R a s t e r   i _ r a s t e r , i n t   i _ p a t t _ r e s o l u t i o n , i n t   i _ p a t t _ e d g e _ p e r c e n t a g e , d o u b l e   i _ m a r k e r _ s i z e ) 
 
 	 { 
 
 	 	 N y A R C o d e   c = n e w   N y A R C o d e ( i _ p a t t _ r e s o l u t i o n , i _ p a t t _ r e s o l u t i o n ) ; 
 
 	 	 N y A R I n t S i z e   s = i _ r a s t e r . g e t S i z e ( ) ; 
 
 	 	 / / 000K0000000000R0QY00
 
 	 	 I N y A R P e r s p e c t i v e C o p y   p c = ( I N y A R P e r s p e c t i v e C o p y ) i _ r a s t e r . c r e a t e I n t e r f a c e ( t y p e o f ( I N y A R P e r s p e c t i v e C o p y ) ) ; 
 
 	 	 N y A R R g b R a s t e r   t r = n e w   N y A R R g b R a s t e r ( i _ p a t t _ r e s o l u t i o n , i _ p a t t _ r e s o l u t i o n ) ; 
 
 	 	 p c . c o p y P a t t ( 0 , 0 , s . w , 0 , s . w , s . h , 0 , s . h , i _ p a t t _ e d g e _ p e r c e n t a g e ,   i _ p a t t _ e d g e _ p e r c e n t a g e , 4 ,   t r ) ; 
 
 	 	 / / R0QW0_000000000
 
 	 	 c . s e t R a s t e r ( t r ) ; 
 
 	 	 r e t u r n   t h i s . a d d A R M a r k e r ( c , i _ p a t t _ e d g e _ p e r c e n t a g e , i _ m a r k e r _ s i z e ) ; 
 
 	 } 
 
 	 
 
 	 
 
 	 / * * 
 
 	   *   S0n0peo00  000I D k0[_Y00000L0iQU00f0D00K00ԏW0~0Y00
 
 	   *   @ p a r a m   i _ i d 
 
 	   *   000I D 0000	$P0
 
 	   *   @ r e t u r n 
 
 	   *   0000iQW0f0D00p0t r u e 0ԏW0~0Y00
 
 	   * / 
 
 	 p u b l i c   b o o l   i s E x i s t M a r k e r ( i n t   i _ i d ) 
 
 	 { 
 
 	 	 r e t u r n   t h i s . g e t L i f e ( i _ i d ) > 0 ; 
 
 	 } 
 
 	 / * * 
 
 	   *   S0n0peo00A R 000n0 gяn0 N^0ԏW0~0Y00
 
 	   *   { @ l i n k   # i s E x i s t M a r k e r ( i n t ) } L0t r u e n0Bfk0`0Q0O(ug0M0~0Y00
 
 	   *   $Po0Rgn0 N^g0B000000000-No0	YRW0~0[000
 
 	   *   @ p a r a m   i _ i d 
 
 	   *   000I D 0000	$P0
 
 	   *   @ r e t u r n 
 
 	   *   0 & l t ; n & l t ; 1 n0 N^0
 
 	   * / 
 
 	 p u b l i c   d o u b l e   g e t C o n f i d e n c e ( i n t   i _ i d ) 
 
 	 { 
 
 	 	 i f ( ( i _ i d   &   M A S K _ I D T Y P E ) = = I D T Y P E _ A R T K ) { 
 
 	 	 	 / / A R 000
 
 	 	 	 r e t u r n   t h i s . _ a r m k _ l i s t [ i _ i d   & M A S K _ I D N U M ] . c f ; 
 
 	 	 } 
 
 	 	 / / I d 000
 
 	 	 t h r o w   n e w   N y A R E x c e p t i o n ( ) ; 
 
 	 } 
 
 	 / * * 
 
 	   *   S0n0peo00N y I d 000n0I D $P0ԏW0~0Y00
 
 	   *   {Vc[g0{v2W0_0N y I d 000K000[n0I D 0_0_00k0OD0~0Y00
 
 	   *   @ p a r a m   i _ i d 
 
 	   *   000I D 0000	$P0
 
 	   *   @ r e t u r n 
 
 	   *   s(Wn0N y I d n0$P
 
 	   *   @ t h r o w s   N y A R E x c e p t i o n 
 
 	   * / 
 
 	 p u b l i c   l o n g   g e t N y I d ( i n t   i _ i d ) 
 
 	 { 
 
 	 	 i f ( ( i _ i d   &   M A S K _ I D T Y P E ) = = I D T Y P E _ N Y I D ) { 
 
 	 	 	 / / I d 000
 
 	 	 	 r e t u r n   t h i s . _ i d m k _ l i s t [ i _ i d   & M A S K _ I D N U M ] . n y i d ; 
 
 	 	 } 
 
 	 	 / / A R 000
 
 	 	 t h r o w   n e w   N y A R E x c e p t i o n ( ) ; 
 
 	 } 
 
 	 / * * 
 
 	   *   S0n0peo00s(Wn0$PSweE\$P0ԏW0~0Y00
 
 	   *   RweE\$P0xbW0f0D004XTo00vяk0iQW0_0weE\$P0ԏW0~0Y00
 
 	   *   @ r e t u r n 
 
 	   *   weE\$P( 0 - 2 5 5 ) 
 
 	   * / 
 
 	 p u b l i c   i n t   g e t C u r r e n t T h r e s h o l d ( ) 
 
 	 { 
 
 	 	 r e t u r n   t h i s . _ l a s t _ g s _ t h ; 
 
 	 } 
 
 	 / * * 
 
 	   *   S0n0peo00000n0000$P0ԏW0~0Y00
 
 	   *   000$Po000000kk0R{U000[}T$Pg0Y00
 
 	   *   @ p a r a m   i _ i d 
 
 	   *   000I D 0000	$P0
 
 	   *   @ r e t u r n 
 
 	   *   000$P
 
 	   * / 
 
 	 p u b l i c   l o n g   g e t L i f e ( i n t   i _ i d ) 
 
 	 { 
 
 	 	 s w i t c h ( i _ i d   &   M A S K _ I D T Y P E ) 
 
 	 	 { 
 
 	 	 c a s e   I D T Y P E _ A R T K : 
 
 	 	 	 r e t u r n   t h i s . _ a r m k _ l i s t [ i _ i d   &   M A S K _ I D N U M ] . l i f e ; 
 
 	 	 c a s e   I D T Y P E _ N Y I D : 
 
 	 	 	 r e t u r n   t h i s . _ i d m k _ l i s t [ i _ i d   &   M A S K _ I D N U M ] . l i f e ; 
 
 	 	 c a s e   I D T Y P E _ P S I D : 
 
                         r e t u r n   t h i s . _ p s m k _ l i s t [ i _ i d   &   M A S K _ I D N U M ] . l i f e ; 
 
 	 	 d e f a u l t : 
 
 	 	 	 t h r o w   n e w   N y A R E x c e p t i o n ( ) ; 
 
 	 	 } 
 
         } 
 
 	 / * * 
 
 	   *   S0n0peo00000n0m1Y0000n0$P0ԏW0~0Y00
 
 	   *   m1Y0000n0$Po000000 NBfvk0000W0_0Bfk0R{U000$Pg0Y00Q^iQW0_0Bfk00 k00000U00~0Y00
 
 	   *   @ p a r a m   i _ i d 
 
 	   *   000I D 0000	$P0
 
 	   *   @ r e t u r n 
 
 	   *   m1Y0000n0$P
 
 	   * / 
 
 	 p u b l i c   l o n g   g e t L o s t C o u n t ( i n t   i _ i d ) 
 
 	 { 
 
 	 	 s w i t c h ( i _ i d   &   M A S K _ I D T Y P E ) 
 
 	 	 { 
 
 	 	 c a s e   I D T Y P E _ A R T K : 
 
 	 	 	 r e t u r n   t h i s . _ a r m k _ l i s t [ i _ i d   &   M A S K _ I D N U M ] . l o s t _ c o u n t ; 
 
 	 	 c a s e   I D T Y P E _ N Y I D : 
 
 	 	 	 r e t u r n   t h i s . _ i d m k _ l i s t [ i _ i d   &   M A S K _ I D N U M ] . l o s t _ c o u n t ; 
 
 	 	 c a s e   I D T Y P E _ P S I D : 
 
                         r e t u r n   t h i s . _ p s m k _ l i s t [ i _ i d   &   M A S K _ I D N U M ] . l o s t _ c o u n t ; 
 
 	 	 d e f a u l t : 
 
 	 	 	 t h r o w   n e w   N y A R E x c e p t i o n ( ) ; 
 
 
 
 	 	 } 
 
 	 } 
 
 	 / * * 
 
 	   *   S0n0peo0000000^jp0000s^bn0pk0	YcW0~0Y00
 
 	   *   { @ l i n k   # i s E x i s t M a r k e r ( i n t ) } L0t r u e n0Bfk0`0Q0O(ug0M0~0Y00
 
 	   *   @ p a r a m   i _ i d 
 
 	   *   000I D 0000	$P0
 
 	   *   @ p a r a m   i _ x 
 
 	   *   	YcCQn000000^j
 
 	   *   @ p a r a m   i _ y 
 
 	   *   	YcCQn000000^j
 
 	   *   @ p a r a m   i _ o u t 
 
 	   *   P}g0<h
}Y00000000
 
 	   *   @ r e t u r n 
 
 	   *   P}g0<h
}W0_0i _ o u t k0-[W0_0000000
 
 	   * / 
 
 	 p u b l i c   N y A R D o u b l e P o i n t 3 d   g e t M a r k e r P l a n e P o s ( i n t   i _ i d , i n t   i _ x , i n t   i _ y , N y A R D o u b l e P o i n t 3 d   i _ o u t ) 
 
 	 { 
 
 	 	 t h i s . _ f r u s t u m . u n P r o j e c t O n M a t r i x ( i _ x ,   i _ y , t h i s . g e t M a r k e r M a t r i x ( i _ i d ) , i _ o u t ) ; 
 
 	 	 r e t u r n   i _ o u t ; 
 
 	 } 
 
 	 p r i v a t e   N y A R D o u b l e P o i n t 3 d   _ w k _ 3 d p o s = n e w   N y A R D o u b l e P o i n t 3 d ( ) ; 
 
 	 / * * 
 
 	   *   S0n0peo00000^j|n0p000000^jx0	YcW0~0Y00
 
 	   *   { @ l i n k   # i s E x i s t M a r k e r ( i n t ) } L0t r u e n0Bfk0`0Q0O(ug0M0~0Y00
 
 	   *   @ p a r a m   i _ i d 
 
 	   *   000I D 0000	$P0
 
 	   *   @ p a r a m   i _ x 
 
 	   *   000^j|n0X ^j
 
 	   *   @ p a r a m   i _ y 
 
 	   *   000^j|n0Y ^j
 
 	   *   @ p a r a m   i _ z 
 
 	   *   000^j|n0Z ^j
 
 	   *   @ p a r a m   i _ o u t 
 
 	   *   P}g0<h
}Y00000000
 
 	   *   @ r e t u r n 
 
 	   *   P}g0<h
}W0_0i _ o u t k0-[W0_0000000
 
 	   * / 
 
 	 p u b l i c   N y A R D o u b l e P o i n t 2 d   g e t S c r e e n P o s ( i n t   i _ i d , d o u b l e   i _ x , d o u b l e   i _ y , d o u b l e   i _ z , N y A R D o u b l e P o i n t 2 d   i _ o u t ) 
 
 	 { 
 
 	 	 N y A R D o u b l e P o i n t 3 d   _ w k _ 3 d p o s = t h i s . _ w k _ 3 d p o s ; 
 
 	 	 t h i s . g e t M a r k e r M a t r i x ( i _ i d ) . t r a n s f o r m 3 d ( i _ x ,   i _ y ,   i _ z , _ w k _ 3 d p o s ) ; 
 
 	 	 t h i s . _ f r u s t u m . p r o j e c t ( _ w k _ 3 d p o s , i _ o u t ) ; 
 
 	 	 r e t u r n   i _ o u t ; 
 
 	 } 	 
 
 	 p r i v a t e   N y A R D o u b l e P o i n t 3 d [ ]   _ _ p o s 3 d = N y A R D o u b l e P o i n t 3 d . c r e a t e A r r a y ( 4 ) ; 
 
 	 p r i v a t e   N y A R D o u b l e P o i n t 2 d [ ]   _ _ p o s 2 d = N y A R D o u b l e P o i n t 2 d . c r e a t e A r r a y ( 4 ) ; 
 
 
 
 	 
 
 	 / * * 
 
 	   *   S0n0peo00000s^b
Nn0Nan0pg0V~000WK000;uP0\q_	YcW0f0ԏW0~0Y00
 
 	   *   { @ l i n k   # i s E x i s t M a r k e r ( i n t ) } L0t r u e n0Bfk0`0Q0O(ug0M0~0Y00
 
 	   *   @ p a r a m   i _ i d 
 
 	   *   000I D 0000	$P0
 
 	   *   @ p a r a m   i _ s e n s o r 
 
 	   *   ;uP0S_Y0000000000008^o0{ @ l i n k   # u p d a t e ( N y A R S e n s o r ) } pek0eQRW0_00n0h0TX00n00c[W0~0Y00
 
 	   *   @ p a r a m   i _ x 1 
 
 	   *   p1 [ m m ] 
 
 	   *   @ p a r a m   i _ y 1 
 
 	   *   p1 [ m m ] 
 
 	   *   @ p a r a m   i _ x 2 
 
 	   *   p2 [ m m ] 
 
 	   *   @ p a r a m   i _ y 2 
 
 	   *   p2 [ m m ] 
 
 	   *   @ p a r a m   i _ x 3 
 
 	   *   p3 [ m m ] 
 
 	   *   @ p a r a m   i _ y 3 
 
 	   *   p3 [ m m ] 
 
 	   *   @ p a r a m   i _ x 4 
 
 	   *   p4 [ m m ] 
 
 	   *   @ p a r a m   i _ y 4 
 
 	   *   p4 [ m m ] 
 
 	   *   @ p a r a m   i _ r a s t e r 
 
 	   *   S_W0_0;uP0<h
}Y00000000
 
 	   *   @ r e t u r n 
 
 	   *   P}g0<h
}W0_0i _ r a s t e r 000000
 
 	   *   @ t h r o w s   N y A R E x c e p t i o n 
 
 	   * / 
 
 	 p u b l i c   I N y A R R g b R a s t e r   g e t M a r k e r P l a n e I m a g e ( 
 
 	 	 i n t   i _ i d , 
 
 	 	 N y A R S e n s o r   i _ s e n s o r , 
 
 	 	 d o u b l e   i _ x 1 , d o u b l e   i _ y 1 , 
 
 	 	 d o u b l e   i _ x 2 , d o u b l e   i _ y 2 , 
 
 	 	 d o u b l e   i _ x 3 , d o u b l e   i _ y 3 , 
 
 	 	 d o u b l e   i _ x 4 , d o u b l e   i _ y 4 , 
 
 	         I N y A R R g b R a s t e r   i _ r a s t e r ) 
 
 	 { 
 
 	 	 N y A R D o u b l e P o i n t 3 d [ ]   p o s     =   t h i s . _ _ p o s 3 d ; 
 
 	 	 N y A R D o u b l e P o i n t 2 d [ ]   p o s 2   =   t h i s . _ _ p o s 2 d ; 
 
 	 	 N y A R D o u b l e M a t r i x 4 4   t m a t = t h i s . g e t M a r k e r M a t r i x ( i _ i d ) ; 
 
 	 	 t m a t . t r a n s f o r m 3 d ( i _ x 1 ,   i _ y 1 , 0 , 	 p o s [ 1 ] ) ; 
 
 	 	 t m a t . t r a n s f o r m 3 d ( i _ x 2 ,   i _ y 2 , 0 , 	 p o s [ 0 ] ) ; 
 
 	 	 t m a t . t r a n s f o r m 3 d ( i _ x 3 ,   i _ y 3 , 0 , 	 p o s [ 3 ] ) ; 
 
 	 	 t m a t . t r a n s f o r m 3 d ( i _ x 4 ,   i _ y 4 , 0 , 	 p o s [ 2 ] ) ; 
 
 	 	 f o r ( i n t   i = 3 ; i > = 0 ; i - - ) { 
 
 	 	 	 t h i s . _ f r u s t u m . p r o j e c t ( p o s [ i ] , p o s 2 [ i ] ) ; 
 
 	 	 } 
 
 	 	 r e t u r n   i _ s e n s o r . g e t P e r s p e c t i v e I m a g e ( p o s 2 [ 0 ] . x ,   p o s 2 [ 0 ] . y , p o s 2 [ 1 ] . x ,   p o s 2 [ 1 ] . y , p o s 2 [ 2 ] . x ,   p o s 2 [ 2 ] . y , p o s 2 [ 3 ] . x ,   p o s 2 [ 3 ] . y , i _ r a s t e r ) ; 
 
 	 } 
 
 	 / * * 
 
 	   *   S0n0peo00000s^b
Nn0Nan0wb_g0V~000WK000;uP0\q_	YcW0f0ԏW0~0Y00
 
 	   *   { @ l i n k   # i s E x i s t M a r k e r ( i n t ) } L0t r u e n0Bfk0`0Q0O(ug0M0~0Y00
 
 	   *   @ p a r a m   i _ i d 
 
 	   *   000I D 0000	$P0
 
 	   *   @ p a r a m   i _ s e n s o r 
 
 	   *   ;uP0S_Y0000000000008^o0{ @ l i n k   # u p d a t e ( N y A R S e n s o r ) } pek0eQRW0_00n0h0TX00n00c[W0~0Y00
 
 	   *   @ p a r a m   i _ l 
 
 	   *   wb_n0]
Npg0Y00
 
 	   *   @ p a r a m   i _ t 
 
 	   *   wb_n0]
Npg0Y00
 
 	   *   @ p a r a m   i _ w 
 
 	   *   wb_n0E^g0Y00
 
 	   *   @ p a r a m   i _ h 
 
 	   *   wb_n0E^g0Y00
 
 	   *   @ p a r a m   i _ r a s t e r 
 
 	   *   QRHQn0000000
 
 	   *   @ r e t u r n 
 
 	   *   P}g0<h
}W0_0i _ r a s t e r 000000
 
 	   *   @ t h r o w s   N y A R E x c e p t i o n 
 
 	   * / 
 
 	 p u b l i c   I N y A R R g b R a s t e r   g e t M a r k e r P l a n e I m a g e ( 
 
 	 	 i n t   i _ i d , 
 
 	 	 N y A R S e n s o r   i _ s e n s o r , 
 
 	         d o u b l e   i _ l , d o u b l e   i _ t , 
 
 	         d o u b l e   i _ w , d o u b l e   i _ h , 
 
 	         I N y A R R g b R a s t e r   i _ r a s t e r ) 
 
         { 
 
 	 	 r e t u r n   t h i s . g e t M a r k e r P l a n e I m a g e ( i _ i d , i _ s e n s o r , i _ l + i _ w - 1 , i _ t + i _ h - 1 , i _ l , i _ t + i _ h - 1 , i _ l , i _ t , i _ l + i _ w - 1 , i _ t , i _ r a s t e r ) ; 
 
         } 
 
 	 / * * 
 
 	   *   S0n0peo00000n0YR	YcLR0ԏW0~0Y00
 
 	   *   000I D 0000	$P0
 
 	   *   @ r e t u r n 
 
 	   *   [ r e a d o n l y ] 
 
 	   *   YRLR0<h
}W0_00000000^j|o00A R T o o l K i t ^j|g0Y00
 
 	   * / 
 
 	 p u b l i c   N y A R D o u b l e M a t r i x 4 4   g e t M a r k e r M a t r i x ( i n t   i _ i d ) 
 
 	 { 
 
 	 	 s w i t c h ( i _ i d   &   M A S K _ I D T Y P E ) 
 
 	 	 { 
 
 	 	 c a s e   I D T Y P E _ A R T K : 
 
 	 	 	 r e t u r n   t h i s . _ a r m k _ l i s t [ i _ i d   & M A S K _ I D N U M ] . t m a t ; 
 
 	 	 c a s e   I D T Y P E _ N Y I D : 
 
 	 	 	 r e t u r n   t h i s . _ i d m k _ l i s t [ i _ i d   & M A S K _ I D N U M ] . t m a t ; 
 
 	 	 c a s e   I D T Y P E _ P S I D : 
 
                         r e t u r n   t h i s . _ p s m k _ l i s t [ i _ i d   &   M A S K _ I D N U M ] . t m a t ; 
 
 	 	 d e f a u l t : 
 
 	 	 	 t h r o w   n e w   N y A R E x c e p t i o n ( ) ; 
 
 	 	 } 	 	 
 
 	 } 
 
 	 / * * 
 
 	   *   S0n0peo00000n04 pn0000000
Nn0N!kCQ^j0ԏW0~0Y00
 
 	   *   @ p a r a m   i _ i d 
 
 	   *   000I D 0000	$P0
 
 	   *   @ r e t u r n 
 
 	   *   [ r e a d o n l y ] 
 
 	   * / 
 
 	 p u b l i c   N y A R I n t P o i n t 2 d [ ]   g e t M a r k e r V e r t e x 2 D ( i n t   i _ i d ) 
 
 	 { 
 
 	 	 s w i t c h ( i _ i d   &   M A S K _ I D T Y P E ) 
 
 	 	 { 
 
 	 	 c a s e   I D T Y P E _ A R T K : 
 
 	 	 	 r e t u r n   t h i s . _ a r m k _ l i s t [ i _ i d   & M A S K _ I D N U M ] . t l _ v e r t e x ; 
 
 	 	 c a s e   I D T Y P E _ N Y I D : 
 
 	 	 	 r e t u r n   t h i s . _ i d m k _ l i s t [ i _ i d   & M A S K _ I D N U M ] . t l _ v e r t e x ; 
 
 	 	 c a s e   I D T Y P E _ P S I D : 
 
                         r e t u r n   t h i s . _ p s m k _ l i s t [ i _ i d   &   M A S K _ I D N U M ] . t l _ v e r t e x ; 
 
 	 	 d e f a u l t : 
 
 	 	 	 t h r o w   n e w   N y A R E x c e p t i o n ( ) ; 
 
 	 	 } 	 	 
 
 	 } 
 
 	 / * * 
 
 	   *   S0n0peo002 $PSweE\$P0-[W0~0Y00
 
 	   *   @ p a r a m   i _ t h 
 
 	   *   2 $PSweE\$P0{ @ l i n k   N y A R M a r k e r S y s t e m # T H L E S H O L D _ A U T O } 0c[Y00h00Rtek0j00~0Y00
 
 	   * / 
 
 	 p u b l i c   v o i d   s e t B i n T h r e s h o l d ( i n t   i _ t h ) 
 
 	 { 
 
 	 	 t h i s . _ b i n _ t h r e s h o l d = i _ t h ; 
 
 	 } 
 
 	 / * * 
 
 	   *   S0n0peo00A R 000iQn00weE\$P0-[W0~0Y00
 
 	   *   S0S0g0-[W0_0$PN
Nn0 N^n00000iQW0~0Y00
 
 	   *   @ p a r a m   i _ v a l 
 
 	   *   weE\$P00 . 0 & l t ; n & l t ; 1 . 0 n0$P0c[Y00S0h00
 
 	   * / 
 
 	 p u b l i c   v o i d   s e t C o n f i d e n c e T h r e s h o l d ( d o u b l e   i _ v a l ) 
 
 	 { 
 
 	 	 t h i s . _ a r m k _ l i s t . s e t C o n f i c e n c e T h ( i _ v a l ) ; 
 
 	 } 
 
 	 / * * 
 
 	   *   S0n0peo00m1YBfn00000$P0c[W0~0Y00
 
 	   *   00000$Po00{ @ l i n k   N y A R M a r k e r S y s t e m # L O S T _ D E L A Y _ D E F A U L T } g0Y00
 
 	   *   M a r k e r S y s t e m o00S0S0g0c[W0_0Vpe0H0f0#}g00000iQg0M0j0D0h00000L0m1YW0_0h0$R[W0~0Y00
 
 	   *   @ p a r a m   i _ d e l a y 
 
 	   *   Vpe0c[W0~0Y00
 
 	   * / 
 
 	 p u b l i c   v o i d   s e t L o s t D e l a y ( i n t   i _ d e l a y ) 
 
 	 { 
 
 	 	 t h i s . l o s t _ t h = i _ d e l a y ; 
 
 	 } 
 
 	 p r i v a t e   l o n g   _ t i m e _ s t a m p = - 1 ; 
 
 	 p r o t e c t e d   I N y A R H i s t o g r a m A n a l y z e r _ T h r e s h o l d   _ h i s t _ t h ; 
 
 	 p r i v a t e   O n S q u a r e D e t e c t   _ o n _ s q _ h a n d l e r ; 
 
 	 / * * 
 
 	   *   S0n0peo00eQRW0_0000eQR$PK000000000n0rKa0feW0~0Y00
 
 	   *   peo00000000000K00;uP0S_W0f00000iQ0 N$R[0000000Qt0[LW0~0Y00
 
 	   *   @ p a r a m   i _ s e n s o r 
 
 	   *   { @ l i n k   M a r k e r S y s t e m } k0eQRY00;uP0+T00000000000
 
 	   *   @ t h r o w s   N y A R E x c e p t i o n   
 
 	   * / 
 
 	 p u b l i c   v o i d   u p d a t e ( N y A R S e n s o r   i _ s e n s o r ) 
 
 	 { 
 
 	 	 l o n g   t i m e _ s t a m p = i _ s e n s o r . g e t T i m e S t a m p ( ) ; 
 
 	 	 / / 000n00000000L0	YSW0f0D0j0Q00p0UO0W0j0D00
 
 	 	 i f ( t h i s . _ t i m e _ s t a m p = = t i m e _ s t a m p ) { 
 
 	 	 	 r e t u r n ; 
 
 	 	 } 
 
 	 	 i n t   t h = t h i s . _ b i n _ t h r e s h o l d = = T H L E S H O L D _ A U T O ? t h i s . _ h i s t _ t h . g e t T h r e s h o l d ( i _ s e n s o r . g e t G s H i s t o g r a m ( ) ) : t h i s . _ b i n _ t h r e s h o l d ; 
 
 	 	 / / ㉐g
 
 	 	 t h i s . _ t r a c k i n g _ l i s t . p r e p a r e ( ) ; 
 
 	 	 t h i s . _ i d m k _ l i s t . p r e p a r e ( ) ; 
 
 	 	 t h i s . _ a r m k _ l i s t . p r e p a r e ( ) ; 
 
                 t h i s . _ p s m k _ l i s t . p r e p a r e ( ) ; 
 
 	 	 / / iQ
 
                 t h i s . _ o n _ s q _ h a n d l e r . p r e p a r e ( i _ s e n s o r . g e t P e r s p e c t i v e C o p y ( ) ,   i _ s e n s o r . g e t G s I m a g e ( ) ,   t h ) ; 
 
                 t h i s . _ s q d e t e c t . d e t e c t M a r k e r C b ( i _ s e n s o r ,   t h ,   t h i s . _ o n _ s q _ h a n d l e r ) ; 
 
 
 
 	 	 / / iQP}gn0S fQt
 
 	 	 t h i s . _ t r a c k i n g _ l i s t . f i n i s h ( ) ; 
 
 	 	 t h i s . _ a r m k _ l i s t . f i n i s h ( ) ; 
 
 	 	 t h i s . _ i d m k _ l i s t . f i n i s h ( ) ; 
 
                 t h i s . _ p s m k _ l i s t . f i n i s h ( ) ; 
 
 	 	 / / gPR00000
 
                 f o r   ( i n t   i   =   t h i s . _ t r a c k i n g _ l i s t . C o u n t   -   1 ;   i   > =   0 ;   i - - ) 
 
                 { 
 
 	 	 	 T M a r k e r D a t a   i t e m = t h i s . _ t r a c k i n g _ l i s t [ i ] ; 
 
 	 	 	 i f ( i t e m . l o s t _ c o u n t > t h i s . l o s t _ t h ) { 
 
                                 / / #}g0iQg0M0j0K0c0_04XT
 
                                 i t e m . l i f e   =   0 ; / / ;m'`o f f 
 
                         } 
 
                         e l s e   i f   ( i t e m . s q   ! =   n u l l ) 
 
                         { 
 
                                 / / vMRn0s q 0iQg0M0_04XT
 
                                 i f   ( ! t h i s . _ t r a n s m a t . t r a n s M a t C o n t i n u e ( i t e m . s q ,   i t e m . m a r k e r _ o f f s e t ,   i t e m . t m a t ,   i t e m . l a s t _ p a r a m . l a s t _ e r r o r ,   i t e m . t m a t ,   i t e m . l a s t _ p a r a m ) ) 
 
                                 { 
 
                                         i f   ( ! t h i s . _ t r a n s m a t . t r a n s M a t ( i t e m . s q ,   i t e m . m a r k e r _ o f f s e t ,   i t e m . t m a t ,   i t e m . l a s t _ p a r a m ) ) 
 
                                         { 
 
                                                 i t e m . l i f e   =   0 ; / / ;m'`o f f 
 
                                         } 
 
                                 } 
 
                         } 
 
 	 	 } 
 
 	 	 / / T00000n0fe
 
 	 	 f o r ( i n t   i = t h i s . _ a r m k _ l i s t . C o u n t - 1 ; i > = 0 ; i - - ) { 
 
 	 	 	 T M a r k e r D a t a   t a r g e t = t h i s . _ a r m k _ l i s t [ i ] ; 
 
 	 	 	 i f ( t a r g e t . l o s t _ c o u n t = = 0 ) { 
 
 	 	 	 	 t a r g e t . t i m e _ s t a m p = t i m e _ s t a m p ; 
 
                                 / / l i f e L01 ( YBfiQn0h0M0n00) 
 
                                 i f   ( t a r g e t . l i f e   ! =   1 ) 
 
                                 { 
 
                                         c o n t i n u e ; 
 
                                 } 
 
                                 t h i s . _ t r a n s m a t . t r a n s M a t ( t a r g e t . s q ,   t a r g e t . m a r k e r _ o f f s e t ,   t a r g e t . t m a t ,   t a r g e t . l a s t _ p a r a m ) ; 
 
 	 	 	 } 
 
 	 	 } 
 
 	 	 f o r ( i n t   i = t h i s . _ i d m k _ l i s t . C o u n t - 1 ; i > = 0 ; i - - ) { 
 
 	 	 	 T M a r k e r D a t a   t a r g e t = t h i s . _ i d m k _ l i s t [ i ] ; 
 
 	 	 	 i f ( t a r g e t . l o s t _ c o u n t = = 0 ) { 
 
 	 	 	 	 t a r g e t . t i m e _ s t a m p = t i m e _ s t a m p ; 
 
                                 / / l i f e L01 ( YBfiQn0h0M0n00) 
 
                                 i f   ( t a r g e t . l i f e   ! =   1 ) 
 
                                 { 
 
                                         c o n t i n u e ; 
 
                                 } 
 
                                 t h i s . _ t r a n s m a t . t r a n s M a t ( t a r g e t . s q ,   t a r g e t . m a r k e r _ o f f s e t ,   t a r g e t . t m a t ,   t a r g e t . l a s t _ p a r a m ) ; 
 
                         } 
 
 	 	 } 
 
                 f o r   ( i n t   i   =   t h i s . _ p s m k _ l i s t . C o u n t   -   1 ;   i   > =   0 ;   i - - ) 
 
                 { 
 
 	 	 	 T M a r k e r D a t a   t a r g e t = t h i s . _ p s m k _ l i s t [ i ] ; 
 
 	 	 	 i f ( t a r g e t . l o s t _ c o u n t = = 0 ) { 
 
 	 	 	 	 t a r g e t . t i m e _ s t a m p = t i m e _ s t a m p ; 
 
                                 / / l i f e L01 ( YBfiQn0h0M0n00) 
 
                                 i f   ( t a r g e t . l i f e   ! =   1 ) 
 
                                 { 
 
                                         c o n t i n u e ; 
 
                                 } 
 
                                 t h i s . _ t r a n s m a t . t r a n s M a t ( t a r g e t . s q ,   t a r g e t . m a r k e r _ o f f s e t ,   t a r g e t . t m a t ,   t a r g e t . l a s t _ p a r a m ) ; 
 
                         } 
 
 	 	 } 
 
 	 	 / / ㉐g/ 
 
 	 	 / / 00000000fe
 
 	 	 t h i s . _ t i m e _ s t a m p = t i m e _ s t a m p ; 
 
 	 	 t h i s . _ l a s t _ g s _ t h = t h ; 
 
 	 } 
 
 
 
 } 
 
 
 
 / * * 
 
   *   000000pen0=(u0000
 
   *   S0n0000o00{ @ l i n k   N y A R M a r k e r S y s t e m } K00000000k0OD0~0Y00
 
   * / 
 
 c l a s s   O n S q u a r e D e t e c t   :   N y A R S q u a r e C o n t o u r D e t e c t o r . C b H a n d l e r 
 
 { 
 
 	 p r i v a t e   T r a c k i n g L i s t   _ r e f _ t r a c k i n g _ l i s t ; 
 
 	 p r i v a t e   A R M a r k e r L i s t   _ r e f _ a r m k _ l i s t ; 
 
 	 p r i v a t e   N y I d L i s t   _ r e f _ i d m k _ l i s t ; 
 
 	 p r i v a t e   A R P l a y C a r d L i s t   _ r e f _ p s m k _ l i s t ; 
 
 
 
         p u b l i c   S q u a r e S t a c k   _ s q _ s t a c k ; 
 
         p u b l i c   I N y A R P e r s p e c t i v e C o p y   _ r e f _ i n p u t _ r f b ; 
 
 	 p u b l i c   I N y A R G r a y s c a l e R a s t e r   _ r e f _ i n p u t _ g s ; 
 
 	 p u b l i c   i n t   _ r e f _ t h ; 
 
 	 
 
 	 
 
 	 p r i v a t e   N y A R C o o r d 2 L i n e a r   _ c o o r d l i n e ; 
 
         p u b l i c   O n S q u a r e D e t e c t ( 
 
                 I N y A R M a r k e r S y s t e m C o n f i g   i _ c o n f i g , 
 
                 A R M a r k e r L i s t   i _ a r m k _ l i s t ,   N y I d L i s t   i _ i d m k _ l i s t ,   A R P l a y C a r d L i s t   i _ p s m k _ l i s t , 
 
 	 	 T r a c k i n g L i s t   i _ t r a c k i n g _ l i s t , i n t   i _ i n i t i a l _ s t a c k _ s i z e ) 
 
         { 
 
 	 	 t h i s . _ c o o r d l i n e = n e w   N y A R C o o r d 2 L i n e a r ( i _ c o n f i g . g e t N y A R P a r a m ( ) . g e t S c r e e n S i z e ( ) , i _ c o n f i g . g e t N y A R P a r a m ( ) . g e t D i s t o r t i o n F a c t o r ( ) ) ; 
 
 	 	 t h i s . _ r e f _ a r m k _ l i s t = i _ a r m k _ l i s t ; 
 
 	 	 t h i s . _ r e f _ i d m k _ l i s t = i _ i d m k _ l i s t ; 
 
 	 	 t h i s . _ r e f _ p s m k _ l i s t = i _ p s m k _ l i s t ; 
 
 	 	 t h i s . _ r e f _ t r a c k i n g _ l i s t = i _ t r a c k i n g _ l i s t ; 
 
 	 	 / / TBfk0$R[_a0k0g0M00wb_n0pe
 
                 t h i s . _ s q _ s t a c k   =   n e w   S q u a r e S t a c k ( i _ i n i t i a l _ s t a c k _ s i z e ) ; 
 
         } 
 
 	 / * * 
 
 	   *   TBfk0iQY00000n0 g'Ype0-[W0~0Y00
 
 	   *   peo00\j0O0h00i _ m a x _ n u m b e r _ o f _ m a r k e r N
Nn00000TBfk0iQg0M000F0k00000000-[W0~0Y00
 
 	   *   @ t h r o w s   N y A R E x c e p t i o n   
 
 	   * / 
 
 	 p u b l i c   v o i d   s e t M a x D e t e c t M a r k e r C a p a c i t y ( i n t   i _ m a x _ n u m b e r _ o f _ m a r k e r ) 
 
 	 { 
 
 	 	 / / p r e p a r e   e n o u g h   s t a c k   s i z e . 
 
 	 	 i f ( t h i s . _ s q _ s t a c k . g e t A r r a y S i z e ( ) < i _ m a x _ n u m b e r _ o f _ m a r k e r ) { 
 
 	 	 	 t h i s . _ s q _ s t a c k = n e w   S q u a r e S t a c k ( i _ m a x _ n u m b e r _ o f _ m a r k e r + 5 ) ; 
 
 	 	 } 
 
 	 	 r e t u r n ; 
 
 	 } 
 
 	 / * * 
 
 	   *   { @ l i n k   # d e t e c t M a r k e r C a l l b a c k } 000MRk01 ^`0Q0|Ts0QW0f0O0`0U0D00
 
 	   *   @ p a r a m   i _ m a x _ d e t e c t _ m a r k e r 
 
 	   *   @ p a r a m   i _ p c o p y 
 
 	   *   @ p a r a m   i _ g s 
 
 	   *   @ p a r a m   t h 
 
 	   *   @ t h r o w s   N y A R E x c e p t i o n 
 
 	   * / 
 
 	 p u b l i c   v o i d   p r e p a r e ( I N y A R P e r s p e c t i v e C o p y   i _ p c o p y ,   I N y A R G r a y s c a l e R a s t e r   i _ g s ,   i n t   t h ) 
 
 	 { 
 
 	 	 t h i s . _ r e f _ i n p u t _ r f b = i _ p c o p y ; 
 
 	 	 t h i s . _ r e f _ i n p u t _ g s = i _ g s ; 
 
 	 	 t h i s . _ r e f _ t h = t h ; 
 
 	 	 / /   i n i t i a l i z e   s q u a r e   s t a c k 
 
 	 	 t h i s . _ s q _ s t a c k . c l e a r ( ) ; 	 	 
 
 	 } 
 
 	 p u b l i c   v o i d   d e t e c t M a r k e r C a l l b a c k ( N y A R I n t C o o r d i n a t e s   i _ c o o r d , i n t [ ]   i _ v e r t e x _ i n d e x ) 
 
 	 { 
 
 	 	 / / h00B0H0Z0S q u a r e 00000N}
 
 	 	 S q u a r e S t a c k . I t e m   s q _ t m p = t h i s . _ s q _ s t a c k . p r e P u s h ( ) ; 
 
 	 	 / / xOg0M0j0D0( 1 d0n0d e t e c t o r L0pen0P܈0_04XT( TX0A R 000L0YO0B004XTj0i0) k0zvuY00S0h0L0B000) 
 
 	 	 i f ( s q _ t m p = = n u l l ) { 
 
 	 	 	 r e t u r n ; 
 
 	 	 } 
 
 
 
 	 	 / / ,n^jpn02
 
 	 	 f o r ( i n t   i 2 = 0 ; i 2 < 4 ; i 2 + + ) { 
 
 	 	 	 s q _ t m p . o b _ v e r t e x [ i 2 ] . s e t V a l u e ( i _ c o o r d . i t e m s [ i _ v e r t e x _ i n d e x [ i 2 ] ] ) ; 
 
 	 	 } 
 
 	 	 / / pR^0{
 
 	 	 s q _ t m p . v e r t e x _ a r e a . s e t A r e a R e c t ( s q _ t m p . o b _ v e r t e x , 4 ) ; 
 
 	 	 / / p^jn0-N_0{
 
 	 	 s q _ t m p . c e n t e r 2 d . s e t C e n t e r P o s ( s q _ t m p . o b _ v e r t e x , 4 ) ; 
 
 	 	 / / wb_bMz
 
 	 	 s q _ t m p . r e c t _ a r e a = s q _ t m p . v e r t e x _ a r e a . w * s q _ t m p . v e r t e x _ a r e a . h ; 
 
 
 
 	 	 b o o l   i s _ t a r g e t _ m a r k e r = f a l s e ; 
 
 	 	 f o r ( ; ; ) { 
 
 	 	 	 / / 000000[aK0xY000
 
 	 	 	 i f ( t h i s . _ r e f _ t r a c k i n g _ l i s t . u p d a t e ( s q _ t m p ) ) { 
 
 	 	 	 	 / / 000000[aj000000
 
 	 	 	 	 i s _ t a r g e t _ m a r k e r = t r u e ; 
 
 	 	 	 	 b r e a k ; 
 
 	 	 	 } 
 
 	 	 	 / / @ t o d o   pe000Bfk00000000nn0a r m a r k e r 0c"}[aYk0Qegj0D0
 
 	 	 	 
 
 	 	 	 / / n y I d 000n0yr[( I D 000n0yr[o0S0S0g0[P}Y000) 
 
                         i f   ( t h i s . _ r e f _ i d m k _ l i s t . C o u n t   >   0 ) 
 
                         { 
 
 	 	 	 	 i f ( t h i s . _ r e f _ i d m k _ l i s t . u p d a t e ( t h i s . _ r e f _ i n p u t _ g s , s q _ t m p ) ) { 
 
 	 	 	 	 	 i s _ t a r g e t _ m a r k e r = t r u e ; 
 
 	 	 	 	 	 b r e a k ; / / i d 0000yr[
 
 	 	 	 	 } 
 
 	 	 	 } 
 
 	 	 	 / / P S A R 000n0yr[( I D 000n0yr[o0S0S0g0[P}Y000) 
 
 	 	 	 i f ( t h i s . _ r e f _ p s m k _ l i s t . C o u n t > 0 ) { 
 
 	 	 	 	 i f ( t h i s . _ r e f _ p s m k _ l i s t . u p d a t e ( t h i s . _ r e f _ i n p u t _ g s , s q _ t m p ) ) { 
 
 	 	 	 	 	 i s _ t a r g e t _ m a r k e r = t r u e ; 
 
 	 	 	 	 	 b r e a k ; / / i d 0000yr[
 
 	 	 	 	 } 
 
 	 	 	 } 
 
 	 	 	 / / A R 000n0yr[
 
 	 	 	 i f ( t h i s . _ r e f _ a r m k _ l i s t . C o u n t > 0 ) { 
 
 	 	 	 	 / / weE\$Pk0001 Pn0000k0[W0f0pen0P܈L0d0K00S0h00B000
 
 	 	 	 	 i f ( t h i s . _ r e f _ a r m k _ l i s t . u p d a t e ( t h i s . _ r e f _ i n p u t _ r f b , s q _ t m p ) ) { 
 
 	 	 	 	 	 i s _ t a r g e t _ m a r k e r = t r u e ; 
 
 	 	 	 	 	 b r e a k ; 
 
 	 	 	 	 } 
 
 	 	 	 } 
 
 	 	 	 b r e a k ; 
 
 	 	 } 
 
 	 	 / / S0n0wb_L0iQ[aj000wb_`1X0|[k0Q{
 
 	 	 i f ( i s _ t a r g e t _ m a r k e r ) { 
 
 	 	 	 / / wb_o0iQ[ak0000U00f0D000
 
 	 	 	 f o r ( i n t   i 2 = 0 ; i 2 < 4 ; i 2 + + ) { 
 
 	 	 	 	 t h i s . _ c o o r d l i n e . c o o r d 2 L i n e ( i _ v e r t e x _ i n d e x [ i 2 ] , i _ v e r t e x _ i n d e x [ ( i 2 + 1 ) % 4 ] , i _ c o o r d , s q _ t m p . l i n e [ i 2 ] ) ; 
 
 	 	 	 } 
 
 	 	 	 f o r   ( i n t   i 2   =   0 ;   i 2   <   4 ;   i 2 + + )   { 
 
 	 	 	 	 / / v}TXn0Np{
 
 	 	 	 	 i f ( ! s q _ t m p . l i n e [ i 2 ] . c r o s s P o s ( s q _ t m p . l i n e [ ( i 2   +   3 )   %   4 ] , s q _ t m p . s q v e r t e x [ i 2 ] ) ) { 
 
 	 	 	 	 	 t h r o w   n e w   N y A R E x c e p t i o n ( ) ; / / ~0Z0j0D00B00H0j0D00
 
 	 	 	 	 } 
 
 	 	 	 } 
 
 	 	 } e l s e { 
 
 	 	 	 / / S0n0wb_o0iQ[ak0000U00j0K0c0_0n0g00d
 
 	 	 	 t h i s . _ s q _ s t a c k . p o p ( ) ; 
 
 	 	 } 
 
 	 } 
 
 } 
 
 
 
 
 
 
 
 
 
 c l a s s   S q u a r e D e t e c t   :   I N y A R M a r k e r S y s t e m S q u a r e D e t e c t 
 
 { 
 
 	 p r i v a t e   N y A R S q u a r e C o n t o u r D e t e c t o r _ R l e   _ s d ; 
 
 	 p u b l i c   S q u a r e D e t e c t ( I N y A R M a r k e r S y s t e m C o n f i g   i _ c o n f i g ) 
 
 	 { 
 
 	 	 t h i s . _ s d = n e w   N y A R S q u a r e C o n t o u r D e t e c t o r _ R l e ( i _ c o n f i g . g e t S c r e e n S i z e ( ) ) ; 
 
 	 } 
 
 	 p u b l i c   v o i d   d e t e c t M a r k e r C b ( N y A R S e n s o r   i _ s e n s o r , i n t   i _ t h , N y A R S q u a r e C o n t o u r D e t e c t o r . C b H a n d l e r   i _ h a n d l e r ) 
 
 	 { 
 
 	 	 t h i s . _ s d . d e t e c t M a r k e r ( i _ s e n s o r . g e t G s I m a g e ( ) ,   i _ t h , i _ h a n d l e r ) ; 
 
 	 } 
 
 } 
 
 
 
 } 