/ *   
 
   *   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 . n y i d m a r k e r 
 
 { 
 
         / * * 
 
           *   S0n0000o00000;uPk0[W0_0n0Nawb_K000N y I d 0000n000000S0~0Y00
 
           *   0S0P}go00{ @ l i n k   N y I d M a r k e r P a t t e r n } 000n0000000k0QRW0~0Y00
 
           * 
 
           * / 
 
         p u b l i c   c l a s s   N y I d M a r k e r P i c k u p 
 
         { 
 
                 p r i v a t e   P e r s p e c t i v e P i x e l R e a d e r   _ p e r s p e c t i v e _ r e a d e r ; 
 
                 p r i v a t e   r e a d o n l y   P e r s p e c t i v e P i x e l R e a d e r . T T h r e s h o l d   _ _ p i c k F r o m R a s t e r _ t h   =   n e w   P e r s p e c t i v e P i x e l R e a d e r . T T h r e s h o l d ( ) ; 
 
                 p r i v a t e   r e a d o n l y   M a r k e r P a t t E n c o d e r   _ _ p i c k F r o m R a s t e r _ e n c o d e r   =   n e w   M a r k e r P a t t E n c o d e r ( ) ; 
 
 
 
                 / * * 
 
                   *   0000000g0Y000000000ubW0~0Y00
 
                   *   @   
 
                   * / 
 
                 p u b l i c   N y I d M a r k e r P i c k u p ( ) 
 
                 { 
 
                         t h i s . _ p e r s p e c t i v e _ r e a d e r   =   n e w   P e r s p e c t i v e P i x e l R e a d e r ( ) ; 
 
                         r e t u r n ; 
 
                 } 
 
 
 
                 / * * 
 
                   *   S0n0peo000000000K00;uP00QW0~0Y00
 
                   *   @ p a r a m   i _ p i x _ d r v 
 
                   *   @ p a r a m   i _ s i z e 
 
                   *   @ p a r a m   i _ v e r t e x 
 
                   *   @ p a r a m   o _ d a t a 
 
                   *   @ p a r a m   o _ p a r a m 
 
                   *   @ r e t u r n 
 
                   *   @ 
 
                   * / 
 
                 p u b l i c   b o o l   p i c k F r o m R a s t e r ( I N y A R G s P i x e l D r i v e r   i _ p i x _ d r v ,   N y A R I n t P o i n t 2 d [ ]   i _ v e r t e x ,   N y I d M a r k e r P a t t e r n   o _ d a t a ,   N y I d M a r k e r P a r a m   o _ p a r a m ) 
 
                 { 
 
                         i f   ( ! t h i s . _ p e r s p e c t i v e _ r e a d e r . s e t S o u r c e S q u a r e ( i _ v e r t e x ) ) 
 
                         { 
 
                                 r e t u r n   f a l s e ; 
 
                         } 
 
                         r e t u r n   t h i s . _ p i c k F r o m R a s t e r ( i _ p i x _ d r v ,   o _ d a t a ,   o _ p a r a m ) ; 
 
                 } 
 
                 / * * 
 
                   *   S0n0peo000000000K00;uP00QW0~0Y00
 
                   *   @ p a r a m   i _ p i x _ d r v 
 
                   *   @ p a r a m   i _ s i z e 
 
                   *   @ p a r a m   i _ v e r t e x 
 
                   *   @ p a r a m   o _ d a t a 
 
                   *   @ p a r a m   o _ p a r a m 
 
                   *   @ r e t u r n 
 
                   *   @ 
 
                   * / 
 
                 p u b l i c   b o o l   p i c k F r o m R a s t e r ( I N y A R G s P i x e l D r i v e r   i _ p i x _ d r v ,   N y A R D o u b l e P o i n t 2 d [ ]   i _ v e r t e x ,   N y I d M a r k e r P a t t e r n   o _ d a t a ,   N y I d M a r k e r P a r a m   o _ p a r a m ) 
 
                 { 
 
                         i f   ( ! t h i s . _ p e r s p e c t i v e _ r e a d e r . s e t S o u r c e S q u a r e ( i _ v e r t e x ) ) 
 
                         { 
 
                                 r e t u r n   f a l s e ; 
 
                         } 
 
                         r e t u r n   t h i s . _ p i c k F r o m R a s t e r ( i _ p i x _ d r v ,   o _ d a t a ,   o _ p a r a m ) ; 
 
                 } 
 
                 / * * 
 
                   *   i _ i m a g e K000i d 00000`0W0~0Y00
 
                   *   o _ d a t a k0o00000000o _ p a r a m k0o0000n0000000ԏtSW0~0Y00
 
                   *   @ p a r a m   i m a g e 
 
                   *   @ p a r a m   i _ v e r t e x 
 
                   *   @ p a r a m   o _ d a t a 
 
                   *   @ p a r a m   o _ p a r a m 
 
                   *   @ r e t u r n 
 
                   *   @ 
 
                   * / 
 
                 p r i v a t e   b o o l   _ p i c k F r o m R a s t e r ( I N y A R G s P i x e l D r i v e r   i _ p i x _ d r v ,   N y I d M a r k e r P a t t e r n   o _ d a t a ,   N y I d M a r k e r P a r a m   o _ p a r a m ) 
 
                 { 
 
                         P e r s p e c t i v e P i x e l R e a d e r . T T h r e s h o l d   t h   =   t h i s . _ _ p i c k F r o m R a s t e r _ t h ; 
 
                         M a r k e r P a t t E n c o d e r   e n c o d e r   =   t h i s . _ _ p i c k F r o m R a s t e r _ e n c o d e r ; 
 
                         / / 000000000S_
 
                         t h i s . _ p e r s p e c t i v e _ r e a d e r . d e t e c t T h r e s h o l d V a l u e ( i _ p i x _ d r v ,   t h ) ; 
 
 
 
                         i f   ( ! t h i s . _ p e r s p e c t i v e _ r e a d e r . r e a d D a t a B i t s ( i _ p i x _ d r v ,   i _ p i x _ d r v . g e t S i z e ( ) ,   t h ,   e n c o d e r ) ) 
 
                         { 
 
                                 r e t u r n   f a l s e ; 
 
                         } 
 
                         i n t   d   =   e n c o d e r . e n c o d e ( o _ d a t a ) ; 
 
                         i f   ( d   <   0 ) 
 
                         { 
 
                                 r e t u r n   f a l s e ; 
 
                         } 
 
                         o _ p a r a m . d i r e c t i o n   =   d ; 
 
                         o _ p a r a m . t h r e s h o l d   =   t h . t h ; 
 
 
 
                         r e t u r n   t r u e ; 
 
                 } 
 
         } 
 
 
 
 
 
 
 
         / * * 
 
           *   { @ l i n k   N y I d M a r k e r P i c k u p } L0000K00P e r s p e c t i v e 	YcW0f00`0Y0_00n0000
 
           *   ;uPQthQ,0bS_W0~0Y00
 
           *   000L0S0n00000OF0S0h0o0B00~0[000
 
           * 
 
           * / 
 
         s e a l e d   c l a s s   P e r s p e c t i v e P i x e l R e a d e r 
 
         { 
 
                 p r i v a t e   s t a t i c   i n t   R E A D _ R E S O L U T I O N   =   1 0 0 ; 
 
                 p r i v a t e   N y A R P e r s p e c t i v e P a r a m G e n e r a t o r   _ p a r a m _ g e n   =   n e w   N y A R P e r s p e c t i v e P a r a m G e n e r a t o r _ O 1 ( 1 ,   1 ) ; 
 
                 p r i v a t e   d o u b l e [ ]   _ c p a r a m   =   n e w   d o u b l e [ 8 ] ; 
 
 
 
                 / * * 
 
                   *   0000000g0Y00
 
                   * / 
 
                 p u b l i c   P e r s p e c t i v e P i x e l R e a d e r ( ) 
 
                 { 
 
                         r e t u r n ; 
 
                 } 
 
                 / * * 
 
                   *   S0n0peo00000V҉b_0000000k0000W0~0Y00
 
                   *   @ p a r a m   i _ v e r t e x 
 
                   *   000Y00V҉b_p^j04  }g0B00_L0B00~0Y00
 
                   *   @ r e t u r n 
 
                   *   bRY00h0t r u e g0Y00
 
                   *   @ 
 
                   * / 
 
                 p u b l i c   b o o l   s e t S o u r c e S q u a r e ( N y A R I n t P o i n t 2 d [ ]   i _ v e r t e x ) 
 
                 { 
 
                         r e t u r n   t h i s . _ p a r a m _ g e n . g e t P a r a m ( R E A D _ R E S O L U T I O N ,   R E A D _ R E S O L U T I O N ,   i _ v e r t e x ,   t h i s . _ c p a r a m ) ; 
 
                 } 
 
                 / * * 
 
                   *   S0n0peo00000V҉b_0000000k0000W0~0Y00
 
                   *   @ p a r a m   i _ v e r t e x 
 
                   *   000Y00V҉b_p^j04  }g0B00_L0B00~0Y00
 
                   *   @ r e t u r n 
 
                   *   bRY00h0t r u e g0Y00
 
                   *   @ 
 
                   * / 
 
                 p u b l i c   b o o l   s e t S o u r c e S q u a r e ( N y A R D o u b l e P o i n t 2 d [ ]   i _ v e r t e x ) 
 
                 { 
 
                         r e t u r n   t h i s . _ p a r a m _ g e n . g e t P a r a m ( R E A D _ R E S O L U T I O N ,   R E A D _ R E S O L U T I O N ,   i _ v e r t e x ,   t h i s . _ c p a r a m ) ; 
 
                 } 
 
 
 
                 / * * 
 
                   *   000K00\q_	YcW0_000000_~0Y00
 
                   *   @ p a r a m   i _ l t _ x 
 
                   *   @ p a r a m   i _ l t _ y 
 
                   *   @ p a r a m   i _ s t e p _ x 
 
                   *   @ p a r a m   i _ s t e p _ y 
 
                   *   @ p a r a m   i _ w i d t h 
 
                   *   @ p a r a m   i _ h e i g h t 
 
                   *   @ p a r a m   i _ o u t _ s t 
 
                   *   <h
}0000o _ p i x e l n0HQ-n0000000
 
                   *   @ p a r a m   o _ p i x e l 
 
                   *   0000000n000000<h
}Y000000
 
                   *   @ 
 
                   * / 
 
                 p r i v a t e   b o o l   r e c t P i x e l s ( I N y A R G s P i x e l D r i v e r   i _ r e a d e r ,   N y A R I n t S i z e   i _ r a s t e r _ s i z e ,   i n t   i _ l t _ x ,   i n t   i _ l t _ y ,   i n t   i _ s t e p _ x ,   i n t   i _ s t e p _ y ,   i n t   i _ w i d t h ,   i n t   i _ h e i g h t ,   i n t   i _ o u t _ s t ,   i n t [ ]   o _ p i x e l ) 
 
                 { 
 
                         d o u b l e [ ]   c p a r a   =   t h i s . _ c p a r a m ; 
 
                         i n t [ ]   r e f _ x   =   t h i s . _ r e f _ x ; 
 
                         i n t [ ]   r e f _ y   =   t h i s . _ r e f _ y ; 
 
                         i n t   r a s t e r _ w i d t h   =   i _ r a s t e r _ s i z e . w ; 
 
                         i n t   r a s t e r _ h e i g h t   =   i _ r a s t e r _ s i z e . h ; 
 
 
 
                         i n t   o u t _ i n d e x   =   i _ o u t _ s t ; 
 
                         d o u b l e   c p a r a _ 6   =   c p a r a [ 6 ] ; 
 
                         d o u b l e   c p a r a _ 0   =   c p a r a [ 0 ] ; 
 
                         d o u b l e   c p a r a _ 3   =   c p a r a [ 3 ] ; 
 
 
 
                         f o r   ( i n t   i   =   0 ;   i   <   i _ h e i g h t ;   i + + ) 
 
                         { 
 
                                 / / 1 RRn00000n0000000$P0{Y000
 
                                 i n t   c y 0   =   1   +   i   *   i _ s t e p _ y   +   i _ l t _ y ; 
 
                                 d o u b l e   c p y 0 _ 1 2   =   c p a r a [ 1 ]   *   c y 0   +   c p a r a [ 2 ] ; 
 
                                 d o u b l e   c p y 0 _ 4 5   =   c p a r a [ 4 ]   *   c y 0   +   c p a r a [ 5 ] ; 
 
                                 d o u b l e   c p y 0 _ 7   =   c p a r a [ 7 ]   *   c y 0   +   1 . 0 ; 
 
                                 i n t   p t   =   0 ; 
 
                                 f o r   ( i n t   i 2   =   0 ;   i 2   <   i _ w i d t h ;   i 2 + + ) 
 
                                 { 
 
                                         i n t   c x 0   =   1   +   i 2   *   i _ s t e p _ x   +   i _ l t _ x ; 
 
                                         d o u b l e   d   =   c p a r a _ 6   *   c x 0   +   c p y 0 _ 7 ; 
 
                                         i n t   x   =   ( i n t ) ( ( c p a r a _ 0   *   c x 0   +   c p y 0 _ 1 2 )   /   d ) ; 
 
                                         i n t   y   =   ( i n t ) ( ( c p a r a _ 3   *   c x 0   +   c p y 0 _ 4 5 )   /   d ) ; 
 
                                         i f   ( x   <   0   | |   y   <   0   | |   x   > =   r a s t e r _ w i d t h   | |   y   > =   r a s t e r _ h e i g h t ) 
 
                                         { 
 
                                                 r e t u r n   f a l s e ; 
 
                                         } 
 
                                         r e f _ x [ p t ]   =   x ; 
 
                                         r e f _ y [ p t ]   =   y ; 
 
                                         p t + + ; 
 
                                 } 
 
                                 / / G S $P0MRk0S_
 
                                 i _ r e a d e r . g e t P i x e l S e t ( r e f _ x ,   r e f _ y ,   i _ w i d t h ,   o _ p i x e l ,   o u t _ i n d e x ) ; 
 
                                 o u t _ i n d e x   + =   i _ w i d t h ; 
 
                         } 
 
                         r e t u r n   t r u e ; 
 
                 } 
 
                 / * * 
 
                   *   0000Rgpe0
 
                   *   i _ f r e q k0B0000000pn0hTgL00I{K0y0~0Y00
 
                   *   !kkJShTgL00MRkn08 0 % 00'YM0O001 2 0 % *gng0B000n000I{hTgg0B00h00j0W0~0Y00
 
                   *   @ p a r a m   i _ f r e q 
 
                   *   @ p a r a m   i _ w i d t h 
 
                   * / 
 
                 p r i v a t e   s t a t i c   b o o l   c h e c k F r e q W i d t h ( i n t [ ]   i _ f r e q ,   i n t   i _ w i d t h ) 
 
                 { 
 
                         i n t   c   =   i _ f r e q [ 1 ]   -   i _ f r e q [ 0 ] ; 
 
                         i n t   c o u n t   =   i _ w i d t h   *   2   -   1 ; 
 
                         f o r   ( i n t   i   =   1 ;   i   <   c o u n t ;   i + + ) 
 
                         { 
 
                                 i n t   n   =   i _ f r e q [ i   +   1 ]   -   i _ f r e q [ i ] ; 
 
                                 i n t   v   =   n   *   1 0 0   /   c ; 
 
                                 i f   ( v   >   1 5 0   | |   v   <   5 0 ) 
 
                                 { 
 
                                         r e t u r n   f a l s e ; 
 
                                 } 
 
                                 c   =   n ; 
 
                         } 
 
                         r e t u r n   t r u e ; 
 
                 } 
 
                 / * * 
 
                   *   0000Rgpe0
 
                   *   i _ f r e q _ c o u n t _ t a b l e h0i _ f r e q _ t a b l e n0Q[0gW00 g0'YM0j0hTlpebR0ԏW0~0Y00
 
                   *   @ p a r a m   i _ f r e q _ c o u n t _ t a b l e 
 
                   *   @ p a r a m   i _ f r e q _ t a b l e 
 
                   *   @ p a r a m   o _ f r e q _ t a b l e 
 
                   *   @ r e t u r n 
 
                   *   d0K00p00 N
N0[Q00p00 *gn
 
                   * / 
 
                 p r i v a t e   s t a t i c   i n t   g e t M a x F r e q ( i n t [ ]   i _ f r e q _ c o u n t _ t a b l e ,   i n t [ ]   i _ f r e q _ t a b l e ,   i n t [ ]   o _ f r e q _ t a b l e ) 
 
                 { 
 
                         / /  NjubRn0'YM0D00n00_0
 
                         i n t   i n d e x   =   - 1 ; 
 
                         i n t   m a x   =   0 ; 
 
                         f o r   ( i n t   i   =   0 ;   i   <   M A X _ F R E Q ;   i + + ) 
 
                         { 
 
                                 i f   ( m a x   <   i _ f r e q _ c o u n t _ t a b l e [ i ] ) 
 
                                 { 
 
                                         i n d e x   =   i ; 
 
                                         m a x   =   i _ f r e q _ c o u n t _ t a b l e [ i ] ; 
 
                                 } 
 
                         } 
 
                         i f   ( i n d e x   = =   - 1 ) 
 
                         { 
 
                                 r e t u r n   - 1 ; 
 
                         } 
 
                         / * hTlpe000000{* / 
 
                         i n t   s t   =   ( i n d e x   -   1 )   *   i n d e x ; 
 
                         f o r   ( i n t   i   =   0 ;   i   <   i n d e x   *   2 ;   i + + ) 
 
                         { 
 
                                 o _ f r e q _ t a b l e [ i ]   =   i _ f r e q _ t a b l e [ s t   +   i ]   *   F R Q _ S T E P   /   m a x ; 
 
                         } 
 
                         r e t u r n   i n d e x ; 
 
                 } 
 
 
 
 
 
                 / / 000000000(un00000( F R Q _ P O I N T S * F R Q _ S T E P L01 0 0 0H0j0D00F0k0Y00S0h0) 
 
                 p r i v a t e   c o n s t   i n t   F R Q _ E D G E   =   5 ; 
 
                 p r i v a t e   c o n s t   i n t   F R Q _ S T E P   =   2 ; 
 
                 p r i v a t e   c o n s t   i n t   F R Q _ P O I N T S   =   ( 1 0 0   -   ( F R Q _ E D G E   *   2 ) )   /   F R Q _ S T E P ; 
 
 
 
 
 
                 p r i v a t e   c o n s t   i n t   M I N _ F R E Q   =   3 ; 
 
                 p r i v a t e   c o n s t   i n t   M A X _ F R E Q   =   1 0 ; 
 
                 p r i v a t e   c o n s t   i n t   F R E Q _ S A M P L E _ N U M   =   4 ; 
 
                 p r i v a t e   c o n s t   i n t   M A X _ D A T A _ B I T S   =   M A X _ F R E Q   +   M A X _ F R E Q   -   1 ; 
 
 
 
                 p r i v a t e   r e a d o n l y   i n t [ ]   _ r e f _ x   =   n e w   i n t [ 1 0 8 ] ; 
 
                 p r i v a t e   r e a d o n l y   i n t [ ]   _ r e f _ y   =   n e w   i n t [ 1 0 8 ] ; 
 
                 / / ( m o d e l + 1 ) * 4 h0T H R E S H O L D _ P I X E L n0i0a00K0'YM0D0e
 
                 p r i v a t e   i n t [ ]   _ p i x c e l _ t e m p   =   n e w   i n t [ 1 0 8 ] ; 
 
 
 
                 p r i v a t e   r e a d o n l y   i n t [ ]   _ f r e q _ c o u n t _ t a b l e   =   n e w   i n t [ M A X _ F R E Q ] ; 
 
                 p r i v a t e   r e a d o n l y   i n t [ ]   _ f r e q _ t a b l e   =   n e w   i n t [ ( M A X _ F R E Q   *   2   -   1 )   *   M A X _ F R E Q   *   2   /   2 ] ; 
 
 
 
                 / * * 
 
                   *   S0n0peo00000;uPn0i _ y 1 Lvh0i _ y 2 Lv0s^GWW0f00000000000n0hTlpe0_~0Y00
 
                   *   L = fp0H = fp0L H L = 1 hTgh0W0f00_0h0H0p0L H L H L n04XTo02 0ԏW0~0Y00L H L H 0H L H L I{n0Yzh0B}zn0000L0puj0000000
 
                   *   iQW0_04XT0peo01YWeW0~0Y00
 
                   *   @ p a r a m   i _ y 1 
 
                   *   0001 n000000
 
                   *   @ p a r a m   i _ t h _ h 
 
                   *   fpn0weE\$P
 
                   *   @ p a r a m   i _ t h _ l 
 
                   *   fpn0weE\$P
 
                   *   @ p a r a m   o _ e d g e _ i n d e x 
 
                   *   iQW0_0000MOn( H - > L , L - > H ) n0000000SQ0S0MR0
 
                   *   [ F R Q _ P O I N T S ] N
Nn0MR0c[Y00S0h00
 
                   *   @ r e t u r n 
 
                   *   hTlpen0$P01YWeY00h0- 1 
 
                   *   @ 
 
                   * / 
 
                 p u b l i c   i n t   g e t R o w F r e q u e n c y ( I N y A R G s P i x e l D r i v e r   i _ r e a d e r ,   N y A R I n t S i z e   i _ r a s t e r _ s i z e ,   i n t   i _ y 1 ,   i n t   i _ t h _ h ,   i n t   i _ t h _ l ,   i n t [ ]   o _ e d g e _ i n d e x ) 
 
                 { 
 
                         / / 3 , 4 , 5 , 6 , 7 , 8 , 9 , 1 0 
 
                         i n t [ ]   f r e q _ c o u n t _ t a b l e   =   t h i s . _ f r e q _ c o u n t _ t a b l e ; 
 
                         / / 0 , 2 , 4 , 6 , 8 , 1 0 , 1 2 , 1 4 , 1 6 , 1 8 , 2 0 n0 }0cd0MR
 
                         i n t [ ]   f r e q _ t a b l e   =   t h i s . _ f r e q _ t a b l e ; 
 
                         / / RgS
 
                         d o u b l e [ ]   c p a r a   =   t h i s . _ c p a r a m ; 
 
                         i n t [ ]   r e f _ x   =   t h i s . _ r e f _ x ; 
 
                         i n t [ ]   r e f _ y   =   t h i s . _ r e f _ y ; 
 
                         i n t [ ]   p i x c e l _ t e m p   =   t h i s . _ p i x c e l _ t e m p ; 
 
                         f o r   ( i n t   i   =   0 ;   i   <   1 0 ;   i + + ) 
 
                         { 
 
                                 f r e q _ c o u n t _ t a b l e [ i ]   =   0 ; 
 
                         } 
 
                         f o r   ( i n t   i   =   0 ;   i   <   1 1 0 ;   i + + ) 
 
                         { 
 
                                 f r e q _ t a b l e [ i ]   =   0 ; 
 
                         } 
 
                         i n t   r a s t e r _ w i d t h   =   i _ r a s t e r _ s i z e . w ; 
 
                         i n t   r a s t e r _ h e i g h t   =   i _ r a s t e r _ s i z e . h ; 
 
 
 
                         d o u b l e   c p a r a _ 0   =   c p a r a [ 0 ] ; 
 
                         d o u b l e   c p a r a _ 3   =   c p a r a [ 3 ] ; 
 
                         d o u b l e   c p a r a _ 6   =   c p a r a [ 6 ] ; 
 
 
 
                         / / 1 0 - 2 0 0000vK000000000000iQ
 
                         f o r   ( i n t   i   =   0 ;   i   <   F R E Q _ S A M P L E _ N U M ;   i + + ) 
 
                         { 
 
                                 / / 2 LRn000000000000{
 
                                 d o u b l e   c y 0   =   1   +   i _ y 1   +   i ; 
 
                                 d o u b l e   c p y 0 _ 1 2   =   c p a r a [ 1 ]   *   c y 0   +   c p a r a [ 2 ] ; 
 
                                 d o u b l e   c p y 0 _ 4 5   =   c p a r a [ 4 ]   *   c y 0   +   c p a r a [ 5 ] ; 
 
                                 d o u b l e   c p y 0 _ 7   =   c p a r a [ 7 ]   *   c y 0   +   1 . 0 ; 
 
 
 
                                 i n t   p t   =   0 ; 
 
                                 f o r   ( i n t   i 2   =   0 ;   i 2   <   F R Q _ P O I N T S ;   i 2 + + ) 
 
                                 { 
 
                                         d o u b l e   c x 0   =   1   +   i 2   *   F R Q _ S T E P   +   F R Q _ E D G E ; 
 
                                         d o u b l e   d   =   ( c p a r a _ 6   *   c x 0 )   +   c p y 0 _ 7 ; 
 
                                         i n t   x   =   ( i n t ) ( ( c p a r a _ 0   *   c x 0   +   c p y 0 _ 1 2 )   /   d ) ; 
 
                                         i n t   y   =   ( i n t ) ( ( c p a r a _ 3   *   c x 0   +   c p y 0 _ 4 5 )   /   d ) ; 
 
                                         i f   ( x   <   0   | |   y   <   0   | |   x   > =   r a s t e r _ w i d t h   | |   y   > =   r a s t e r _ h e i g h t ) 
 
                                         { 
 
                                                 r e t u r n   - 1 ; 
 
                                         } 
 
                                         r e f _ x [ p t ]   =   x ; 
 
                                         r e f _ y [ p t ]   =   y ; 
 
                                         p t + + ; 
 
                                 } 
 
 
 
                                 / / 00000S_( eQR;uP0YiSY00j00S0S0K00HQ0teY00S0h0) 
 
                                 i _ r e a d e r . g e t P i x e l S e t ( r e f _ x ,   r e f _ y ,   F R Q _ P O I N T S ,   p i x c e l _ t e m p ,   0 ) ; 
 
 
 
                                 / / o _ e d g e _ i n d e x 0 NBfvk04xXW0f0gY00
 
                                 i n t   f r e q _ t   =   g e t F r e q I n f o ( p i x c e l _ t e m p ,   i _ t h _ h ,   i _ t h _ l ,   o _ e d g e _ i n d e x ) ; 
 
 
 
                                 / / hTgo03 - 1 0 g0B00S0h0
 
                                 i f   ( f r e q _ t   <   M I N _ F R E Q   | |   f r e q _ t   >   M A X _ F R E Q ) 
 
                                 { 
 
                                         c o n t i n u e ; 
 
                                 } 
 
                                 / / hTgo0I{g0B00S0h0
 
                                 i f   ( ! c h e c k F r e q W i d t h ( o _ e d g e _ i n d e x ,   f r e q _ t ) ) 
 
                                 { 
 
                                         c o n t i n u e ; 
 
                                 } 
 
                                 / / iQ00000R
 
                                 f r e q _ c o u n t _ t a b l e [ f r e q _ t ] + + ; 
 
                                 i n t   t a b l e _ s t   =   ( f r e q _ t   -   1 )   *   f r e q _ t ; 
 
                                 f o r   ( i n t   i 2   =   0 ;   i 2   <   f r e q _ t   *   2 ;   i 2 + + ) 
 
                                 { 
 
                                         f r e q _ t a b l e [ t a b l e _ s t   +   i 2 ]   + =   o _ e d g e _ i n d e x [ i 2 ] ; 
 
                                 } 
 
                         } 
 
                         r e t u r n   g e t M a x F r e q ( f r e q _ c o u n t _ t a b l e ,   f r e q _ t a b l e ,   o _ e d g e _ i n d e x ) ; 
 
                 } 
 
                 / * * 
 
                   *   S0n0peo00000;uPn0i _ x 1 Rvh0i _ x 2 Rv0s^GWW0f00000000000n0hTlpe0_~0Y00
 
                   *   L = fp0H = fp0L H L = 1 hTgh0W0f00_0h0H0p0L H L H L n04XTo02 0ԏW0~0Y00L H L H 0H L H L I{n0Yzh0B}zn0000L0puj0000000
 
                   *   iQW0_04XT0peo01YWeW0~0Y00
 
                   *   @ p a r a m   i _ x 1 
 
                   *   0001 n000000
 
                   *   @ p a r a m   i _ t h _ h 
 
                   *   fpn0weE\$P
 
                   *   @ p a r a m   i _ t h _ l 
 
                   *   fpn0weE\$P
 
                   *   @ p a r a m   o _ e d g e _ i n d e x 
 
                   *   iQW0_0000MOn( H - > L , L - > H ) n0000000SQ0S0MR0
 
                   *   [ F R Q _ P O I N T S ] N
Nn0MR0c[Y00S0h00
 
                   *   @ r e t u r n 
 
                   *   hTlpen0$P01YWeY00h0- 1 
 
                   *   @ 
 
                   * / 
 
                 p u b l i c   i n t   g e t C o l F r e q u e n c y ( I N y A R G s P i x e l D r i v e r   i _ r e a d e r ,   N y A R I n t S i z e   i _ r a s t e r _ s i z e ,   i n t   i _ x 1 ,   i n t   i _ t h _ h ,   i n t   i _ t h _ l ,   i n t [ ]   o _ e d g e _ i n d e x ) 
 
                 { 
 
                         d o u b l e [ ]   c p a r a   =   t h i s . _ c p a r a m ; 
 
                         i n t [ ]   r e f _ x   =   t h i s . _ r e f _ x ; 
 
                         i n t [ ]   r e f _ y   =   t h i s . _ r e f _ y ; 
 
                         i n t [ ]   p i x c e l _ t e m p   =   t h i s . _ p i x c e l _ t e m p ; 
 
                         / / 0 , 2 , 4 , 6 , 8 , 1 0 , 1 2 , 1 4 , 1 6 , 1 8 , 2 0 = ( 1 1 * 2 0 ) / 2 = 1 1 0 
 
                         / / RgS
 
                         i n t [ ]   f r e q _ c o u n t _ t a b l e   =   t h i s . _ f r e q _ c o u n t _ t a b l e ; 
 
                         f o r   ( i n t   i   =   0 ;   i   <   1 0 ;   i + + ) 
 
                         { 
 
                                 f r e q _ c o u n t _ t a b l e [ i ]   =   0 ; 
 
                         } 
 
                         i n t [ ]   f r e q _ t a b l e   =   t h i s . _ f r e q _ t a b l e ; 
 
                         f o r   ( i n t   i   =   0 ;   i   <   1 1 0 ;   i + + ) 
 
                         { 
 
                                 f r e q _ t a b l e [ i ]   =   0 ; 
 
                         } 
 
                         i n t   r a s t e r _ w i d t h   =   i _ r a s t e r _ s i z e . w ; 
 
                         i n t   r a s t e r _ h e i g h t   =   i _ r a s t e r _ s i z e . h ; 
 
 
 
 
 
                         d o u b l e   c p a r a 7   =   c p a r a [ 7 ] ; 
 
                         d o u b l e   c p a r a 4   =   c p a r a [ 4 ] ; 
 
                         d o u b l e   c p a r a 1   =   c p a r a [ 1 ] ; 
 
                         / / WnpK004 00000Sgq0000h0W0f0bQ
 
                         f o r   ( i n t   i   =   0 ;   i   <   F R E Q _ S A M P L E _ N U M ;   i + + ) 
 
                         { 
 
 
 
                                 i n t   c x 0   =   1   +   i   +   i _ x 1 ; 
 
                                 d o u b l e   c p 6 _ 0   =   c p a r a [ 6 ]   *   c x 0 ; 
 
                                 d o u b l e   c p x 0 _ 0   =   c p a r a [ 0 ]   *   c x 0   +   c p a r a [ 2 ] ; 
 
                                 d o u b l e   c p x 3 _ 0   =   c p a r a [ 3 ]   *   c x 0   +   c p a r a [ 5 ] ; 
 
 
 
                                 i n t   p t   =   0 ; 
 
                                 f o r   ( i n t   i 2   =   0 ;   i 2   <   F R Q _ P O I N T S ;   i 2 + + ) 
 
                                 { 
 
                                         i n t   c y   =   1   +   i 2   *   F R Q _ S T E P   +   F R Q _ E D G E ; 
 
 
 
                                         d o u b l e   d   =   c p 6 _ 0   +   c p a r a 7   *   c y   +   1 . 0 ; 
 
                                         i n t   x   =   ( i n t ) ( ( c p x 0 _ 0   +   c p a r a 1   *   c y )   /   d ) ; 
 
                                         i n t   y   =   ( i n t ) ( ( c p x 3 _ 0   +   c p a r a 4   *   c y )   /   d ) ; 
 
                                         i f   ( x   <   0   | |   y   <   0   | |   x   > =   r a s t e r _ w i d t h   | |   y   > =   r a s t e r _ h e i g h t ) 
 
                                         { 
 
                                                 r e t u r n   - 1 ; 
 
                                         } 
 
                                         r e f _ x [ p t ]   =   x ; 
 
                                         r e f _ y [ p t ]   =   y ; 
 
                                         p t + + ; 
 
                                 } 
 
 
 
                                 / / 00000S_( eQR;uP0YiSY00j00S0S00teY00S0h0) 
 
                                 i _ r e a d e r . g e t P i x e l S e t ( r e f _ x ,   r e f _ y ,   F R Q _ P O I N T S ,   p i x c e l _ t e m p ,   0 ) ; 
 
 
 
                                 i n t   f r e q _ t   =   g e t F r e q I n f o ( p i x c e l _ t e m p ,   i _ t h _ h ,   i _ t h _ l ,   o _ e d g e _ i n d e x ) ; 
 
                                 / / hTgo03 - 1 0 g0B00S0h0
 
                                 i f   ( f r e q _ t   <   M I N _ F R E Q   | |   f r e q _ t   >   M A X _ F R E Q ) 
 
                                 { 
 
                                         c o n t i n u e ; 
 
                                 } 
 
                                 / / hTgo0I{g0B00S0h0
 
                                 i f   ( ! c h e c k F r e q W i d t h ( o _ e d g e _ i n d e x ,   f r e q _ t ) ) 
 
                                 { 
 
                                         c o n t i n u e ; 
 
                                 } 
 
                                 / / iQ00000R
 
                                 f r e q _ c o u n t _ t a b l e [ f r e q _ t ] + + ; 
 
                                 i n t   t a b l e _ s t   =   ( f r e q _ t   -   1 )   *   f r e q _ t ; 
 
                                 f o r   ( i n t   i 2   =   0 ;   i 2   <   f r e q _ t   *   2 ;   i 2 + + ) 
 
                                 { 
 
                                         f r e q _ t a b l e [ t a b l e _ s t   +   i 2 ]   + =   o _ e d g e _ i n d e x [ i 2 ] ; 
 
                                 } 
 
                         } 
 
                         r e t u r n   g e t M a x F r e q ( f r e q _ c o u n t _ t a b l e ,   f r e q _ t a b l e ,   o _ e d g e _ i n d e x ) ; 
 
                 } 
 
 
 
                 / * * 
 
                   *   0000Y00`00s t a t i c k0W0f0J0K
 
                   *   @ p a r a m   i _ g s _ p i x e l s 
 
                   *   @ p a r a m   i _ t h _ h 
 
                   *   @ p a r a m   i _ t h _ l 
 
                   *   @ p a r a m   o _ e d g e _ i n d e x 
 
                   *   @ r e t u r n 
 
                   * / 
 
                 p r i v a t e   s t a t i c   i n t   g e t F r e q I n f o ( i n t [ ]   i _ g s _ p i x e l s ,   i n t   i _ t h _ h ,   i n t   i _ t h _ l ,   i n t [ ]   o _ e d g e _ i n d e x ) 
 
                 { 
 
                         / / 00000㉐gW0f00hTlpe0{
 
                         i n t   i   =   0 ; 
 
                         i n t   f r q _ l 2 h   =   0 ; 
 
                         i n t   f r q _ h 2 l   =   0 ; 
 
                         w h i l e   ( i   <   F R Q _ P O I N T S ) 
 
                         { 
 
                                 / / L - > H 00000iQY00
 
                                 w h i l e   ( i   <   F R Q _ P O I N T S ) 
 
                                 { 
 
                                         / / 	 	 	 	 c o n s t   i n t   i n d e x = i * 3 ; 
 
                                         / / 	 	 	 	 c o n s t   i n t   p i x = ( i _ g s _ p i x e l s [ i n d e x + 0 ] + i _ g s _ p i x e l s [ i n d e x + 1 ] + i _ g s _ p i x e l s [ i n d e x + 2 ] ) / 3 ; 
 
                                         i f   ( i _ g s _ p i x e l s [ i ]   >   i _ t h _ h ) 
 
                                         { 
 
                                                 / / 0000zv
 
                                                 o _ e d g e _ i n d e x [ f r q _ l 2 h   +   f r q _ h 2 l ]   =   i ; 
 
                                                 f r q _ l 2 h + + ; 
 
                                                 b r e a k ; 
 
                                         } 
 
                                         i + + ; 
 
                                 } 
 
                                 i + + ; 
 
                                 / / L - > H 00000iQY00
 
                                 w h i l e   ( i   <   F R Q _ P O I N T S ) 
 
                                 { 
 
                                         / / 	 	 	 	 c o n s t   i n t   i n d e x = i * 3 ; 
 
                                         / / 	 	 	 	 c o n s t   i n t   p i x = ( i _ g s _ p i x e l s [ i n d e x + 0 ] + i _ g s _ p i x e l s [ i n d e x + 1 ] + i _ g s _ p i x e l s [ i n d e x + 2 ] ) / 3 ; 
 
                                         i f   ( i _ g s _ p i x e l s [ i ]   < =   i _ t h _ l ) 
 
                                         { 
 
                                                 / / 0000zv
 
                                                 o _ e d g e _ i n d e x [ f r q _ l 2 h   +   f r q _ h 2 l ]   =   i ; 
 
                                                 f r q _ h 2 l + + ; 
 
                                                 b r e a k ; 
 
                                         } 
 
                                         i + + ; 
 
                                 } 
 
                                 i + + ; 
 
                         } 
 
                         r e t u r n   f r q _ l 2 h   = =   f r q _ h 2 l   ?   f r q _ l 2 h   :   - 1 ; 
 
                 } 
 
 
 
                 p r i v a t e   c o n s t   i n t   T H R E S H O L D _ E D G E   =   1 0 ; 
 
                 p r i v a t e   c o n s t   i n t   T H R E S H O L D _ S T E P   =   2 ; 
 
                 p r i v a t e   c o n s t   i n t   T H R E S H O L D _ W I D T H   =   1 0 ; 
 
                 p r i v a t e   c o n s t   i n t   T H R E S H O L D _ P I X E L   =   T H R E S H O L D _ W I D T H   /   T H R E S H O L D _ S T E P ; 
 
                 p r i v a t e   c o n s t   i n t   T H R E S H O L D _ S A M P L E   =   T H R E S H O L D _ P I X E L   *   T H R E S H O L D _ P I X E L ; 
 
                 p r i v a t e   c o n s t   i n t   T H R E S H O L D _ S A M P L E _ L T   =   T H R E S H O L D _ E D G E ; 
 
                 p r i v a t e   c o n s t   i n t   T H R E S H O L D _ S A M P L E _ R B   =   1 0 0   -   T H R E S H O L D _ W I D T H   -   T H R E S H O L D _ E D G E ; 
 
                 / * * 
 
                   *   weE\$Pn0OcW
 
                   * / 
 
                 p u b l i c   c l a s s   T T h r e s h o l d 
 
                 { 
 
                         p u b l i c   i n t   t h _ h ; 
 
                         p u b l i c   i n t   t h _ l ; 
 
                         p u b l i c   i n t   t h ; 
 
                         p u b l i c   i n t   l t _ x ; 
 
                         p u b l i c   i n t   l t _ y ; 
 
                         p u b l i c   i n t   r b _ x ; 
 
                         p u b l i c   i n t   r b _ y ; 
 
                 } 
 
                 / * * 
 
                   *   H / L n0OcW
 
                   * / 
 
                 c l a s s   T H i g h A n d L o w 
 
                 { 
 
                         p u b l i c   i n t   h ; 
 
                         p u b l i c   i n t   l ; 
 
                 } 
 
                 / * * 
 
                   *   0000MRn0
NMO0NMOn04 0000n00000$Ps^GW0Bl0~0Y00
 
                   *   S0n0peo00( 4 / i _ p i x c e l . l e n g t h ) n0W0`S	gY00P t a i l lg0SeTn0$P0Bl00S0h0k0j00~0Y00
 
                   *   @ p a r a m   i _ p i x c e l 
 
                   *   @ p a r a m   i _ i n i t i a l 
 
                   *   @ p a r a m   i _ o u t 
 
                   * / 
 
                 p r i v a t e   v o i d   g e t P t a i l H i g h A n d L o w ( i n t [ ]   i _ p i x c e l ,   T H i g h A n d L o w   i _ o u t ) 
 
                 { 
 
                         i n t   h 3 ,   h 2 ,   h 1 ,   h 0 ,   l 3 ,   l 2 ,   l 1 ,   l 0 ; 
 
                         h 3   =   h 2   =   h 1   =   h 0   =   l 3   =   l 2   =   l 1   =   l 0   =   i _ p i x c e l [ 0 ] ; 
 
 
 
                         f o r   ( i n t   i   =   i _ p i x c e l . L e n g t h   -   1 ;   i   > =   1 ;   i - - ) 
 
                         { 
 
                                 i n t   p i x   =   i _ p i x c e l [ i ] ; 
 
                                 i f   ( h 0   <   p i x ) 
 
                                 { 
 
                                         i f   ( h 1   <   p i x ) 
 
                                         { 
 
                                                 i f   ( h 2   <   p i x ) 
 
                                                 { 
 
                                                         i f   ( h 3   <   p i x ) 
 
                                                         { 
 
                                                                 h 0   =   h 1 ; 
 
                                                                 h 1   =   h 2 ; 
 
                                                                 h 2   =   h 3 ; 
 
                                                                 h 3   =   p i x ; 
 
                                                         } 
 
                                                         e l s e 
 
                                                         { 
 
                                                                 h 0   =   h 1 ; 
 
                                                                 h 1   =   h 2 ; 
 
                                                                 h 2   =   p i x ; 
 
                                                         } 
 
                                                 } 
 
                                                 e l s e 
 
                                                 { 
 
                                                         h 0   =   h 1 ; 
 
                                                         h 1   =   p i x ; 
 
                                                 } 
 
                                         } 
 
                                         e l s e 
 
                                         { 
 
                                                 h 0   =   p i x ; 
 
                                         } 
 
                                 } 
 
                                 i f   ( l 0   >   p i x ) 
 
                                 { 
 
                                         i f   ( l 1   >   p i x ) 
 
                                         { 
 
                                                 i f   ( l 2   >   p i x ) 
 
                                                 { 
 
                                                         i f   ( l 3   >   p i x ) 
 
                                                         { 
 
                                                                 l 0   =   l 1 ; 
 
                                                                 l 1   =   l 2 ; 
 
                                                                 l 2   =   l 3 ; 
 
                                                                 l 3   =   p i x ; 
 
                                                         } 
 
                                                         e l s e 
 
                                                         { 
 
                                                                 l 0   =   l 1 ; 
 
                                                                 l 1   =   l 2 ; 
 
                                                                 l 2   =   p i x ; 
 
                                                         } 
 
                                                 } 
 
                                                 e l s e 
 
                                                 { 
 
                                                         l 0   =   l 1 ; 
 
                                                         l 1   =   p i x ; 
 
                                                 } 
 
                                         } 
 
                                         e l s e 
 
                                         { 
 
                                                 l 0   =   p i x ; 
 
                                         } 
 
                                 } 
 
                         } 
 
                         i _ o u t . l   =   ( l 0   +   l 1   +   l 2   +   l 3 )   /   4 ; 
 
                         i _ o u t . h   =   ( h 0   +   h 1   +   h 2   +   h 3 )   /   4 ; 
 
                         r e t u r n ; 
 
                 } 
 
                 p r i v a t e   T H i g h A n d L o w   _ _ d e t e c t T h r e s h o l d V a l u e _ h l   =   n e w   T H i g h A n d L o w ( ) ; 
 
                 p r i v a t e   N y A R I n t P o i n t 2 d   _ _ d e t e c t T h r e s h o l d V a l u e _ t p t   =   n e w   N y A R I n t P o i n t 2 d ( ) ; 
 
                 p r i v a t e   i n t [ ]   _ t h _ p i x e l s   =   n e w   i n t [ T H R E S H O L D _ S A M P L E   *   4 ] ; 
 
                 / * * 
 
                   *   S0n0peo00000000K000weE\$P0zl[W0~0Y00
 
                   *   @ p a r a m   i _ r e a d e r 
 
                   *   000000000000
 
                   *   @ p a r a m   i _ r a s t e r _ s i z e 
 
                   *   00n00n0000
 
                   *   @ p a r a m   o _ t h r e s h o l d 
 
                   *   weE\$P0SQ0S0000000
 
                   *   @ 
 
                   * / 
 
                 p u b l i c   v o i d   d e t e c t T h r e s h o l d V a l u e ( I N y A R G s P i x e l D r i v e r   i _ r e a d e r ,   T T h r e s h o l d   o _ t h r e s h o l d ) 
 
                 { 
 
                         i n t [ ]   t h _ p i x e l s   =   t h i s . _ t h _ p i x e l s ; 
 
                         N y A R I n t S i z e   s i z e   =   i _ r e a d e r . g e t S i z e ( ) ; 
 
                         / / ]
Nn0000000WK0000000_0( 0 0 - 2 4 ) 
 
                         r e c t P i x e l s ( i _ r e a d e r ,   s i z e ,   T H R E S H O L D _ S A M P L E _ L T ,   T H R E S H O L D _ S A M P L E _ L T ,   T H R E S H O L D _ S T E P ,   T H R E S H O L D _ S T E P ,   T H R E S H O L D _ P I X E L ,   T H R E S H O L D _ P I X E L ,   0 ,   t h _ p i x e l s ) ; 
 
 
 
                         / / ]Nn0000000WK0000000_0( 2 5 - 4 9 ) 
 
                         r e c t P i x e l s ( i _ r e a d e r ,   s i z e ,   T H R E S H O L D _ S A M P L E _ L T ,   T H R E S H O L D _ S A M P L E _ R B ,   T H R E S H O L D _ S T E P ,   T H R E S H O L D _ S T E P ,   T H R E S H O L D _ P I X E L ,   T H R E S H O L D _ P I X E L ,   T H R E S H O L D _ S A M P L E ,   t h _ p i x e l s ) ; 
 
 
 
                         / / S
Nn0000000WK0000000_0( 5 0 - 7 4 ) 
 
                         r e c t P i x e l s ( i _ r e a d e r ,   s i z e ,   T H R E S H O L D _ S A M P L E _ R B ,   T H R E S H O L D _ S A M P L E _ L T ,   T H R E S H O L D _ S T E P ,   T H R E S H O L D _ S T E P ,   T H R E S H O L D _ P I X E L ,   T H R E S H O L D _ P I X E L ,   T H R E S H O L D _ S A M P L E   *   2 ,   t h _ p i x e l s ) ; 
 
 
 
                         / / SNn0000000WK0000000_0( 7 5 - 9 9 ) 
 
                         r e c t P i x e l s ( i _ r e a d e r ,   s i z e ,   T H R E S H O L D _ S A M P L E _ R B ,   T H R E S H O L D _ S A M P L E _ R B ,   T H R E S H O L D _ S T E P ,   T H R E S H O L D _ S T E P ,   T H R E S H O L D _ P I X E L ,   T H R E S H O L D _ P I X E L ,   T H R E S H O L D _ S A M P L E   *   3 ,   t h _ p i x e l s ) ; 
 
 
 
                         T H i g h A n d L o w   h l   =   t h i s . _ _ d e t e c t T h r e s h o l d V a l u e _ h l ; 
 
                         / / P t a i l g0Bl0_00000s^GW
 
                         g e t P t a i l H i g h A n d L o w ( t h _ p i x e l s ,   h l ) ; 
 
 
 
 
 
 
 
                         / / $P-N_
 
                         i n t   t h   =   ( h l . h   +   h l . l )   /   2 ; 
 
                         / / 000000( ]Rn02 0 % ) 
 
                         i n t   t h _ s u b   =   ( h l . h   -   h l . l )   /   5 ; 
 
 
 
                         o _ t h r e s h o l d . t h   =   t h ; 
 
                         o _ t h r e s h o l d . t h _ h   =   t h   +   t h _ s u b ; / / 000000NM0$P
 
                         o _ t h r e s h o l d . t h _ l   =   t h   -   t h _ s u b ; / / 000000NM0$P
 
 
 
                         / / 0000{( fp͑_) 
 
                         i n t   l t _ x ,   l t _ y ,   l b _ x ,   l b _ y ,   r t _ x ,   r t _ y ,   r b _ x ,   r b _ y ; 
 
                         N y A R I n t P o i n t 2 d   t p t   =   t h i s . _ _ d e t e c t T h r e s h o l d V a l u e _ t p t ; 
 
                         / / L T 
 
                         i f   ( g e t H i g h P i x e l C e n t e r ( 0 ,   t h _ p i x e l s ,   T H R E S H O L D _ P I X E L ,   T H R E S H O L D _ P I X E L ,   t h ,   t p t ) ) 
 
                         { 
 
                                 l t _ x   =   t p t . x   *   T H R E S H O L D _ S T E P ; 
 
                                 l t _ y   =   t p t . y   *   T H R E S H O L D _ S T E P ; 
 
                         } 
 
                         e l s e 
 
                         { 
 
                                 l t _ x   =   1 1 ; 
 
                                 l t _ y   =   1 1 ; 
 
                         } 
 
                         / / L B 
 
                         i f   ( g e t H i g h P i x e l C e n t e r ( T H R E S H O L D _ S A M P L E   *   1 ,   t h _ p i x e l s ,   T H R E S H O L D _ P I X E L ,   T H R E S H O L D _ P I X E L ,   t h ,   t p t ) ) 
 
                         { 
 
                                 l b _ x   =   t p t . x   *   T H R E S H O L D _ S T E P ; 
 
                                 l b _ y   =   t p t . y   *   T H R E S H O L D _ S T E P ; 
 
                         } 
 
                         e l s e 
 
                         { 
 
                                 l b _ x   =   1 1 ; 
 
                                 l b _ y   =   - 1 ; 
 
                         } 
 
                         / / R T 
 
                         i f   ( g e t H i g h P i x e l C e n t e r ( T H R E S H O L D _ S A M P L E   *   2 ,   t h _ p i x e l s ,   T H R E S H O L D _ P I X E L ,   T H R E S H O L D _ P I X E L ,   t h ,   t p t ) ) 
 
                         { 
 
                                 r t _ x   =   t p t . x   *   T H R E S H O L D _ S T E P ; 
 
                                 r t _ y   =   t p t . y   *   T H R E S H O L D _ S T E P ; 
 
                         } 
 
                         e l s e 
 
                         { 
 
                                 r t _ x   =   - 1 ; 
 
                                 r t _ y   =   1 1 ; 
 
                         } 
 
                         / / R B 
 
                         i f   ( g e t H i g h P i x e l C e n t e r ( T H R E S H O L D _ S A M P L E   *   3 ,   t h _ p i x e l s ,   T H R E S H O L D _ P I X E L ,   T H R E S H O L D _ P I X E L ,   t h ,   t p t ) ) 
 
                         { 
 
                                 r b _ x   =   t p t . x   *   T H R E S H O L D _ S T E P ; 
 
                                 r b _ y   =   t p t . y   *   T H R E S H O L D _ S T E P ; 
 
                         } 
 
                         e l s e 
 
                         { 
 
                                 r b _ x   =   - 1 ; 
 
                                 r b _ y   =   - 1 ; 
 
                         } 
 
                         / / 000000YMOnn0zl[
 
                         o _ t h r e s h o l d . l t _ x   =   ( l t _ x   +   l b _ x )   /   2   +   T H R E S H O L D _ S A M P L E _ L T   -   1 ; 
 
                         o _ t h r e s h o l d . r b _ x   =   ( r t _ x   +   r b _ x )   /   2   +   T H R E S H O L D _ S A M P L E _ R B   +   1 ; 
 
                         o _ t h r e s h o l d . l t _ y   =   ( l t _ y   +   r t _ y )   /   2   +   T H R E S H O L D _ S A M P L E _ L T   -   1 ; 
 
                         o _ t h r e s h o l d . r b _ y   =   ( l b _ y   +   r b _ y )   /   2   +   T H R E S H O L D _ S A M P L E _ R B   +   1 ; 
 
                         r e t u r n ; 
 
                 } 
 
 
 
                 p r i v a t e   b o o l   g e t H i g h P i x e l C e n t e r ( i n t   i _ s t ,   i n t [ ]   i _ p i x e l s ,   i n t   i _ w i d t h ,   i n t   i _ h e i g h t ,   i n t   i _ t h ,   N y A R I n t P o i n t 2 d   o _ p o i n t ) 
 
                 { 
 
                         i n t   r p   =   i _ s t ; 
 
                         i n t   p o s _ x   =   0 ; 
 
                         i n t   p o s _ y   =   0 ; 
 
                         i n t   n u m b e r _ o f _ p o s   =   0 ; 
 
                         f o r   ( i n t   i   =   0 ;   i   <   i _ h e i g h t ;   i + + ) 
 
                         { 
 
                                 f o r   ( i n t   i 2   =   0 ;   i 2   <   i _ w i d t h ;   i 2 + + ) 
 
                                 { 
 
                                         i f   ( i _ p i x e l s [ r p + + ]   >   i _ t h ) 
 
                                         { 
 
                                                 p o s _ x   + =   i 2 ; 
 
                                                 p o s _ y   + =   i ; 
 
                                                 n u m b e r _ o f _ p o s + + ; 
 
                                         } 
 
                                 } 
 
                         } 
 
                         i f   ( n u m b e r _ o f _ p o s   >   0 ) 
 
                         { 
 
                                 p o s _ x   / =   n u m b e r _ o f _ p o s ; 
 
                                 p o s _ y   / =   n u m b e r _ o f _ p o s ; 
 
                         } 
 
                         e l s e 
 
                         { 
 
                                 r e t u r n   f a l s e ; 
 
                         } 
 
                         o _ p o i n t . x   =   p o s _ x ; 
 
                         o _ p o i n t . y   =   p o s _ y ; 
 
                         r e t u r n   t r u e ; 
 
                 } 
 
                 p r i v a t e   i n t [ ]   _ _ d e t e c t D a t a B i t s I n d e x _ f r e q _ i n d e x 1   =   n e w   i n t [ F R Q _ P O I N T S ] ; 
 
                 p r i v a t e   i n t [ ]   _ _ d e t e c t D a t a B i t s I n d e x _ f r e q _ i n d e x 2   =   n e w   i n t [ F R Q _ P O I N T S ] ; 
 
                 p r i v a t e   i n t   d e t e c t D a t a B i t s I n d e x ( I N y A R G s P i x e l D r i v e r   i _ r e a d e r ,   N y A R I n t S i z e   i _ r a s t e r _ s i z e ,   P e r s p e c t i v e P i x e l R e a d e r . T T h r e s h o l d   i _ t h ,   d o u b l e [ ]   o _ i n d e x _ r o w ,   d o u b l e [ ]   o _ i n d e x _ c o l ) 
 
                 { 
 
                         / / hTlpe0,n[
 
                         i n t [ ]   f r e q _ i n d e x 1   =   t h i s . _ _ d e t e c t D a t a B i t s I n d e x _ f r e q _ i n d e x 1 ; 
 
                         i n t [ ]   f r e q _ i n d e x 2   =   t h i s . _ _ d e t e c t D a t a B i t s I n d e x _ f r e q _ i n d e x 2 ; 
 
 
 
                         i n t   f r q _ t   =   g e t R o w F r e q u e n c y ( i _ r e a d e r ,   i _ r a s t e r _ s i z e ,   i _ t h . l t _ y ,   i _ t h . t h _ h ,   i _ t h . t h _ l ,   f r e q _ i n d e x 1 ) ; 
 
                         i n t   f r q _ b   =   g e t R o w F r e q u e n c y ( i _ r e a d e r ,   i _ r a s t e r _ s i z e ,   i _ t h . r b _ y ,   i _ t h . t h _ h ,   i _ t h . t h _ l ,   f r e q _ i n d e x 2 ) ; 
 
                         / / hTlpeo0~0h00
 
                         i f   ( ( f r q _ t   <   0   & &   f r q _ b   <   0 )   | |   f r q _ t   = =   f r q _ b ) 
 
                         { 
 
                                 r e t u r n   - 1 ; 
 
                         } 
 
                         / / 000000000K00000000\Ob
 
                         i n t   f r e q _ h ,   f r e q _ v ; 
 
                         i n t [ ]   i n d e x ; 
 
                         i f   ( f r q _ t   >   f r q _ b ) 
 
                         { 
 
                                 f r e q _ h   =   f r q _ t ; 
 
                                 i n d e x   =   f r e q _ i n d e x 1 ; 
 
                         } 
 
                         e l s e 
 
                         { 
 
                                 f r e q _ h   =   f r q _ b ; 
 
                                 i n d e x   =   f r e q _ i n d e x 2 ; 
 
                         } 
 
                         f o r   ( i n t   i   =   0 ;   i   <   f r e q _ h   +   f r e q _ h   -   1 ;   i + + ) 
 
                         { 
 
                                 o _ i n d e x _ r o w [ i   *   2 ]   =   ( ( i n d e x [ i   +   1 ]   -   i n d e x [ i ] )   *   2   /   5   +   i n d e x [ i ] )   +   F R Q _ E D G E ; 
 
                                 o _ i n d e x _ r o w [ i   *   2   +   1 ]   =   ( ( i n d e x [ i   +   1 ]   -   i n d e x [ i ] )   *   3   /   5   +   i n d e x [ i ] )   +   F R Q _ E D G E ; 
 
                         } 
 
 
 
 
 
                         i n t   f r q _ l   =   g e t C o l F r e q u e n c y ( i _ r e a d e r ,   i _ r a s t e r _ s i z e ,   i _ t h . l t _ x ,   i _ t h . t h _ h ,   i _ t h . t h _ l ,   f r e q _ i n d e x 1 ) ; 
 
                         i n t   f r q _ r   =   g e t C o l F r e q u e n c y ( i _ r e a d e r ,   i _ r a s t e r _ s i z e ,   i _ t h . r b _ x ,   i _ t h . t h _ h ,   i _ t h . t h _ l ,   f r e q _ i n d e x 2 ) ; 
 
                         / / hTlpeo0~0h00
 
                         i f   ( ( f r q _ l   <   0   & &   f r q _ r   <   0 )   | |   f r q _ l   = =   f r q _ r ) 
 
                         { 
 
                                 r e t u r n   - 1 ; 
 
                         } 
 
                         / / 000000000K00000000\Ob
 
                         i f   ( f r q _ l   >   f r q _ r ) 
 
                         { 
 
                                 f r e q _ v   =   f r q _ l ; 
 
                                 i n d e x   =   f r e q _ i n d e x 1 ; 
 
                         } 
 
                         e l s e 
 
                         { 
 
                                 f r e q _ v   =   f r q _ r ; 
 
                                 i n d e x   =   f r e q _ i n d e x 2 ; 
 
                         } 
 
                         / / TX0hTg
 
                         i f   ( f r e q _ v   ! =   f r e q _ h ) 
 
                         { 
 
                                 r e t u r n   - 1 ; 
 
                         } 
 
 
 
                         f o r   ( i n t   i   =   0 ;   i   <   f r e q _ v   +   f r e q _ v   -   1 ;   i + + ) 
 
                         { 
 
                                 i n t   w   =   i n d e x [ i ] ; 
 
                                 i n t   w 2   =   i n d e x [ i   +   1 ]   -   w ; 
 
                                 o _ i n d e x _ c o l [ i   *   2 ]   =   ( ( w 2 )   *   2   /   5   +   w )   +   F R Q _ E D G E ; 
 
                                 o _ i n d e x _ c o l [ i   *   2   +   1 ]   =   ( ( w 2 )   *   3   /   5   +   w )   +   F R Q _ E D G E ; 
 
                         } 
 
                         / / L v 4 N
No0!qt
 
                         i f   ( f r e q _ v   >   M A X _ F R E Q ) 
 
                         { 
 
                                 r e t u r n   - 1 ; 
 
                         } 
 
                         r e t u r n   f r e q _ v ; 
 
 
 
                 } 
 
                 p r i v a t e   d o u b l e [ ]   _ _ r e a d D a t a B i t s _ i n d e x _ b i t _ x   =   n e w   d o u b l e [ M A X _ D A T A _ B I T S   *   2 ] ; 
 
                 p r i v a t e   d o u b l e [ ]   _ _ r e a d D a t a B i t s _ i n d e x _ b i t _ y   =   n e w   d o u b l e [ M A X _ D A T A _ B I T S   *   2 ] ; 
 
                 / * * 
 
                   *   S0n0peo000000000K0000000S0~0Y00
 
                   *   @ p a r a m   i _ r e a d e r 
 
                   *   000000
 
                   *   @ p a r a m   i _ r a s t e r _ s i z e 
 
                   *   000n0000
 
                   *   @ p a r a m   i _ t h 
 
                   *   weE\$P`1X
 
                   *   @ p a r a m   o _ b i t b u f f e r 
 
                   *   000000n0QRHQ
 
                   *   @ r e t u r n 
 
                   *   bRY00h0t r u e 
 
                   *   @ 
 
                   * / 
 
                 p u b l i c   b o o l   r e a d D a t a B i t s ( I N y A R G s P i x e l D r i v e r   i _ r e a d e r ,   N y A R I n t S i z e   i _ r a s t e r _ s i z e ,   P e r s p e c t i v e P i x e l R e a d e r . T T h r e s h o l d   i _ t h ,   M a r k e r P a t t E n c o d e r   o _ b i t b u f f e r ) 
 
                 { 
 
                         i n t   r a s t e r _ w i d t h   =   i _ r a s t e r _ s i z e . w ; 
 
                         i n t   r a s t e r _ h e i g h t   =   i _ r a s t e r _ s i z e . h ; 
 
 
 
                         d o u b l e [ ]   i n d e x _ x   =   t h i s . _ _ r e a d D a t a B i t s _ i n d e x _ b i t _ x ; 
 
                         d o u b l e [ ]   i n d e x _ y   =   t h i s . _ _ r e a d D a t a B i t s _ i n d e x _ b i t _ y ; 
 
 
 
 
 
                         / / 0QW0MOn0S_
 
                         i n t   s i z e   =   d e t e c t D a t a B i t s I n d e x ( i _ r e a d e r ,   i _ r a s t e r _ s i z e ,   i _ t h ,   i n d e x _ x ,   i n d e x _ y ) ; 
 
                         i n t   r e s o l u t i o n   =   s i z e   +   s i z e   -   1 ; 
 
                         i f   ( s i z e   <   0 ) 
 
                         { 
 
                                 r e t u r n   f a l s e ; 
 
                         } 
 
                         i f   ( ! o _ b i t b u f f e r . i n i t E n c o d e r ( s i z e   -   1 ) ) 
 
                         { 
 
                                 r e t u r n   f a l s e ; 
 
                         } 
 
 
 
                         d o u b l e [ ]   c p a r a   =   t h i s . _ c p a r a m ; 
 
                         i n t [ ]   r e f _ x   =   t h i s . _ r e f _ x ; 
 
                         i n t [ ]   r e f _ y   =   t h i s . _ r e f _ y ; 
 
                         i n t [ ]   p i x c e l _ t e m p   =   t h i s . _ p i x c e l _ t e m p ; 
 
 
 
                         d o u b l e   c p a r a _ 0   =   c p a r a [ 0 ] ; 
 
                         d o u b l e   c p a r a _ 1   =   c p a r a [ 1 ] ; 
 
                         d o u b l e   c p a r a _ 3   =   c p a r a [ 3 ] ; 
 
                         d o u b l e   c p a r a _ 6   =   c p a r a [ 6 ] ; 
 
 
 
 
 
                         i n t   t h   =   i _ t h . t h ; 
 
                         i n t   p   =   0 ; 
 
                         f o r   ( i n t   i   =   0 ;   i   <   r e s o l u t i o n ;   i + + ) 
 
                         { 
 
                                 / / 1 RRn00000n0000000$P0{Y000
 
                                 d o u b l e   c y 0   =   1   +   i n d e x _ y [ i   *   2   +   0 ] ; 
 
                                 d o u b l e   c y 1   =   1   +   i n d e x _ y [ i   *   2   +   1 ] ; 
 
                                 d o u b l e   c p y 0 _ 1 2   =   c p a r a _ 1   *   c y 0   +   c p a r a [ 2 ] ; 
 
                                 d o u b l e   c p y 0 _ 4 5   =   c p a r a [ 4 ]   *   c y 0   +   c p a r a [ 5 ] ; 
 
                                 d o u b l e   c p y 0 _ 7   =   c p a r a [ 7 ]   *   c y 0   +   1 . 0 ; 
 
                                 d o u b l e   c p y 1 _ 1 2   =   c p a r a _ 1   *   c y 1   +   c p a r a [ 2 ] ; 
 
                                 d o u b l e   c p y 1 _ 4 5   =   c p a r a [ 4 ]   *   c y 1   +   c p a r a [ 5 ] ; 
 
                                 d o u b l e   c p y 1 _ 7   =   c p a r a [ 7 ]   *   c y 1   +   1 . 0 ; 
 
 
 
                                 i n t   p t   =   0 ; 
 
                                 f o r   ( i n t   i 2   =   0 ;   i 2   <   r e s o l u t i o n ;   i 2 + + ) 
 
                                 { 
 
                                         i n t   x x ,   y y ; 
 
                                         d o u b l e   d ; 
 
                                         d o u b l e   c x 0   =   1   +   i n d e x _ x [ i 2   *   2   +   0 ] ; 
 
                                         d o u b l e   c x 1   =   1   +   i n d e x _ x [ i 2   *   2   +   1 ] ; 
 
 
 
                                         d o u b l e   c p 6 _ 0   =   c p a r a _ 6   *   c x 0 ; 
 
                                         d o u b l e   c p x 0 _ 0   =   c p a r a _ 0   *   c x 0 ; 
 
                                         d o u b l e   c p x 3 _ 0   =   c p a r a _ 3   *   c x 0 ; 
 
 
 
                                         d o u b l e   c p 6 _ 1   =   c p a r a _ 6   *   c x 1 ; 
 
                                         d o u b l e   c p x 0 _ 1   =   c p a r a _ 0   *   c x 1 ; 
 
                                         d o u b l e   c p x 3 _ 1   =   c p a r a _ 3   *   c x 1 ; 
 
 
 
                                         d   =   c p 6 _ 0   +   c p y 0 _ 7 ; 
 
                                         r e f _ x [ p t ]   =   x x   =   ( i n t ) ( ( c p x 0 _ 0   +   c p y 0 _ 1 2 )   /   d ) ; 
 
                                         r e f _ y [ p t ]   =   y y   =   ( i n t ) ( ( c p x 3 _ 0   +   c p y 0 _ 4 5 )   /   d ) ; 
 
                                         i f   ( x x   <   0   | |   x x   > =   r a s t e r _ w i d t h   | |   y y   <   0   | |   y y   > =   r a s t e r _ h e i g h t ) 
 
                                         { 
 
                                                 r e f _ x [ p t ]   =   x x   <   0   ?   0   :   ( x x   > =   r a s t e r _ w i d t h   ?   r a s t e r _ w i d t h   -   1   :   x x ) ; 
 
                                                 r e f _ y [ p t ]   =   y y   <   0   ?   0   :   ( y y   > =   r a s t e r _ h e i g h t   ?   r a s t e r _ h e i g h t   -   1   :   y y ) ; 
 
                                         } 
 
                                         p t + + ; 
 
 
 
                                         d   =   c p 6 _ 0   +   c p y 1 _ 7 ; 
 
                                         r e f _ x [ p t ]   =   x x   =   ( i n t ) ( ( c p x 0 _ 0   +   c p y 1 _ 1 2 )   /   d ) ; 
 
                                         r e f _ y [ p t ]   =   y y   =   ( i n t ) ( ( c p x 3 _ 0   +   c p y 1 _ 4 5 )   /   d ) ; 
 
                                         i f   ( x x   <   0   | |   x x   > =   r a s t e r _ w i d t h   | |   y y   <   0   | |   y y   > =   r a s t e r _ h e i g h t ) 
 
                                         { 
 
                                                 r e f _ x [ p t ]   =   x x   <   0   ?   0   :   ( x x   > =   r a s t e r _ w i d t h   ?   r a s t e r _ w i d t h   -   1   :   x x ) ; 
 
                                                 r e f _ y [ p t ]   =   y y   <   0   ?   0   :   ( y y   > =   r a s t e r _ h e i g h t   ?   r a s t e r _ h e i g h t   -   1   :   y y ) ; 
 
                                         } 
 
                                         p t + + ; 
 
 
 
                                         d   =   c p 6 _ 1   +   c p y 0 _ 7 ; 
 
                                         r e f _ x [ p t ]   =   x x   =   ( i n t ) ( ( c p x 0 _ 1   +   c p y 0 _ 1 2 )   /   d ) ; 
 
                                         r e f _ y [ p t ]   =   y y   =   ( i n t ) ( ( c p x 3 _ 1   +   c p y 0 _ 4 5 )   /   d ) ; 
 
                                         i f   ( x x   <   0   | |   x x   > =   r a s t e r _ w i d t h   | |   y y   <   0   | |   y y   > =   r a s t e r _ h e i g h t ) 
 
                                         { 
 
                                                 r e f _ x [ p t ]   =   x x   <   0   ?   0   :   ( x x   > =   r a s t e r _ w i d t h   ?   r a s t e r _ w i d t h   -   1   :   x x ) ; 
 
                                                 r e f _ y [ p t ]   =   y y   <   0   ?   0   :   ( y y   > =   r a s t e r _ h e i g h t   ?   r a s t e r _ h e i g h t   -   1   :   y y ) ; 
 
                                         } 
 
                                         p t + + ; 
 
 
 
                                         d   =   c p 6 _ 1   +   c p y 1 _ 7 ; 
 
                                         r e f _ x [ p t ]   =   x x   =   ( i n t ) ( ( c p x 0 _ 1   +   c p y 1 _ 1 2 )   /   d ) ; 
 
                                         r e f _ y [ p t ]   =   y y   =   ( i n t ) ( ( c p x 3 _ 1   +   c p y 1 _ 4 5 )   /   d ) ; 
 
                                         i f   ( x x   <   0   | |   x x   > =   r a s t e r _ w i d t h   | |   y y   <   0   | |   y y   > =   r a s t e r _ h e i g h t ) 
 
                                         { 
 
                                                 r e f _ x [ p t ]   =   x x   <   0   ?   0   :   ( x x   > =   r a s t e r _ w i d t h   ?   r a s t e r _ w i d t h   -   1   :   x x ) ; 
 
                                                 r e f _ y [ p t ]   =   y y   <   0   ?   0   :   ( y y   > =   r a s t e r _ h e i g h t   ?   r a s t e r _ h e i g h t   -   1   :   y y ) ; 
 
                                         } 
 
                                         p t + + ; 
 
                                 } 
 
                                 / / 1 LRn000000S_( 4XTk00c0f0o0\(u00000fD0_0eL0D0D0) 
 
                                 i _ r e a d e r . g e t P i x e l S e t ( r e f _ x ,   r e f _ y ,   r e s o l u t i o n   *   4 ,   p i x c e l _ t e m p ,   0 ) ; 
 
                                 / / 0000000k0W0j0L000l i n e !m a p x0n0⎙Q
 
                                 f o r   ( i n t   i 2   =   0 ;   i 2   <   r e s o l u t i o n ;   i 2 + + ) 
 
                                 { 
 
                                         i n t   i n d e x   =   i 2   *   4 ; 
 
                                         i n t   p i x e l   =   ( p i x c e l _ t e m p [ i n d e x   +   0 ]   +   p i x c e l _ t e m p [ i n d e x   +   1 ]   +   p i x c e l _ t e m p [ i n d e x   +   2 ]   +   p i x c e l _ t e m p [ i n d e x   +   3 ] )   /   4 ; 
 
                                         / / 	 	 	 	 + p i x c e l _ t e m p [ i n d e x + 4 ] + p i x c e l _ t e m p [ i n d e x + 5 ] + 
 
                                         / / 	 	 	 	 	 	 	 p i x c e l _ t e m p [ i n d e x + 6 ] + p i x c e l _ t e m p [ i n d e x + 7 ] + p i x c e l _ t e m p [ i n d e x + 8 ] + 
 
                                         / / 	 	 	 	 	 	 	 p i x c e l _ t e m p [ i n d e x + 9 ] + p i x c e l _ t e m p [ i n d e x + 1 0 ] + p i x c e l _ t e m p [ i n d e x + 1 1 ] ) / ( 4 * 3 ) ; 
 
                                         / / fp01 0fp00 g0hsW0~0Y00
 
                                         o _ b i t b u f f e r . s e t B i t B y B i t I n d e x ( p ,   p i x e l   >   t h   ?   0   :   1 ) ; 
 
                                         p + + ; 
 
                                 } 
 
                         } 
 
                         r e t u r n   t r u e ; 
 
                 } 
 
 
 
 
 
         } 
 
 
 
         c l a s s   M a r k e r P a t t D e c o d e r 
 
         { 
 
                 p u b l i c   v o i d   d e c o d e ( i n t   m o d e l ,   i n t   d o m a i n ,   i n t   m a s k ) 
 
                 { 
 
 
 
                 } 
 
         } 
 
         / * * 
 
           *   S0n0000o000000000n000000g0Y00{ @ l i n k   P e r s p e c t i v e P i x e l R e a d e r } K00OD0~0Y00
 
           *   0000000K0000000000x000000Y00Qt0[W0~0Y00
 
           *   f[h0W0f005 x 5 h007 x 7 n0000k0d0D0f0[W0~0Y00
 
           * / 
 
         c l a s s   M a r k e r P a t t E n c o d e r 
 
         { 
 
                 p r i v a t e   s t a t i c   r e a d o n l y   i n t [ ]   _ b i t _ t a b l e _ 3   = { 
 
 	 	 2 5 , 	 2 6 , 	 2 7 , 	 2 8 , 	 2 9 , 	 3 0 , 	 3 1 , 
 
 	 	 4 8 , 	 9 , 	 1 0 , 	 1 1 , 	 1 2 , 	 1 3 , 	 3 2 , 
 
 	 	 4 7 , 	 2 4 , 	 1 , 	 2 , 	 3 , 	 1 4 , 	 3 3 , 
 
 	 	 4 6 , 	 2 3 , 	 8 , 	 0 , 	 4 , 	 1 5 , 	 3 4 , 
 
 	 	 4 5 , 	 2 2 , 	 7 , 	 6 , 	 5 , 	 1 6 , 	 3 5 , 
 
 	 	 4 4 , 	 2 1 , 	 2 0 , 	 1 9 , 	 1 8 , 	 1 7 , 	 3 6 , 
 
 	 	 4 3 , 	 4 2 , 	 4 1 , 	 4 0 , 	 3 9 , 	 3 8 , 	 3 7 
 
 	 	 } ; 
 
                 p r i v a t e   s t a t i c   r e a d o n l y   i n t [ ]   _ b i t _ t a b l e _ 2   = { 
 
 	 	 9 , 	 1 0 , 	 1 1 , 	 1 2 , 	 1 3 , 
 
 	 	 2 4 , 	 1 , 	 2 , 	 3 , 	 1 4 , 
 
 	 	 2 3 , 	 8 , 	 0 , 	 4 , 	 1 5 , 
 
 	 	 2 2 , 	 7 , 	 6 , 	 5 , 	 1 6 , 
 
 	 	 2 1 , 	 2 0 , 	 1 9 , 	 1 8 , 	 1 7 } ; 
 
                 p r i v a t e   s t a t i c   r e a d o n l y   i n t [ ] [ ]   _ b i t _ t a b l e s   = { 
 
 	 	 _ b i t _ t a b l e _ 2 , _ b i t _ t a b l e _ 3 , n u l l , n u l l , n u l l , n u l l , n u l l , 
 
 	 } ; 
 
                 / * * 
 
                   *   R E C T ( 0 ) : [ 0 ] = ( 0 ) 
 
                   *   R E C T ( 1 ) : [ 1 ] = ( 1 - 8 ) 
 
                   *   R E C T ( 2 ) : [ 2 ] = ( 9 - 1 6 ) , [ 3 ] = ( 1 7 - 2 4 ) 
 
                   *   R E C T ( 3 ) : [ 4 ] = ( 2 5 - 3 2 ) , [ 5 ] = ( 3 3 - 4 0 ) , [ 6 ] = ( 4 1 - 4 8 ) 
 
                   * / 
 
                 p r i v a t e   i n t [ ]   _ b i t _ t a b l e ; 
 
                 p r i v a t e   i n t [ ]   _ b i t s   =   n e w   i n t [ 1 6 ] ; 
 
                 p r i v a t e   i n t [ ]   _ w o r k   =   n e w   i n t [ 1 6 ] ; 
 
                 p r i v a t e   i n t   _ m o d e l ; 
 
                 / * * 
 
                   *   S0n0peo00
 
                   *   @ p a r a m   i _ i n d e x _ n o 
 
                   *   @ p a r a m   i _ v a l u e 
 
                   * / 
 
                 p u b l i c   v o i d   s e t B i t B y B i t I n d e x ( i n t   i _ i n d e x _ n o ,   i n t   i _ v a l u e ) 
 
 	 { 
 
 	 	 D e b u g . A s s e r t ( i _ v a l u e = = 0   | |   i _ v a l u e = = 1 ) ; 
 
 	 	 i n t   b i t _ n o = t h i s . _ b i t _ t a b l e [ i _ i n d e x _ n o ] ; 
 
 	 	 i f ( b i t _ n o = = 0 ) { 
 
 	 	 	 t h i s . _ b i t s [ 0 ] = i _ v a l u e ; 
 
 	 	 } e l s e { 
 
 	 	 	 i n t   b i d x = ( b i t _ n o - 1 ) / 8 + 1 ; 
 
 	 	 	 i n t   s i d x = ( b i t _ n o - 1 ) % 8 ; 
 
 	 	 	 t h i s . _ b i t s [ b i d x ] = ( t h i s . _ b i t s [ b i d x ] & ( ~ ( 0 x 0 1 < < s i d x ) ) ) | ( i _ v a l u e < < s i d x ) ; 
 
 	 	 } 
 
 	 	 r e t u r n ; 
 
 	 } 
 
                 / * * 
 
                   *   S0n0peo000000000{ @ l i n k   # _ b i t s } n0n 000vk00$P0000W0~0Y00
 
                   *   @ p a r a m   i _ b i t _ n o 
 
                   *   0000000n000000
 
                   *   @ p a r a m   i _ v a l u e 
 
                   *   000Y00$P0
 
                   * / 
 
                 p u b l i c   v o i d   s e t B i t ( i n t   i _ b i t _ n o ,   i n t   i _ v a l u e ) 
 
 	 { 
 
 	 	 D e b u g . A s s e r t ( i _ v a l u e = = 0   | |   i _ v a l u e = = 1 ) ; 
 
 	 	 i f ( i _ b i t _ n o = = 0 ) { 
 
 	 	 	 t h i s . _ b i t s [ 0 ] = i _ v a l u e ; 
 
 	 	 } e l s e { 
 
 	 	 	 i n t   b i d x = ( i _ b i t _ n o - 1 ) / 8 + 1 ; 
 
 	 	 	 i n t   s i d x = ( i _ b i t _ n o - 1 ) % 8 ; 
 
 	 	 	 t h i s . _ b i t s [ b i d x ] = ( t h i s . _ b i t s [ b i d x ] & ( ~ ( 0 x 0 1 < < s i d x ) ) ) | ( i _ v a l u e < < s i d x ) ; 
 
 	 	 } 
 
 	 	 r e t u r n ; 
 
 	 } 
 
                 / * * 
 
                   *   S0n0peo000000000{ @ l i n k   # _ b i t s } n0n 000vK000$P0_~0Y00
 
                   *   @ p a r a m   i _ b i t _ n o 
 
                   *   0000000n000000
 
                   *   @ r e t u r n 
 
                   *   000$P
 
                   * / 
 
                 p u b l i c   i n t   g e t B i t ( i n t   i _ b i t _ n o ) 
 
                 { 
 
                         i f   ( i _ b i t _ n o   = =   0 ) 
 
                         { 
 
                                 r e t u r n   t h i s . _ b i t s [ 0 ] ; 
 
                         } 
 
                         e l s e 
 
                         { 
 
                                 i n t   b i d x   =   ( i _ b i t _ n o   -   1 )   /   8   +   1 ; 
 
                                 i n t   s i d x   =   ( i _ b i t _ n o   -   1 )   %   8 ; 
 
                                 r e t u r n   ( t h i s . _ b i t s [ b i d x ]   > >   ( s i d x ) )   &   ( 0 x 0 1 ) ; 
 
                         } 
 
                 } 
 
                 / * * 
 
                   *   S0n0peo00s(W000U00f0D00000juS0ԏW0~0Y00
 
                   *   @ r e t u r n 
 
                   *   s(Wn0000juS
 
                   * / 
 
                 p u b l i c   i n t   g e t M o d e l ( ) 
 
                 { 
 
                         r e t u r n   t h i s . _ m o d e l ; 
 
                 } 
 
                 p r i v a t e   s t a t i c   i n t   g e t C o n t r o l V a l u e ( i n t   i _ m o d e l ,   i n t [ ]   i _ d a t a ) 
 
                 { 
 
                         i n t   v ; 
 
                         s w i t c h   ( i _ m o d e l ) 
 
                         { 
 
                                 c a s e   2 : 
 
                                         v   =   ( i _ d a t a [ 2 ]   &   0 x 0 e )   > >   1 ; 
 
                                         r e t u r n   v   > =   5   ?   v   -   1   :   v ; 
 
                                 c a s e   3 : 
 
                                         v   =   ( i _ d a t a [ 4 ]   &   0 x 3 e )   > >   1 ; 
 
                                         r e t u r n   v   > =   2 1   ?   v   -   1   :   v ; 
 
                                 c a s e   4 : 
 
                                 c a s e   5 : 
 
                                 c a s e   6 : 
 
                                 c a s e   7 : 
 
                                 d e f a u l t : 
 
                                         b r e a k ; 
 
                         } 
 
                         r e t u r n   - 1 ; 
 
                 } 
 
                 / * * 
 
                   *   S0n0peo000000000n0$P0ԏW0~0Y00
 
                   *   @ p a r a m   i _ m o d e l 
 
                   *   000juS
 
                   *   @ p a r a m   i _ d a t a 
 
                   *   000MR
 
                   *   @ r e t u r n 
 
                   * / 
 
                 p r i v a t e   s t a t i c   i n t   g e t C h e c k V a l u e ( i n t   i _ m o d e l ,   i n t [ ]   i _ d a t a ) 
 
                 { 
 
                         i n t   v ; 
 
                         s w i t c h   ( i _ m o d e l ) 
 
                         { 
 
                                 c a s e   2 : 
 
                                         v   =   ( i _ d a t a [ 2 ]   &   0 x e 0 )   > >   5 ; 
 
                                         r e t u r n   v   >   5   ?   v   -   1   :   v ; 
 
                                 c a s e   3 : 
 
                                         v   =   ( ( i _ d a t a [ 4 ]   &   0 x 8 0 )   > >   7 )   |   ( ( i _ d a t a [ 5 ]   &   0 x 0 f )   < <   1 ) ; 
 
                                         r e t u r n   v   >   2 1   ?   v   -   1   :   v ; 
 
                                 c a s e   4 : 
 
                                 c a s e   5 : 
 
                                 c a s e   6 : 
 
                                 c a s e   7 : 
 
                                 d e f a u l t : 
 
                                         b r e a k ; 
 
                         } 
 
                         r e t u r n   - 1 ; 
 
                 } 
 
                 / * * 
 
                   *   S0n0peo00000000n0rKa00c[000TQ0k0000W0~0Y00
 
                   *   @ p a r a m   i _ m o d e l 
 
                   *   000juS
 
                   *   @ r e t u r n 
 
                   *   bRY00h0t r u e 0ԏW0~0Y00
 
                   * / 
 
                 p u b l i c   b o o l   i n i t E n c o d e r ( i n t   i _ m o d e l ) 
 
                 { 
 
                         i f   ( i _ m o d e l   >   3   | |   i _ m o d e l   <   2 ) 
 
                         { 
 
                                 / / L v 4 NMk0[_Y00Bfo00S0n06RP0	YH000
 
                                 r e t u r n   f a l s e ; 
 
                         } 
 
                         t h i s . _ b i t _ t a b l e   =   _ b i t _ t a b l e s [ i _ m o d e l   -   2 ] ; 
 
                         t h i s . _ m o d e l   =   i _ m o d e l ; 
 
                         r e t u r n   t r u e ; 
 
                 } 
 
                 p r i v a t e   i n t   g e t D i r e c t i o n ( ) 
 
                 { 
 
                         i n t   l ,   t ,   r ,   b ; 
 
                         i n t   t i m i n g _ p a t ; 
 
                         s w i t c h   ( t h i s . _ m o d e l ) 
 
                         { 
 
                                 c a s e   2 : 
 
                                         / / 000000000_0
 
                                         t   =   t h i s . _ b i t s [ 2 ]   &   0 x 1 f ; 
 
                                         r   =   ( ( t h i s . _ b i t s [ 2 ]   &   0 x f 0 )   > >   4 )   |   ( ( t h i s . _ b i t s [ 3 ]   &   0 x 0 1 )   < <   4 ) ; 
 
                                         b   =   t h i s . _ b i t s [ 3 ]   &   0 x 1 f ; 
 
                                         l   =   ( ( t h i s . _ b i t s [ 3 ]   &   0 x f 0 )   > >   4 )   |   ( ( t h i s . _ b i t s [ 2 ]   &   0 x 0 1 )   < <   4 ) ; 
 
                                         t i m i n g _ p a t   =   0 x 0 a ; 
 
                                         b r e a k ; 
 
                                 c a s e   3 : 
 
                                         t   =   t h i s . _ b i t s [ 4 ]   &   0 x 7 f ; 
 
                                         r   =   ( ( t h i s . _ b i t s [ 4 ]   &   0 x c 0 )   > >   6 )   |   ( ( t h i s . _ b i t s [ 5 ]   &   0 x 1 f )   < <   2 ) ; 
 
                                         b   =   ( ( t h i s . _ b i t s [ 5 ]   &   0 x f 0 )   > >   4 )   |   ( ( t h i s . _ b i t s [ 6 ]   &   0 x 0 7 )   < <   4 ) ; 
 
                                         l   =   ( ( t h i s . _ b i t s [ 6 ]   &   0 x f c )   > >   2 )   |   ( ( t h i s . _ b i t s [ 4 ]   &   0 x 0 1 )   < <   6 ) ; 
 
                                         t i m i n g _ p a t   =   0 x 2 a ; 
 
                                         b r e a k ; 
 
                                 d e f a u l t : 
 
                                         r e t u r n   - 3 ; 
 
                         } 
 
                         / / 000000000n0k
 
                         i f   ( t   = =   t i m i n g _ p a t ) 
 
                         { 
 
                                 i f   ( r   = =   t i m i n g _ p a t ) 
 
                                 { 
 
                                         r e t u r n   ( b   ! =   t i m i n g _ p a t   & &   l   ! =   t i m i n g _ p a t )   ?   2   :   - 2 ; 
 
                                 } 
 
                                 e l s e   i f   ( l   = =   t i m i n g _ p a t ) 
 
                                 { 
 
                                         r e t u r n   ( b   ! =   t i m i n g _ p a t   & &   r   ! =   t i m i n g _ p a t )   ?   3   :   - 2 ; 
 
                                 } 
 
                         } 
 
                         e l s e   i f   ( b   = =   t i m i n g _ p a t ) 
 
                         { 
 
                                 i f   ( r   = =   t i m i n g _ p a t ) 
 
                                 { 
 
                                         r e t u r n   ( t   ! =   t i m i n g _ p a t   & &   l   ! =   t i m i n g _ p a t )   ?   1   :   - 2 ; 
 
                                 } 
 
                                 e l s e   i f   ( l   = =   t i m i n g _ p a t ) 
 
                                 { 
 
                                         r e t u r n   ( t   ! =   t i m i n g _ p a t   & &   r   ! =   t i m i n g _ p a t )   ?   0   :   - 2 ; 
 
                                 } 
 
                         } 
 
                         r e t u r n   - 1 ; 
 
                 } 
 
                 / * * 
 
                   *   <h
}W0f0D000000000000000W0f000000000ԏW0~0Y00
 
                   *   @ p a r a m   o _ o u t 
 
                   *   0000000SQ0S00000000
 
                   *   @ r e t u r n 
 
                   *   bRY00p0000n0eMO0ԏtSW0~0Y001YWeY00h0- 1 0ԏW0~0Y00
 
                   * / 
 
                 p u b l i c   i n t   e n c o d e ( N y I d M a r k e r P a t t e r n   o _ o u t ) 
 
                 { 
 
                         i n t   d   =   g e t D i r e c t i o n ( ) ; 
 
                         i f   ( d   <   0 ) 
 
                         { 
 
                                 r e t u r n   - 1 ; 
 
                         } 
 
                         / / V000n0S_
 
                         g e t R o t a t e d B i t s ( d ,   o _ o u t . d a t a ) ; 
 
                         i n t   m o d e l   =   t h i s . _ m o d e l ; 
 
                         / / hT000n0S_
 
                         o _ o u t . m o d e l   =   m o d e l ; 
 
                         i n t   c o n t r o l _ b i t s   =   g e t C o n t r o l V a l u e ( m o d e l ,   o _ o u t . d a t a ) ; 
 
                         o _ o u t . c h e c k   =   g e t C h e c k V a l u e ( m o d e l ,   o _ o u t . d a t a ) ; 
 
                         o _ o u t . c t r l _ m a s k   =   c o n t r o l _ b i t s   %   5 ; 
 
                         o _ o u t . c t r l _ d o m a i n   =   c o n t r o l _ b i t s   /   5 ; 
 
                         i f   ( o _ o u t . c t r l _ d o m a i n   ! =   0   | |   o _ o u t . c t r l _ m a s k   ! =   0 ) 
 
                         { 
 
                                 r e t u r n   - 1 ; 
 
                         } 
 
                         / / 000dQt0[ňY00S0h0
 
                         r e t u r n   d ; 
 
                 } 
 
                 p r i v a t e   v o i d   g e t R o t a t e d B i t s ( i n t   i _ d i r e c t i o n ,   i n t [ ]   o _ o u t ) 
 
                 { 
 
                         i n t   s l   =   i _ d i r e c t i o n   *   2 ; 
 
                         i n t   s r   =   8   -   s l ; 
 
 
 
                         i n t   w 1 ; 
 
                         o _ o u t [ 0 ]   =   t h i s . _ b i t s [ 0 ] ; 
 
                         / / R E C T 1 
 
                         w 1   =   t h i s . _ b i t s [ 1 ] ; 
 
                         o _ o u t [ 1 ]   =   ( ( w 1   < <   s l )   |   ( w 1   > >   s r ) )   &   0 x f f ; 
 
 
 
                         / / R E C T 2 
 
                         s l   =   i _ d i r e c t i o n   *   4 ; 
 
                         s r   =   1 6   -   s l ; 
 
                         w 1   =   t h i s . _ b i t s [ 2 ]   |   ( t h i s . _ b i t s [ 3 ]   < <   8 ) ; 
 
                         w 1   =   ( w 1   < <   s l )   |   ( w 1   > >   s r ) ; 
 
                         o _ o u t [ 2 ]   =   w 1   &   0 x f f ; 
 
                         o _ o u t [ 3 ]   =   ( w 1   > >   8 )   &   0 x f f ; 
 
 
 
                         i f   ( t h i s . _ m o d e l   <   2 ) 
 
                         { 
 
                                 r e t u r n ; 
 
                         } 
 
 
 
                         / / R E C T 3 
 
                         s l   =   i _ d i r e c t i o n   *   6 ; 
 
                         s r   =   2 4   -   s l ; 
 
                         w 1   =   t h i s . _ b i t s [ 4 ]   |   ( t h i s . _ b i t s [ 5 ]   < <   8 )   |   ( t h i s . _ b i t s [ 6 ]   < <   1 6 ) ; 
 
                         w 1   =   ( w 1   < <   s l )   |   ( w 1   > >   s r ) ; 
 
                         o _ o u t [ 4 ]   =   w 1   &   0 x f f ; 
 
                         o _ o u t [ 5 ]   =   ( w 1   > >   8 )   &   0 x f f ; 
 
                         o _ o u t [ 6 ]   =   ( w 1   > >   1 6 )   &   0 x f f ; 
 
 
 
                         i f   ( t h i s . _ m o d e l   <   3 ) 
 
                         { 
 
                                 r e t u r n ; 
 
                         } 
 
                         / / R E C T 4 ( L v 4 NMo0S0S0n06RP0	YH00) 
 
                         / / 	 	 s h i f t L e f t ( t h i s . _ b i t s , 7 , 3 , i _ d i r e c t i o n * 8 ) ; 
 
                         / / 	 	 i f ( t h i s . _ m o d e l < 4 ) { 
 
                         / / 	 	 	 r e t u r n ; 
 
                         / / 	 	 } 
 
                         r e t u r n ; 
 
                 } 
 
                 / * * 
 
                   *   S0n0peo00000000i _ p a c k 0c[000`0Q0]000W0~0Y00
 
                   *   s(W*gO(ug0Y00
 
                   *   @ p a r a m   i _ p a c k 
 
                   *   d\OY00MR
 
                   *   @ p a r a m   i _ s t a r t 
 
                   *   000n0Y0000
 
                   *   @ p a r a m   i _ l e n g t h 
 
                   *   000Y00MRn0wU0
 
                   *   @ p a r a m   i _ l s 
 
                   *   000ϑ
 
                   * / 
 
                 p u b l i c   v o i d   s h i f t L e f t ( i n t [ ]   i _ p a c k ,   i n t   i _ s t a r t ,   i n t   i _ l e n g t h ,   i n t   i _ l s ) 
 
                 { 
 
                         i n t [ ]   w o r k   =   t h i s . _ w o r k ; 
 
                         / / zpe000
 
                         i n t   m o d _ s h i f t   =   i _ l s   %   8 ; 
 
                         f o r   ( i n t   i   =   i _ l e n g t h   -   1 ;   i   > =   1 ;   i - - ) 
 
                         { 
 
                                 w o r k [ i ]   =   ( i _ p a c k [ i   +   i _ s t a r t ]   < <   m o d _ s h i f t )   |   ( 0 x f f   &   ( i _ p a c k [ i   +   i _ s t a r t   -   1 ]   > >   ( 8   -   m o d _ s h i f t ) ) ) ; 
 
                         } 
 
                         w o r k [ 0 ]   =   ( i _ p a c k [ i _ s t a r t ]   < <   m o d _ s h i f t )   |   ( 0 x f f   &   ( i _ p a c k [ i _ s t a r t   +   i _ l e n g t h   -   1 ]   > >   ( 8   -   m o d _ s h i f t ) ) ) ; 
 
                         / / 000000
 
                         i n t   b y t e _ s h i f t   =   ( i _ l s   /   8 )   %   i _ l e n g t h ; 
 
                         f o r   ( i n t   i   =   i _ l e n g t h   -   1 ;   i   > =   0 ;   i - - ) 
 
                         { 
 
                                 i _ p a c k [ ( b y t e _ s h i f t   +   i )   %   i _ l e n g t h   +   i _ s t a r t ]   =   0 x f f   &   w o r k [ i ] ; 
 
                         } 
 
                         r e t u r n ; 
 
                 } 
 
         } 
 
 } 
 
 / * 
 
 / / 00000000S00000
 
 c l a s s   G s P i x e l R e a d e r 
 
 { 
 
 	 v o i d   w r a p R a s t e r ( ) ; 
 
 } 
 
 * / 