
    |h              
          d dl Zd dlZd dlmZ d dlmZmZmZm	Z	m
Z
 d Zd Zd Zd Zej                  j!                  e d	      ej                  j#                  d
g d      d               Zej                  j!                  e d	      ej                  j#                  dg dgddg ej&                  d      f      d               Zej                  j!                  e d	      d        Zy)    N)has_mpl)FeatureDetectorDescriptorExtractor_prepare_grayscale_input_2D_mask_border_keypointsplot_matched_featuresc                      t        j                  t              5  t               j	                  d        d d d        y # 1 sw Y   y xY wN)pytestraisesNotImplementedErrorr   detect     ^/var/www/html/test/engine/venv/lib/python3.12/site-packages/skimage/feature/tests/test_util.pytest_feature_detectorr      s5    	*	+ '  &' ' 's	   =Ac                      t        j                  t              5  t               j	                  d d        d d d        y # 1 sw Y   y xY wr
   )r   r   r   r   extractr   r   r   test_descriptor_extractorr      s7    	*	+ 2%%dD12 2 2s	   >Ac                     t        j                  t              5  t        t	        j
                  d             d d d        t        j                  t              5  t        t	        j
                  d             d d d        t        j                  t              5  t        t	        j
                  d             d d d        t        t	        j
                  d             t        t	        j
                  d             t        t	        j
                  d             y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   |xY w)N)   r   r   )r      )r   r   r   )r   r   )r   r   r   )r   r   r   )r   r   
ValueErrorr   npzerosr   r   r   test_prepare_grayscale_input_2Dr      s    	z	" 9#BHHY$789	z	" 6#BHHV$456	z	" 9#BHHY$789 01 34 349 96 69 9s#   DD(D4D%(D14D=c                     t        j                  ddgddgddgddgddgg      } t         j                  j                  t	        d| d      g d       t         j                  j                  t	        d| d      g d       t         j                  j                  t	        d	| d      g d
       t         j                  j                  t	        d| d      g d       t         j                  j                  t	        d| d      g d       y )Nr   r      r      
   r!   )r   r   r   r   r   )r   r   r   r   r   )r   r   )r   r   r   r   r      )r   r   r   r   r   )r   r   r   r   r   )r   arraytestingassert_equalr   )	keypointss    r   test_mask_border_keypointsr'   $   s    1a&1a&1a&1a&1a&ABIJJxA6 JJxA6 JJvy!4o JJxA6 JJxA6r   zMatplotlib not installed)reasonshapes))r    r    )r       r!   )r    r!   r+   )r    r+   r+   )r*   r    )r,   r    )r-   r    c                    ddl m} ddl m}  |d       |j                         \  }}t        j
                  j                  d      }d|j                  d      z  }d|j                  d      z  }|j                  dd      }|j                  dd      }	t	        j                  ||	f      }
| \  }}t	        j                  |      }t	        j                  |      }t        |||||
|	       t        ||||||
d
       t        ||||||
d       t        ||||||
d       t        j
                  j                  d      }t        t        |
            D cg c]  }|j                  g d       }}t        ||||||
|       t        ||||||
t	        j                  ddt        |
                   t        ||||||
d       |j                          y c c}w )Nr   pyplotuseAggl   
*A r!   )r!   r   size)
keypoints0
keypoints1matchesaxT)r9   r6   r7   r8   only_matchesr)r9   r6   r7   r8   keypoints_colorr9   r6   r7   r8   matches_colorl   	A )C0z#abc
aquamarine)r   r   r   )r   r   r   )numvertical)r9   r6   r7   r8   	alignment)
matplotlibr0   r2   subplotsr   randomdefault_rngintegerscolumn_stackr   r   rangelenchoicelinspaceclose)r)   pltr2   figr9   rngr6   r7   idxs0idxs1r8   shape0shape1img0img1_random_matches_colors                    r   test_plot_matched_featuresrZ   7   s    )JllnGC
))


-Ccjj))Jcjj))JLL"L%ELL"L%Eoouen-GNFF88FD88FD    ))


-C:?G:M56

/0  * kk)YCLI  IIK?s   Gr>   r?   C1   c           
         ddl m} ddl m}  |d       |j                         \  }}dt        j
                  j                  dd      z  }dt        j
                  j                  dd      z  }t        j
                  j                  dd      }t        j
                  j                  dd      }t	        j                  ||f      }	t        |       t        |	      k7  sJ t	        j                  d      }
t	        j                  |
      }d	}t        j                  t        |
      5  t        |
|||||	|        d d d        y # 1 sw Y   y xY w)Nr   r/   r1   r3   r!   r   r4   r    za`matches_color` needs to be a single color or a sequence of length equal to the number of matchesmatchr=   )rD   r0   r2   rE   r   rF   randrandintrI   rK   r   
zeros_liker   r   r   r   )r>   rO   r2   rX   r9   r6   r7   rR   rS   r8   rV   rW   regexs                r   &test_plot_matched_features_color_errorrd      s    )JLLNEArbiinnR++JbiinnR++JIIbr*EIIbr*Eoouen-G}W---88HD==D	A 
 
z	/ 	
!!'	
	
 	
 	
s   'EEc                     ddl m}  ddl m}  |d       | j                         \  }}dt        j
                  j                  dd      z  }dt        j
                  j                  dd      z  }t        j
                  j                  dd      }t        j
                  j                  dd      }t	        j                  ||f      }t	        j                  d      }	t	        j                  |	      }
t        j                  t        d	
      5  t        |	|
||||t	        j                  t!        |                   d d d        y # 1 sw Y   y xY w)Nr   r/   r1   r3   r!   r   r4   r    z.* not a valid value for colorr^   r=   )rD   r0   r2   rE   r   rF   r`   ra   rI   r   rb   r   r   r   r   arangerK   )rO   r2   rX   r9   r6   r7   rR   rS   r8   rV   rW   s              r   1test_plot_matched_features_matplotlib_color_errorrg      s    
 )JLLNEArbiinnR++JbiinnR++JIIbr*EIIbr*Eoouen-G88HD==D	z)I	J 	
!!))CL1	
	
 	
 	
s   /EE)numpyr   r   "skimage._shared._dependency_checksr   skimage.feature.utilr   r   r   r   r   r   r   r   r'   markskipifparametrizerZ   rf   rd   rg   r   r   r   <module>rn      s     6 '
2
	5& K(BCV DVr K(BC2vd|YRYYr]*ST
 U D
D K(BC
 D
r   