/ *   
 
   *   P R O J E C T :   N y A R T o o l k i t C S ( E x t e n s i o n ) 
 
   *   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
   *   T h e   N y A R T o o l k i t C S   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   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 . p r o c e s s o r 
 
 { 
 
 
 
 
 
         / * * 
 
           *   S0n0000o001 Pn0A R 0000iQY00Qt0000000000k0Y00000000[W0~0Y00
 
           *   000n0Qs0yR0mn00]000000peg0wY00S0h0L0g0M0~0Y00
 
           *   000k0o000000000000L0B000]0S0k0pe.z^n00000{v2Y00S0h0L0g0M0~0Y00
 
           *    Nd0n0000L0d0K00h0000000o0}}W0f0TX000001 d0`0Q0XW0}Q001YF0~0g0n0o0Nn00000XW0~0[000
 
           *   < p > 0000n0f- 
 
           *   S0n0000k0o00Pn0]000000peL0B00~0Y00{ @ l i n k   S i n g l e A R M a r k e r P r o c e s s e r } o00NNn000000g0S0000|Ts0QW0~0Y00
 
           *   000o0}b000g0S000n0pek0[ň0LD000000ƙRn0000000000\Obg0M0~0Y00
 
           *   < u l > 
 
           *   < l i >  0{ @ l i n k   # o n E n t e r H a n d l e r }   -   {v2W0_0000L0R0f0d0K0c0_0Bfk0|Ts0QU00~0Y00S0S0k00zvW0_0000k0[_W0_0RgQt0fM0~0Y00
 
           *   < l i >  0{ @ l i n k   # o n L e a v e H a n d l e r }   -   iQ-Nn0000L0m1YW0_0Bfk0|Ts0QU00~0Y00S0S0k00000n0B}gQt0fM0~0Y00
 
           *   < l i >  0{ @ l i n k   # o n U p d a t e H a n d l e r } -   iQ-Nn0000n0MOnYRL0feU00_0h0M0k0|Ts0QU00~0Y00S0S0k00000MOnn0feQt0fM0~0Y00
 
           *   < / u l > 
 
           *   < p > yr'`- 
 
           *   < u l > 
 
           *   < l i > RweE\$Pte0LF0_000tXIQn0	YSk0'`L0B00~0Y00
 
           *   < l i > pen0000L0;uPk0B004XTo00 NjuR0k0XW0_00000*QHQW0f0XW0~0Y00
 
           *   < l i > pen0T N0000000L0;uPk0B004XTo00:S%Rg0M0~0[000
 
           *   < / u l > 
 
           *   < / p > 
 
 
 
           * / 
 
         p u b l i c   a b s t r a c t   c l a s s   S i n g l e A R M a r k e r P r o c e s s e r 
 
         { 
 
                 / * * 
 
                   *   d e t e c t M a r k e r n0000000pe
 
                   * / 
 
                 p r i v a t e   c l a s s   D e t e c t S q u a r 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 ,   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 
 
                 { 
 
                         / / lQ00000
 
                         p u b l i c   r e a d o n l y   N y A R S q u a r e   s q u a r e   =   n e w   N y A R S q u a r e ( ) ; 
 
                         p u b l i c   d o u b l e   c o n f i d e n c e   =   0 . 0 ; 
 
                         p u b l i c   i n t   c o d e _ i n d e x   =   - 1 ; 
 
                         p u b l i c   d o u b l e   c f _ t h r e s h o l d _ n e w   =   0 . 5 0 ; 
 
                         p u b l i c   d o u b l e   c f _ t h r e s h o l d _ e x i s t   =   0 . 3 0 ; 
 
 
 
                         / / Sgq
 
                         p r i v a t e   I N y A R R g b R a s t e r   _ r e f _ r a s t e r ; 
 
                         / / @b	g000000
 
                         p r i v a t e   I N y A R C o l o r P a t t   _ i n s t _ p a t t ; 
 
                         p r i v a t e   N y A R M a t c h P a t t D e v i a t i o n C o l o r D a t a   _ d e v i a t i o n _ d a t a ; 
 
                         p r i v a t e   N y A R M a t c h P a t t _ C o l o r _ W I T H O U T _ P C A [ ]   _ m a t c h _ p a t t ; 
 
                         p r i v a t e   r e a d o n l y   N y A R M a t c h P a t t R e s u l t   _ _ d e t e c t M a r k e r L i t e _ m r   =   n e w   N y A R M a t c h P a t t R e s u l t ( ) ; 
 
                         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   D e t e c t S q u a r e ( N y A R P a r a m   i _ p a r a m ) :   b a s e ( i _ p a r a m . g e t S c r e e n S i z e ( ) ) 
 
                         { 
 
                                 t h i s . _ m a t c h _ p a t t   =   n u l l ; 
 
                                 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 _ p a r a m . g e t S c r e e n S i z e ( ) ,   i _ p a r a m . g e t D i s t o r t i o n F a c t o r ( ) ) ; 
 
                                 r e t u r n ; 
 
                         } 
 
                         p u b l i c   v o i d   s e t N y A R C o d e T a b l e ( N y A R C o d e [ ]   i _ r e f _ c o d e ,   i n t   i _ c o d e _ r e s o l u t i o n ) 
 
                         { 
 
                                 / * u n m a n a g e d g0[ňY00h0M0o00S0S0g00000>e0Y00S0h00* / 
 
                                 t h i s . _ d e v i a t i o n _ d a t a   =   n e w   N y A R M a t c h P a t t D e v i a t i o n C o l o r D a t a ( i _ c o d e _ r e s o l u t i o n ,   i _ c o d e _ r e s o l u t i o n ) ; 
 
                                 t h i s . _ i n s t _ p a t t   =   n e w   N y A R C o l o r P a t t _ P e r s p e c t i v e ( i _ c o d e _ r e s o l u t i o n ,   i _ c o d e _ r e s o l u t i o n ,   4 ,   2 5 ) ; 
 
                                 t h i s . _ m a t c h _ p a t t   =   n e w   N y A R M a t c h P a t t _ C o l o r _ W I T H O U T _ P C A [ i _ r e f _ c o d e . L e n g t h ] ; 
 
                                 f o r   ( i n t   i   =   0 ;   i   <   i _ r e f _ c o d e . L e n g t h ;   i + + ) 
 
                                 { 
 
                                         t h i s . _ m a t c h _ p a t t [ i ]   =   n e w   N y A R M a t c h P a t t _ C o l o r _ W I T H O U T _ P C A ( i _ r e f _ c o d e [ i ] ) ; 
 
                                 } 
 
                         } 
 
                         p r i v a t e   N y A R I n t P o i n t 2 d [ ]   _ _ r e f _ v e r t e x   =   n e w   N y A R I n t P o i n t 2 d [ 4 ] ; 
 
                         p r i v a t e   i n t   _ t a r g e t _ i d ; 
 
                         / * * 
 
                           *   I n i t i a l i z e   c a l l   b a c k   h a n d l e r . 
 
                           * / 
 
                         p u b l i c   v o i d   i n i t ( 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 _ t a r g e t _ i d ) 
 
                         { 
 
                                 t h i s . _ r e f _ r a s t e r   =   i _ r a s t e r ; 
 
                                 t h i s . _ t a r g e t _ i d   =   i _ t a r g e t _ i d ; 
 
                                 t h i s . c o d e _ i n d e x   =   - 1 ; 
 
                                 t h i s . c o n f i d e n c e   =   d o u b l e . M i n V a l u e ; 
 
                         } 
 
 
 
                         / * * 
 
                           *   wb_L0NK00_0s0k0|Ts0QU00~0Y00
 
                           *   zvW0_0wb_n000000igW0f00eMO0naW0_0p0000xOW0~0Y00
 
                           * / 
 
                         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 ) 
 
                         { 
 
                                 i f   ( t h i s . _ m a t c h _ p a t t   = =   n u l l ) 
 
                                 { 
 
                                         r e t u r n ; 
 
                                 } 
 
                                 / / *퐧^jK00p000k0	Yc
 
                                 N y A R I n t P o i n t 2 d [ ]   v e r t e x   =   t h i s . _ _ r e f _ v e r t e x ; 
 
                                 v e r t e x [ 0 ]   =   i _ c o o r d . i t e m s [ i _ v e r t e x _ i n d e x [ 0 ] ] ; 
 
                                 v e r t e x [ 1 ]   =   i _ c o o r d . i t e m s [ i _ v e r t e x _ i n d e x [ 1 ] ] ; 
 
                                 v e r t e x [ 2 ]   =   i _ c o o r d . i t e m s [ i _ v e r t e x _ i n d e x [ 2 ] ] ; 
 
                                 v e r t e x [ 3 ]   =   i _ c o o r d . i t e m s [ i _ v e r t e x _ i n d e x [ 3 ] ] ; 
 
 
 
                                 / / ;uP0S_
 
                                 i f   ( ! t h i s . _ i n s t _ p a t t . p i c k F r o m R a s t e r ( t h i s . _ r e f _ r a s t e r ,   v e r t e x ) ) 
 
                                 { 
 
                                         r e t u r n ; / / S_1YWe
 
                                 } 
 
                                 / / S_00000000]R000k0	YcW0f0UOY000
 
                                 t h i s . _ d e v i a t i o n _ d a t a . s e t R a s t e r ( t h i s . _ i n s t _ p a t t ) ; 
 
 
 
 
 
                                 / / c o d e _ i n d e x , d i r , c 1 k00000_00
 
                                 N y A R M a t c h P a t t R e s u l t   m r   =   t h i s . _ _ d e t e c t M a r k e r L i t e _ m r ; 
 
                                 i n t   l c o d e _ i n d e x   =   0 ; 
 
                                 i n t   d i r   =   0 ; 
 
                                 d o u b l e   c 1   =   0 ; 
 
                                 f o r   ( i n t   i   =   0 ;   i   <   t h i s . _ m a t c h _ p a t t . L e n g t h ;   i + + ) 
 
                                 { 
 
                                         t h i s . _ m a t c h _ p a t t [ i ] . e v a l u a t e ( t h i s . _ d e v i a t i o n _ d a t a ,   m r ) ; 
 
                                         d o u b l e   c 2   =   m r . c o n f i d e n c e ; 
 
                                         i f   ( c 1   <   c 2 ) 
 
                                         { 
 
                                                 l c o d e _ i n d e x   =   i ; 
 
                                                 c 1   =   c 2 ; 
 
                                                 d i r   =   m r . d i r e c t i o n ; 
 
                                         } 
 
                                 } 
 
 
 
                                 / / XQt
 
                                 i f   ( t h i s . _ t a r g e t _ i d   = =   - 1 ) 
 
                                 {   / /   000*gX
 
                                         / / s(Wo0*gX
 
                                         i f   ( c 1   <   t h i s . c f _ t h r e s h o l d _ n e w ) 
 
                                         { 
 
                                                 r e t u r n ; 
 
                                         } 
 
                                         i f   ( t h i s . c o n f i d e n c e   >   c 1 ) 
 
                                         { 
 
                                                 / /    N^L0NOD00
 
                                                 r e t u r n ; 
 
                                         } 
 
                                         / / XW0f0D00000I D 0OX[
 
                                         t h i s . c o d e _ i n d e x   =   l c o d e _ i n d e x ; 
 
                                 } 
 
                                 e l s e 
 
                                 { 
 
                                         / / s(Wo0000X-N	 	 	 	 
 
                                         / /   s(Wn00000XW0_0K0
 
                                         i f   ( l c o d e _ i n d e x   ! =   t h i s . _ t a r g e t _ i d ) 
 
                                         { 
 
                                                 / /   X-Nn0000g0o0j0D0n0g0!q
 
                                                 r e t u r n ; 
 
                                         } 
 
                                         / / X-Nn0$P00'YM0D0K0
 
                                         i f   ( c 1   <   t h i s . c f _ t h r e s h o l d _ e x i s t ) 
 
                                         { 
 
                                                 r e t u r n ; 
 
                                         } 
 
                                         / / s(Wn0P܈000 N^o0'YM0D0K0
 
                                         i f   ( t h i s . c o n f i d e n c e   >   c 1 ) 
 
                                         { 
 
                                                 r e t u r n ; 
 
                                         } 
 
                                         t h i s . c o d e _ i n d e x   =   t h i s . _ t a r g e t _ i d ; 
 
                                 } 
 
                                 / / eW0O0X0~0_0o0}}X-Nk0feL0B0c0_0h0M0`0Q00S q u a r e `1X0feY000
 
                                 / / 00K00HQo0S0n0agNg0W0K0[LU00j0D00
 
 
 
                                 / /  Nsn0ؚD0wb_L0B00p00eMO0naW0f0p`1X0\Ob
 
                                 t h i s . c o n f i d e n c e   =   c 1 ; 
 
                                 N y A R S q u a r e   s q   =   t h i s . s q u a r e ; 
 
                                 / / d i r e c t i o n 0naW0f00s q u a r e 0feY000
 
                                 f o r   ( i n t   i   =   0 ;   i   <   4 ;   i + + ) 
 
                                 { 
 
                                         i n t   i d x   =   ( i   +   4   -   d i r )   %   4 ; 
 
                                         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 d x ] ,   i _ v e r t e x _ i n d e x [ ( i d x   +   1 )   %   4 ] ,   i _ c o o r d ,   s q . l i n e [ i ] ) ; 
 
                                 } 
 
                                 f o r   ( i n t   i   =   0 ;   i   <   4 ;   i + + ) 
 
                                 { 
 
                                         / / v}TXn0Np{
 
                                         i f   ( ! s q . l i n e [ i ] . c r o s s P o s ( s q . l i n e [ ( i   +   3 )   %   4 ] ,   s q . s q v e r t e x [ i ] ) ) 
 
                                         { 
 
                                                 t h r o w   n e w   N y A R E x c e p t i o n ( ) ; / / S0S0n0000_0^Y00j000000000k0Y00p0O K 
 
                                         } 
 
                                 } 
 
                         } 
 
                 } 
 
                 / * *  00000L01uk0OH0000	Ypeg0Y00* / 
 
                 p u b l i c   o b j e c t   t a g ; 
 
 
 
                 p r i v a t e   i n t   _ l o s t _ d e l a y _ c o u n t   =   0 ; 
 
                 p r i v a t e   i n t   _ l o s t _ d e l a y   =   5 ; 
 
                 / * *   YR	YcLRn0{000000* / 
 
                 p r o t e c t e d   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   N y A R R e c t O f f s e t   _ o f f s e t ; 
 
                 / /   [ A R ] iQP}gn0OX[(u
 
                 p r i v a t e   N y A R G r a y s c a l e R a s t e r   _ g s _ r a s t e r ; 
 
 
 
 
 
                 p r o t e c t e d   i n t   _ c u r r e n t _ a r c o d e _ i n d e x   =   - 1 ; 
 
 
 
 
 
                 / * * 
 
                   *   0000000000000
 
                   *   0000}bY00h0M0o00S0n000000000|Ts0QW0_0_k00{ @ l i n k   # i n i t I n s t a n c e } peg0000000n0RgSQt0[ňW0~0Y00
 
                   * / 
 
                 p r o t e c t e d   S i n g l e A R M a r k e r P r o c e s s e r ( ) 
 
                 { 
 
                         r e t u r n ; 
 
                 } 
 
 
 
                 p r i v a t e   b o o l   _ i n i t i a l i z e d   =   f a l s e ; 
 
                 / * * 
 
                   *   S0n0peo000000000RgSW0~0Y00
 
                   *   }bHQn0000K00|Ts0QW0f0O0`0U0D00
 
                   *   @ p a r a m   i _ p a r a m 
 
                   *   000000000000000S0n0000o00{ @ l i n k   # d e t e c t M a r k e r } k0eQRY00;uPh0TX0000g0B00_L0B00~0Y00
 
                   *   @ 
 
                   * / 
 
                 p r o t e c t e d   v o i d   i n i t I n s t a n c e ( N y A R P a r a m   i _ p a r a m ) 
 
                 { 
 
                         / / RgSn
 
                         D e b u g . A s s e r t ( t h i s . _ i n i t i a l i z e d   = =   f a l s e ) ; 
 
 
 
                         N y A R I n t S i z e   s c r _ s i z e   =   i _ p a r a m . g e t S c r e e n S i z e ( ) ; 
 
                         / /   ㉐g0000000\O0
 
                         t h i s . _ t r a n s m a t   =   n e w   N y A R T r a n s M a t ( i _ p a r a m ) ; 
 
                         t h i s . _ t h d e t e c t   =   n e w   N y A R H i s t o g r a m A n a l y z e r _ S l i d e P T i l e ( 1 5 ) ; 
 
 
 
                         / /   $P;uP00000\O0
 
                         t h i s . _ g s _ r a s t e r   =   n e w   N y A R G r a y s c a l e R a s t e r ( s c r _ s i z e . w ,   s c r _ s i z e . h ) ; 
 
                         t h i s . _ i n i t i a l i z e d   =   t r u e ; 
 
                         / / 0000000000
 
                         t h i s . _ d e t e c t m a r k e r   =   n e w   D e t e c t S q u a r e ( i _ p a r a m ) ; 
 
                         t h i s . _ o f f s e t   =   n e w   N y A R R e c t O f f s e t ( ) ; 
 
                         r e t u r n ; 
 
                 } 
 
 
 
                 / * * 
 
                   *   S0n0peo00iQY0000000000000n0MR0c[W0~0Y00  
 
                   *   0000000k0o00MRn0HQ-K0000 K00Y~00I D juS0rR0S_f000~0Y00
 
                   *   S0n0I D o00{ @ l i n k   # o n E n t e r H a n d l e r } 00000000k0wU000I D juSk0[_W000000000n0X%Rk0OD0~0Y00
 
                   *   @ p a r a m   i _ r e f _ c o d e _ t a b l e 
 
                   *   00000000000k0000Y00MRg0Y00MRk0B000000000n0P^o00i _ c o d e _ r e s o l u t i o n k0 NW0f0D00_L0B00~0Y00
 
                   *   @ p a r a m   i _ c o d e _ r e s o l u t i o n 
 
                   *   0000000&~*jP^g0Y00
 
                   *   @ p a r a m   i _ m a r k e r _ w i d t h 
 
                   *   < p > 00: 
 
                   *   0000iQW0f0D00rKag0pe0[LY00h000000wj0W0k00X-Nn000001YD0~0Y00
 
                   *   < / p > 
 
                   *   @   
 
                   * / 
 
                 p u b l i c   v o i d   s e t A R C o d e T a b l e ( N y A R C o d e [ ]   i _ r e f _ c o d e _ t a b l e ,   i n t   i _ c o d e _ r e s o l u t i o n ,   d o u b l e   i _ m a r k e r _ w i d t h ) 
 
                 { 
 
                         i f   ( t h i s . _ c u r r e n t _ a r c o d e _ i n d e x   ! =   - 1 ) 
 
                         { 
 
                                 / /   7_6R0000
 
                                 r e s e t ( t r u e ) ; 
 
                         } 
 
                         / / iQY000000000`1X0iQhV0\O0vY00( 1 00004 0000000000, 000n00000Wo05 0 % ) 
 
                         t h i s . _ d e t e c t m a r k e r . s e t N y A R C o d e T a b l e ( i _ r e f _ c o d e _ t a b l e ,   i _ c o d e _ r e s o l u t i o n ) ; 
 
                         t h i s . _ o f f s e t . s e t S q u a r e ( i _ m a r k e r _ w i d t h ) ; 
 
                         r e t u r n ; 
 
                 } 
 
                 / * * 
 
                   *   S0n0peo00000000n0rKa00000W0~0Y00
 
                   *   rKa00000Y00h000W00000XW0f0D004XTk0o00{ @ l i n k   # o n L e a v e H a n d l e r } 00000000L0000U000*gXrKak0j00~0Y00
 
                   *   @ p a r a m   i _ i s _ f o r c e 
 
                   *   7_6R0000t r u e k0Y00h000000wj0W0k0000XrKa00000W0~0Y00
 
                   * / 
 
                 p u b l i c   v o i d   r e s e t ( b o o l   i _ i s _ f o r c e ) 
 
                 { 
 
                         i f   ( t h i s . _ c u r r e n t _ a r c o d e _ i n d e x   ! =   - 1   & &   i _ i s _ f o r c e   = =   f a l s e ) 
 
                         { 
 
                                 / /   7_6RfM0cH0g0j0Q00p00000000
 
                                 t h i s . o n L e a v e H a n d l e r ( ) ; 
 
                         } 
 
                         / /   000000000000
 
                         t h i s . _ c u r r e n t _ a r c o d e _ i n d e x   =   - 1 ; 
 
                         r e t u r n ; 
 
                 } 
 
                 p r i v a t e   D e t e c t S q u a r e   _ d e t e c t m a r k e r ; 
 
 
 
                 p r i v a t e   I N y A R R a s t e r   _ l a s t _ i n p u t _ r a s t e r   =   n u l l ; 
 
 
 
                 p r i v a t e   I N y A R R g b 2 G s F i l t e r   _ t o g s _ f i l t e r ; 
 
                 p r i v a t e   I N y A R H i s t o g r a m F r o m R a s t e r   _ h i s t m a k e r ; 
 
                 p r i v a t e   N y A R H i s t o g r a m A n a l y z e r _ S l i d e P T i l e   _ t h d e t e c t ; 
 
                 p r i v a t e   N y A R H i s t o g r a m   _ h i s t   =   n e w   N y A R H i s t o g r a m ( 2 5 6 ) ; 
 
 
 
                 / * * 
 
                   *   S0n0peo00;uP0QtW0f00iRj0000iQ000000000|Ts0QW0~0Y00
 
                   *   00000000n0|Ts0QW0o00S0n0pe0|Ts0QW0_00000L00S0n0peL0B}NY00~0g0k0LD0~0Y00
 
                   *   @ p a r a m   i _ r a s t e r 
 
                   *   iQQt0Y00;uP0c[W0~0Y00
 
                   *   @ 
 
                   * / 
 
                 p u b l i c   v o i d   d e t e c t 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 ) 
 
                 { 
 
                         / /   0000000
 
                         D e b u g . A s s e r t ( t h i s . _ g s _ r a s t e r . g e t S i z e ( ) . i s E q u a l S i z e ( i _ r a s t e r . g e t S i z e ( ) . w ,   i _ r a s t e r . g e t S i z e ( ) . h ) ) ; 
 
                         i f   ( t h i s . _ l a s t _ i n p u t _ r a s t e r   ! =   i _ r a s t e r ) 
 
                         { 
 
                                 t h i s . _ h i s t m a k e r   =   ( I N y A R H i s t o g r a m F r o m R a s t e r ) t h i s . _ g s _ 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 H i s t o g r a m F r o m R a s t e r ) ) ; 
 
                                 t h i s . _ t o g s _ f i l t e r   =   ( I N y A R R g b 2 G s F i l t e r ) 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 R g b 2 G s F i l t e r ) ) ; 
 
                                 t h i s . _ l a s t _ i n p u t _ r a s t e r   =   i _ r a s t e r ; 
 
                         } 
 
 
 
                         / / G S 0000x0n0	Ych0000000n0ub
 
                         t h i s . _ t o g s _ f i l t e r . c o n v e r t ( t h i s . _ g s _ r a s t e r ) ; 
 
                         t h i s . _ h i s t m a k e r . c r e a t e H i s t o g r a m ( 4 ,   t h i s . _ h i s t ) ; 
 
 
 
                         / /   00000000cY0
 
                         t h i s . _ d e t e c t m a r k e r . i n i t ( i _ r a s t e r ,   t h i s . _ c u r r e n t _ a r c o d e _ i n d e x ) ; 
 
                         t h i s . _ d e t e c t m a r k e r . d e t e c t M a r k e r ( t h i s . _ g s _ r a s t e r ,   t h i s . _ t h d e t e c t . g e t T h r e s h o l d ( t h i s . _ h i s t ) , t h i s . _ d e t e c t m a r k e r ) ; 
 
 
 
                         / /   XrKa0fe
 
                         t h i s . u p d a t e S t a t u s ( t h i s . _ d e t e c t m a r k e r . s q u a r e ,   t h i s . _ d e t e c t m a r k e r . c o d e _ i n d e x ) ; 
 
                         r e t u r n ; 
 
                 } 
 
                 / * * 
 
                   *   S0n0peo000000000n0 Nsn0weE\$P0-[W0~0Y00
 
                   *   weE\$Po000 . 0 & l t ; n & l t ; 1 . 0 n0{Vg0c[W0~0Y00
 
                   *   @ p a r a m   i _ n e w _ c f 
 
                   *   eW0O00000zvY00h0M0n0$Pg0Y00
 
                   *   @ p a r a m   i _ e x i s t _ c f 
 
                   *   }}W0f00000Y00h0M0n0$Pg0Y00
 
                   *   i _ n e w _ c f n06 rRz^n0$P0c[Y00h0oD0g0W00F0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 _ n e w _ c f ,   d o u b l e   i _ e x i s t _ c f ) 
 
                 { 
 
                         t h i s . _ d e t e c t m a r k e r . c f _ t h r e s h o l d _ e x i s t   =   i _ e x i s t _ c f ; 
 
                         t h i s . _ d e t e c t m a r k e r . c f _ t h r e s h o l d _ n e w   =   i _ n e w _ c f ; 
 
                 } 
 
 
 
                 p r i v a t e   N y A R D o u b l e M a t r i x 4 4   _ t r a n s m a t _ r e s u l t   =   n e w   N y A R D o u b l e M a t r i x 4 4 ( ) ; 
 
                 p r i v a t e   N y A R T r a n s M a t R e s u l t P a r a m   _ l a s t _ r e s u l t _ p a r a m   =   n e w   N y A R T r a n s M a t R e s u l t P a r a m ( ) ; 
 
 
 
                 / * * 	 000000n0000000feW00_k0_X0f0]000000pe0ƙRW0~0Y00
 
                   *   	 ;b0$Po000[k00000zvY00NL0g0M0_0K0
00:yY0w}P$Pg0Y00000n0rKah0o0puj00~0Y00
 
                   * / 
 
                 p r i v a t e   b o o l   u p d a t e S t a t u s ( N y A R S q u a r e   i _ s q u a r e ,   i n t   i _ c o d e _ i n d e x ) 
 
                 { 
 
                         i f   ( t h i s . _ c u r r e n t _ a r c o d e _ i n d e x   <   0 ) 
 
                         { / /   *gX-N
 
                                 i f   ( i _ c o d e _ i n d e x   <   0 ) 
 
                                 { / /   *gXK00*gXn0wy
 
                                         / /   j0k00W0j0D00000
 
                                         r e t u r n   f a l s e ; 
 
                                 } 
 
                                 e l s e 
 
                                 { / /   *gXK00Xn0wy
 
                                         t h i s . _ c u r r e n t _ a r c o d e _ i n d e x   =   i _ c o d e _ i n d e x ; 
 
                                         / /   0000ub
 
                                         / /   O n E n t e r 
 
                                         t h i s . o n E n t e r H a n d l e r ( i _ c o d e _ i n d e x ) ; 
 
                                         / /   	YcLR0\Ob
 
                                         t h i s . _ t r a n s m a t . t r a n s M a t ( i _ s q u a r e ,   t h i s . _ o f f s e t ,   t h i s . _ t r a n s m a t _ r e s u l t ,   t h i s . _ l a s t _ r e s u l t _ p a r a m ) ; 
 
                                         / /   O n U p d a t e 
 
                                         t h i s . o n U p d a t e H a n d l e r ( i _ s q u a r e ,   t h i s . _ t r a n s m a t _ r e s u l t ) ; 
 
                                         t h i s . _ l o s t _ d e l a y _ c o u n t   =   0 ; 
 
                                         r e t u r n   t r u e ; 
 
                                 } 
 
                         } 
 
                         e l s e 
 
                         { / /   X-N
 
                                 i f   ( i _ c o d e _ i n d e x   <   0 ) 
 
                                 { / /   XK00*gXn0wy
 
                                         t h i s . _ l o s t _ d e l a y _ c o u n t + + ; 
 
                                         i f   ( t h i s . _ l o s t _ d e l a y   <   t h i s . _ l o s t _ d e l a y _ c o u n t ) 
 
                                         { 
 
                                                 / /   O n L e a v e 
 
                                                 t h i s . _ c u r r e n t _ a r c o d e _ i n d e x   =   - 1 ; 
 
                                                 t h i s . o n L e a v e H a n d l e r ( ) ; 
 
                                         } 
 
                                         r e t u r n   f a l s e ; 
 
                                 } 
 
                                 e l s e   i f   ( i _ c o d e _ i n d e x   = =   t h i s . _ c u r r e n t _ a r c o d e _ i n d e x ) 
 
                                 { / /   TX0A R C o d e n0QX
 
                                         / /   0000ub
 
                                         / /   	YcLR0\Ob
 
                                         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 _ s q u a r e ,   t h i s . _ o f f s e t ,   t h i s . _ t r a n s m a t _ r e s u l t ,   t h i s . _ l a s t _ r e s u l t _ p a r a m . l a s t _ e r r o r ,   t h i s . _ t r a n s m a t _ r e s u l t ,   t h i s . _ l a s t _ r e s u l t _ p a r a m ) ) 
 
                                         { 
 
                                                 t h i s . _ t r a n s m a t . t r a n s M a t ( i _ s q u a r e ,   t h i s . _ o f f s e t ,   t h i s . _ t r a n s m a t _ r e s u l t ,   t h i s . _ l a s t _ r e s u l t _ p a r a m ) ; 
 
                                         } 
 
                                         / /   O n U p d a t e 
 
                                         t h i s . o n U p d a t e H a n d l e r ( i _ s q u a r e ,   t h i s . _ t r a n s m a t _ r e s u l t ) ; 
 
                                         t h i s . _ l o s t _ d e l a y _ c o u n t   =   0 ; 
 
                                         r e t u r n   t r u e ; 
 
                                 } 
 
                                 e l s e 
 
                                 { / /   puj00000n0X!No00000W0j0D00
 
                                         t h r o w   n e w   N y A R E x c e p t i o n ( ) ; 
 
                                 } 
 
                         } 
 
                 } 
 
                 / * * 
 
                   *   ]000000peg0Y00
 
                   *   }bW0_0000g00000zvBfn0Qt0[ňW0f0O0`0U0D00
 
                   *   @ p a r a m   i _ c o d e 
 
                   *   iQW0_00000000n0I D juSg0Y00I D juSk0d0D0f0o00{ @ l i n k   # s e t A R C o d e T a b l e } n0f0SgqW0f0O0`0U0D00
 
                   * / 
 
                 p r o t e c t e d   a b s t r a c t   v o i d   o n E n t e r H a n d l e r ( i n t   i _ c o d e ) ; 
 
                 / * * 
 
                   *   ]000000peg0Y00
 
                   *   }bW0_0000g00000m1YBfn0Qt0[ňW0f0O0`0U0D00
 
                   * / 
 
                 p r o t e c t e d   a b s t r a c t   v o i d   o n L e a v e H a n d l e r ( ) ; 
 
                 / * * 
 
                   *   ]000000peg0Y00
 
                   *   }bW0_0000g00000feBfn0Qt0[ňW0f0O0`0U0D00
 
                   *   _pen0$Pn0	gRgo00peL0B}NY00~0g0g0Y00
 
                   *   @ p a r a m   i _ s q u a r e 
 
                   *   s(Wn0000iQMOng0Y00
 
                   *   @ p a r a m   o _ r e s u l t 
 
                   *   s(Wn0YR	YcLRg0Y00
 
                   * / 
 
                 p r o t e c t e d   a b s t r a c t   v o i d   o n U p d a t e H a n d l e r ( N y A R S q u a r e   i _ s q u a r e ,   N y A R D o u b l e M a t r i x 4 4   o _ r e s u l t ) ; 
 
         } 
 
 } 