/ *   
 
   *   P R O J E C T :   N y A R T o o l k i t C S 
 
   *   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
   *   T h i s   w o r k   i s   b a s e d   o n   t h e   o r i g i n a l   A R T o o l K i t   d e v e l o p e d   b y 
 
   *       H i r o k a z u   K a t o 
 
   *       M a r k   B i l l i n g h u r s t 
 
   *       H I T L a b ,   U n i v e r s i t y   o f   W a s h i n g t o n ,   S e a t t l e 
 
   *   h t t p : / / w w w . h i t l . w a s h i n g t o n . e d u / a r t o o l k i t / 
 
   * 
 
   *   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 ; 
 
 
 
 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 . d e t e c t o r 
 
 { 
 
         / * * 
 
           *   S0n0000o001 Pn00000S0qbF0000iQhV0[W0~0Y00
 
           *   {v2W0_0Pn0A R 000k0[_Y000000eQR;uPK00iQW00]0n0	YcLRh0 N^0ԏW0~0Y00
 
           *   < p > !|XSj0OD0e
 
           *   < o l > 
 
           *   < l i > 0000000\ObW0~0Y0000000k0o00{000000h0eQR;uPb__0000000000iQY00000L0B00~0Y00
 
           *   < l i > { @ l i n k   # d e t e c t M a r k e r L i t e } pek0;uPh0weE\$P0eQRW0f000000iQW0~0Y00
 
           *   < l i > 000L0d0K00h00000000n000000L0feU00~0Y00{ @ l i n k   # g e t C o n f i d e n c e } I{n0pe0Oc0f00S_W0_0000n0rKa0_~0Y00
 
           *   < l i > NMo00S0n0Qt0p~0ԏW0f0000n0000000feW0~0Y00
 
           *   < / o l > 
 
           *   < / p > 
 
           * / 
 
         p u b l i c   a b s t r a c t   c l a s s   N y A R S i n g l e D e t e c t M a r k e r 
 
         { 
 
                 / * * 
 
                   *   S0n0peo000000n0;uP
Nn0MOn0<h
}Y000{ @ l i n k   N y A R S q u a r e } x0n0Sgq$P0ԏW0~0Y00
 
                   *   vMRk0[LW0_0{ @ l i n k   # d e t e c t M a r k e r L i t e } L0bRW0f0D0j0D0h0OH0~0[000
 
                   *   ԏtS$Pn0Q[o00!kk0{ @ l i n k   # d e t e c t M a r k e r L i t e } 0[LY00~0g0	gRg0Y00
 
                   *   @ r e t u r n 
 
                   *   wb_`1Xx0n0Sgq$P0
 
                   * / 
 
                 p u b l i c   N y A R S q u a r e   r e f S q u a r e ( ) 
 
                 { 
 
                         r e t u r n   t h i s . _ s q u a r e ; 
 
                 } 
 
                 / * * 
 
                   *   S0n0peo00iQW0_00000h0{v2n0000h0n00 N^0ԏW0~0Y00
 
                   *   vMRk0[LW0_0{ @ l i n k   # d e t e c t M a r k e r L i t e } L0bRW0f0D0j0D0h0OH0~0[000
 
                   *   $Po000 & l t ; = n < 1 n0n0pe$P0S0~0Y00
 
                   *    N,vk00 N^L0NOD04XTo000000XW0f0D0~0Y00
 
                   *   @ r e t u r n 
 
                   *    N^n0pe$P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 ( ) 
 
                 { 
 
                         r e t u r n   t h i s . _ c o n f i d e n c e ; 
 
                 } 
 
                 / * * 
 
                   *   S0n0peo00	YcLRn0{0000R0fH0~0Y00
 
                   *   8^o0t r u e 0O(uW0~0Y00
 
                   *   t r a n s M a t Ncn0{o00YRn0Rg$P0kVN!kCQ^jK00{Y00_000wL0[[W0~0Y00
 
                   *   t r a n s M a t C o n t Ncn0{o00YRn0Rg$Pk0MRVn0P}g0Am(uW0~0Y00S0n0000o00YRn0[[W0_0000k0[W0f0o0
 
                   *   000n0n\0wn\j0i0n0RgL0B00~0Y0L00YRn0[[W0j0D00000pen00000O(uY00tXg0o00
 
                   *   \ϑn0w	YRL0B00~0Y00
 
                   *   @ p a r a m   i _ i s _ c o n t i n u e 
 
                   *   T R U E j000t r a n s M a t C o n t Ncn0{0W0~0Y00  F A L S E j000t r a n s M a t Ncn0{0W0~0Y00
 
                   * / 
 
                 p u b l i c   v o i d   s e t C o n t i n u e M o d e ( b o o l   i _ i s _ c o n t i n u e ) 
 
                 { 
 
                         t h i s . _ i s _ c o n t i n u e   =   i _ i s _ c o n t i n u e ; 
 
                 } 
 
                 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   _ l a s t _ i n p u t _ m a t ; 
 
                 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 ( ) ; 
 
 
 
                 / * * 
 
                   *   S0n0peo00iQW0_00000n0	YcLR0{W0f00o _ r e s u l t x0$P0ԏW0~0Y00
 
                   *   vMRk0[LW0_0{ @ l i n k   # d e t e c t M a r k e r L i t e } L0bRW0f0D0j0D0h0OH0~0[000
 
                   *   @ p a r a m   o _ r e s u l t 
 
                   *   	YcLR0SQ0S00000000
 
                   *   @ 
 
                   * / 
 
 	         p u b l i c   v o i d   g e t T r a n s m a t ( 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 ) 
 
 	         { 
 
 	 	         / /    Nju NW0_00000n0MOnh0K0]0n00{
 
 	 	         i f   ( t h i s . _ i s _ c o n t i n u e ) { 
 
 	 	 	         / / e\tkL0OH0]0F0K0$R[
 
 	 	 	         i f ( t h i s . _ l a s t _ i n p u t _ m a t = = o _ r e s u l 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 ( t h i s . _ s q u a r e , t h i s . _ o f f s e t , o _ 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 , o _ 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 ) ) { 
 
 	 	 	 	 	         r e t u r n ; 
 
 	 	 	 	         } 
 
 	 	 	         } 
 
 	 	         } 
 
 	 	         / / e\tkOH0j0D0o r }}X1YWe
 
 	 	         t h i s . _ t r a n s m a t . t r a n s M a t ( t h i s . _ s q u a r e , t h i s . _ o f f s e t , o _ 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 . _ l a s t _ i n p u t _ m a t = o _ r e s u l t ; 
 
 	 	         r e t u r n ; 
 
 	         } 
 
                 / * * 
 
                   *   @ d e p r e c a t e d 
 
                   *   { @ l i n k   # g e t T r a n s m a t } 
 
                   * / 
 
                 p u b l i c   v o i d   g e t T r a n s m a t i o n M a t r i x ( 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 ) 
 
                 { 
 
                         t h i s . g e t T r a n s m a t ( o _ r e s u l t ) ; 
 
                         r e t u r n ; 
 
                 } 
 
                 / * *   Sgq000000* / 
 
                 p r i v a t e   I N y A R R g b 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 A r t k T h   _ b i n _ f i l t e r   =   n u l l ; 
 
                 / * * 
 
                   *   S0n0peo00;uPK00{v2nn0000iQ0LD0~0Y00
 
                   *   000n0iQk0bRY00h00t h i s n000000k0000n0N!kCQMOn02W0~0Y00
 
                   *   pen0bR_o00000n0YRLRh00 N^00]00^00{ @ l i n k   # g e t T r a n s m a t i o n M a t r i x } h0{ @ l i n k   # g e t C o n f i d e n c e } K00_0S0h0L0g0M0~0Y00
 
                   *   @ p a r a m   i _ r a s t e r 
 
                   *   00000iQY00;uP0;uPn0000o000000000k0c[W0_0{ @ l i n k   N y A R P a r a m } 000000h0 NW0f0D0j0Q00p0j00~0[000
 
                   *   @ p a r a m   i _ t h 
 
                   *   2 $PSweE\$P00 K002 5 6 ~0g0n0$P0c[W0~0Y00
 
                   *   @ r e t u r n 
 
                   *   0000L0iQg0M0_0K000w}P$Pg0ԏW0~0Y00
 
                   *   @ 
 
                   * / 
 
                 p u b l i c   b o o l   d e t e c t M a r k e r L i t e ( 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 h ) 
 
                 { 
 
                         / / 0000000
 
                         i f   ( ! t h i s . _ b i n _ 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 ( ) ) ) 
 
                         { 
 
                                 t h r o w   n e w   N y A R E x c e p t i o n ( ) ; 
 
                         } 
 
                         / /  gB}eQR0000fe
 
                         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 . _ b i n _ f i l t e r   =   ( I N y A R R g b 2 G s F i l t e r A r t k T h ) 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 A r t k T h ) ) ; 
 
                                 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 ; 
 
                         } 
 
                         / / 0000$P0000k0	YcY00. 
 
                         t h i s . _ b i n _ f i l t e r . d o F i l t e r ( i _ t h ,   t h i s . _ b i n _ r a s t e r ) ; 
 
 
 
                         / / 0000000000n0nP
 
                         t h i s . _ c o n f i d e n c e   =   0 ; 
 
                         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 ; 
 
                         / / 
 
                         / / 000iQhV0000
 
                         t h i s . e x e c D e t e c t M a r k e r ( ) ; 
 
                         i f   ( t h i s . _ c o n f i d e n c e   = =   0 ) 
 
                         { 
 
                                 r e t u r n   f a l s e ; 
 
                         } 
 
                         r e t u r n   t r u e ; 
 
                 } 
 
 
 
 
 
                 / * *   YR	YcLRn0	YchV* / 
 
                 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 ; 
 
                 / * *   0000000n0Oc(u* / 
 
                 p r o t e c t e d   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 R e c t O f f s e t   _ o f f s e 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   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 r o t e c t e d   N y A R B i n R a s t e r   _ b i n _ r a s t e r ; 
 
                 / * *    Ns* / 
 
                 p r i v a t e   d o u b l e   _ c o n f i d e n c e   =   0 ; 
 
                 / * *   Xwb_n02(u* / 
 
                 p r o t e c t e d   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 r o t e c t e d   b o o l   _ i s _ c o n t i n u e   =   f a l s e ; 
 
                 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 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 ] ; 
 
 
 
 
 
 
 
                 / * * 
 
                   *   Q萢peg0Y00
 
                   *   S0n0peo00t h i s n0N!kCQwb_`1X000000feW0~0Y00
 
                   *   @ p a r a m   i _ c o o r d 
 
                   *   @ p a r a m   i _ v e r t e x _ i n d e x 
 
                   *   @ 
 
                   * / 
 
                 p r o t e c t e d   i n t e r n a l   v o i d   u p d a t e S q u a r e I n f o ( 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 ) 
 
                 { 
 
                         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 ; 
 
                         / / *퐧^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 ; 	 / / C  j000000qbD0g0[ň
 
                         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 . _ l a s t _ i n p u t _ r a s t e r ,   v e r t e x ) ) 
 
                         { 
 
                                 r e t u r n ; 
 
                         } 
 
                         / / 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 ) ; 
 
                         i f   ( ! t h i s . _ m a t c h _ p a t t . 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 ) ) 
 
                         { 
 
                                 r e t u r n ; 
 
                         } 
 
                         / / s(Wn0 Ns00NOQ00p0B}N
 
                         i f   ( t h i s . _ c o n f i d e n c e   >   m r . c o n f i d e n c e ) 
 
                         { 
 
                                 r e t u r n ; 
 
                         } 
 
                         / /  Nsn0ؚD0wb_L0B00p00eMO0naW0f0p`1X0\Ob
 
                         N y A R S q u a r e   s q   =   t h i s . _ s q u a r e ; 
 
                         t h i s . _ c o n f i d e n c e   =   m r . c o n f i d e n c 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   -   m r . d i r e c t i o n )   %   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 ] ) ; 
 
                         } 
 
                         / / a00c0h00r0c0O00ԏW0f000F0K00
 
                         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 
 
                                 } 
 
                         } 
 
                 } 
 
                 p r o t e c t e d   N y A R S i n g l e D e t e c t M a r k e r ( N y A R P a r a m   i _ r e f _ p a r a m ,   N y A R C o d e   i _ r e f _ c o d e ,   d o u b l e   i _ m a r k e r _ w i d t h ) 
 
                 { 
 
                         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 _ r e f _ c o d e . g e t W i d t h ( ) ,   i _ r e f _ c o d e . g e t H e i g h t ( ) ) ; 
 
                         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 ) ; 
 
                         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 ( ) ; 
 
                         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 ) ; 
 
                         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 _ r e f _ p a r a m . g e t S c r e e n S i z e ( ) ,   i _ r e f _ p a r a m . g e t D i s t o r t i o n F a c t o r ( ) ) ; 
 
                         / / $P;uP00000\O0	 	 
 
                         N y A R I n t S i z e   s   =   i _ r e f _ p a r a m . g e t S c r e e n S i z e ( ) ; 
 
                         t h i s . _ b i n _ r a s t e r   =   n e w   N y A R B i n R a s t e r ( s . w ,   s . h ) ; 
 
                 } 
 
                 p r o t e c t e d   a b s t r a c t   v o i d   e x e c D e t e c t M a r k e r ( ) ; 
 
 
 
                 / * *   A R T o o l K i t Ncn00000000xbW0~0Y00* / 
 
                 p u b l i c   c o n s t   i n t   P F _ A R T O O L K I T _ C O M P A T I B L E   =   1 ; 
 
                 / * *   N y A R T o o l K i t n00000000xbW0~0Y00* / 
 
                 p u b l i c   c o n s t   i n t   P F _ N Y A R T O O L K I T   =   2 ; 
 
                 / * *   A R T o o l K i t Nc000000h00N y A R T o o l K i t n0000000n0mTg0Y002 D |k0N y A R T o o l k i t , 3 D |k0A R T o o l K i t n00000000xbW0~0Y00* / 
 
                 p u b l i c   c o n s t   i n t   P F _ N Y A R T O O L K I T _ A R T O O L K I T _ F I T T I N G   =   1 0 0 ; 
 
                 / * *   zv(u[pe$P* / 
 
                 p u b l i c   c o n s t   i n t   P F _ T E S T 2   =   2 0 1 ; 
 
                 / * * 
 
                   *   Qt0000000c[W0f00{ @ l i n k   N y A R S i n g l e D e t e c t o M a r k e r } 0000000ubW0~0Y00
 
                   *   @ p a r a m   i _ p a r a m 
 
                   *   000000000c[W0~0Y00S0n0000o00{ @ l i n k   # d e t e c t M a r k e r L i t e } k0eQRY00;uPh0TX0g0B00_L0B00~0Y00
 
                   *   @ p a r a m   i _ c o d e 
 
                   *   iQY0000000000c[W0~0Y00
 
                   *   @ p a r a m   i _ m a r k e r _ w i d t h 
 
                   *   ckeb_000n0irt0000m m XSMOg0c[W0~0Y00
 
                   *   @ p a r a m   i _ i n p u t _ r a s t e r _ t y p e 
 
                   *   { @ l i n k   # d e t e c t M a r k e r L i t e } k0eQRY00000n0;u }b__0c[W0~0Y00
 
                   *   S0n0$Po00{ @ l i n k   I N y A R R g b R a s t e r # g e t B u f f e r T y p e } pen0;b0$P0)R(uW0~0Y00
 
                   *   @ p a r a m   i _ p r o f i l e _ i d 
 
                   *   {000000n0xb$Pg0Y00NNn0[pen0D0Z00K00c[W0~0Y00
 
                   *   < u l > 
 
                   *   < l i > { @ l i n k   # P F _ A R T O O L K I T _ C O M P A T I B L E } 
 
                   *   < l i > { @ l i n k   # P F _ N Y A R T O O L K I T } 
 
                   *   < l i > { @ l i n k   # P F _ N Y A R T O O L K I T _ A R T O O L K I T _ F I T T I N G } 
 
                   *   < / u l > 
 
                   *   @   
 
                   *   @ 
 
                   * / 
 
                 p u b l i c   s t a t i c   N y A R S i n g l e D e t e c t M a r k e r   c r e a t e I n s t a n c e ( N y A R P a r a m   i _ p a r a m ,   N y A R C o d e   i _ c o d e ,   d o u b l e   i _ m a r k e r _ w i d t h ,   i n t   i _ p r o f i l e _ i d ) 
 
                 { 
 
                         s w i t c h   ( i _ p r o f i l e _ i d ) 
 
                         { 
 
                                 c a s e   P F _ A R T O O L K I T _ C O M P A T I B L E : 
 
                                         r e t u r n   n e w   N y A R S i n g l e D e t e c t M a r k e r _ A R T K v 2 ( i _ p a r a m ,   i _ c o d e ,   i _ m a r k e r _ w i d t h ) ; 
 
                                 c a s e   P F _ N Y A R T O O L K I T _ A R T O O L K I T _ F I T T I N G : 
 
                                         r e t u r n   n e w   N y A R S i n g l e D e t e c t M a r k e r _ N y A R T K _ F I T T I N G _ A R T K v 2 ( i _ p a r a m ,   i _ c o d e ,   i _ m a r k e r _ w i d t h ) ; 
 
                                 c a s e   P F _ N Y A R T O O L K I T : / / d e f a u l t 
 
                                         r e t u r n   n e w   N y A R S i n g l e D e t e c t M a r k e r _ N y A R T K ( i _ p a r a m ,   i _ c o d e ,   i _ m a r k e r _ w i d t h ) ; 
 
                                 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 ( ) ; 
 
                         } 
 
                 } 
 
                 p u b l i c   s t a t i c   N y A R S i n g l e D e t e c t M a r k e r   c r e a t e I n s t a n c e ( N y A R P a r a m   i _ p a r a m ,   N y A R C o d e   i _ c o d e ,   d o u b l e   i _ m a r k e r _ w i d t h ) 
 
                 { 
 
                         r e t u r n   c r e a t e I n s t a n c e ( i _ p a r a m ,   i _ c o d e ,   i _ m a r k e r _ w i d t h ,   P F _ N Y A R T O O L K I T ) ; 
 
                 } 
 
 
 
         } 
 
 
 
         / / 
 
         / / T000000kn0000
 
         / / 
 
 
 
 
 
         c l a s s   N y A R S i n g l e D e t e c t M a r k e r _ A R T K v 2   :   N y A R S i n g l e D e t e c t M a r k e r 
 
         { 
 
                 p r i v a t e   A R T K D e t e c t o r   _ s q u a r e _ d e t e c t ; 
 
 
 
                 / * * 
 
                   *   A R T K 0y00000Oc0_0wb_iQ_jx0n00000
 
                   * / 
 
 	         p u b l i c   c l a s s   A R T K D e t e c t o r   :   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 _ A R T o o l K i 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   N y A R S i n g l e D e t e c t M a r k e r   _ p a r e n t ; 
 
                         p u b l i c   A R T K D e t e c t o r ( N y A R S i n g l e D e t e c t M a r k e r   i _ p a r e n t ,   N y A R I n t S i z e   i _ s i z e ) : b a s e ( i _ s i z e ) 
 
                         { 
 
                                 t h i s . _ p a r e n t   =   i _ p a r e n t ; 
 
                         } 
 
                         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 ) 
 
                         { 
 
                                 t h i s . _ p a r e n t . u p d a t e S q u a r e I n f o ( i _ c o o r d ,   i _ v e r t e x _ i n d e x ) ; 
 
                         } 
 
                 } 
 
                 p u b l i c   N y A R S i n g l e D e t e c t M a r k e r _ A R T K v 2 ( N y A R P a r a m   i _ r e f _ p a r a m ,   N y A R C o d e   i _ r e f _ c o d e ,   d o u b l e   i _ m a r k e r _ w i d t h ) : b a s e ( i _ r e f _ p a r a m ,   i _ r e f _ c o d e ,   i _ m a r k e r _ w i d t h ) 
 
                 { 
 
                         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 _ O 3 ( i _ r e f _ c o d e . g e t W i d t h ( ) ,   i _ r e f _ c o d e . g e t H e i g h t ( ) ) ; 
 
                         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 _ A R T o o l K i t ( i _ r e f _ p a r a m ) ; 
 
                         t h i s . _ s q u a r e _ d e t e c t   =   n e w   A R T K D e t e c t o r ( t h i s ,   i _ r e f _ p a r a m . g e t S c r e e n S i z e ( ) ) ; 
 
                 } 
 
                 p r o t e c t e d   o v e r r i d e   v o i d   e x e c D e t e c t M a r k e r ( ) 
 
                 { 
 
                         / / wb_0cY0( ;b0$Po0000000peg0SQ0S00) 
 
                         t h i s . _ s q u a r e _ d e t e c t . d e t e c t M a r k e r ( t h i s . _ b i n _ r a s t e r ,   t h i s . _ s q u a r e _ d e t e c t ) ; 
 
 
 
                 } 
 
         } 
 
         c l a s s   N y A R S i n g l e D e t e c t M a r k e r _ N y A R T K _ F I T T I N G _ A R T K v 2   :   N y A R S i n g l e D e t e c t M a r k e r 
 
         { 
 
                 p r o t e c t e d   N y A R S i n g l e D e t e c t M a r k e r _ A R T K v 2 . A R T K D e t e c t o r   _ s q u a r e _ d e t e c t ; 
 
                 p u b l i c   N y A R S i n g l e D e t e c t M a r k e r _ N y A R T K _ F I T T I N G _ A R T K v 2 ( N y A R P a r a m   i _ r e f _ p a r a m ,   N y A R C o d e   i _ r e f _ c o d e ,   d o u b l e   i _ m a r k e r _ w i d t h ) 
 
                         :   b a s e ( i _ r e f _ p a r a m ,   i _ r e f _ c o d e ,   i _ m a r k e r _ w i d t h ) 
 
                 { 
 
                         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 _ r e f _ c o d e . g e t W i d t h ( ) ,   i _ r e f _ c o d e . g e t H e i g h t ( ) ,   4 ,   2 5 ) ; 
 
                         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 _ A R T o o l K i t ( i _ r e f _ p a r a m ) ; 
 
                         t h i s . _ s q u a r e _ d e t e c t   =   n e w   N y A R S i n g l e D e t e c t M a r k e r _ A R T K v 2 . A R T K D e t e c t o r ( t h i s ,   i _ r e f _ p a r a m . g e t S c r e e n S i z e ( ) ) ; 
 
                 } 
 
                 p r o t e c t e d   o v e r r i d e   v o i d   e x e c D e t e c t M a r k e r ( ) 
 
                 { 
 
                         / / wb_0cY0( ;b0$Po0000000peg0SQ0S00) 
 
                         t h i s . _ s q u a r e _ d e t e c t . d e t e c t M a r k e r ( t h i s . _ b i n _ r a s t e r ,   t h i s . _ s q u a r e _ d e t e c t ) ; 
 
                 } 
 
         } 
 
         / * * 
 
           *   N y A R T o o l k i t n00000000O(uY00S i n g l e D e t e c t M a r k e r 
 
           *   @ a u t h o r   n y a t l a 
 
           * 
 
           * / 
 
         c l a s s   N y A R S i n g l e D e t e c t M a r k e r _ N y A R T K   :   N y A R S i n g l e D e t e c t M a r k e r 
 
         { 
 
                 p r i v a t e   R l e D e t e c t o r   _ s q u a r e _ d e t e c t ; 
 
                 / * * 
 
                   *   R l e L a b e l i n g 0Oc0_0wb_iQ_j
 
                   * / 
 
                 p r i v a t e   c l a s s   R l e D e t e c t o r   :   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 
 
                 { 
 
                         N y A R S i n g l e D e t e c t M a r k e r   _ p a r e n t ; 
 
                         p u b l i c   R l e D e t e c t o r ( N y A R S i n g l e D e t e c t M a r k e r   i _ p a r e n t ,   N y A R I n t S i z e   i _ s i z e ) : b a s e ( i _ s i z e ) 
 
                         { 
 
                                 t h i s . _ p a r e n t   =   i _ p a r e n t ; 
 
                         } 
 
 	 	         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 ) 
 
 	 	         { 
 
 	 	 	         t h i s . _ p a r e n t . u p d a t e S q u a r e I n f o ( i _ c o o r d ,   i _ v e r t e x _ i n d e x ) ; 
 
         	 	 	 
 
 	 	         } 
 
                 } 
 
 
 
                 p u b l i c   N y A R S i n g l e D e t e c t M a r k e r _ N y A R T K ( N y A R P a r a m   i _ r e f _ p a r a m ,   N y A R C o d e   i _ r e f _ c o d e ,   d o u b l e   i _ m a r k e r _ w i d t h ) : b a s e ( i _ r e f _ p a r a m ,   i _ r e f _ c o d e ,   i _ m a r k e r _ w i d t h ) 
 
                 { 
 
                         
 
                         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 _ r e f _ c o d e . g e t W i d t h ( ) ,   i _ r e f _ c o d e . g e t H e i g h t ( ) ,   4 ,   2 5 ) ; 
 
                         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 _ r e f _ p a r a m ) ; 
 
                         t h i s . _ s q u a r e _ d e t e c t   =   n e w   R l e D e t e c t o r ( t h i s ,   i _ r e f _ p a r a m . g e t S c r e e n S i z e ( ) ) ; 
 
                 } 
 
                 p r o t e c t e d   o v e r r i d e   v o i d   e x e c D e t e c t M a r k e r ( ) 
 
                 { 
 
                         / / wb_0cY0( ;b0$Po0000000peg0SQ0S00) 
 
                         t h i s . _ s q u a r e _ d e t e c t . d e t e c t M a r k e r ( t h i s . _ b i n _ r a s t e r ,   0 ,   t h i s . _ s q u a r e _ d e t e c t ) ; 
 
 
 
                 } 
 
         } 
 
 
 
 } 
 
 
 
 
 
 