o
    ^i                  
   @   s   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d Zdd Zdd	 Zd
d Zejje ddejdg ddd Zejje ddejdg dgddgedfdd Zejje dddd ZdS )    N)has_mpl)FeatureDetectorDescriptorExtractor_prepare_grayscale_input_2D_mask_border_keypointsplot_matched_featuresc                   C   s<   t t t d  W d    d S 1 sw   Y  d S N)pytestraisesNotImplementedErrorr   detect r   r   Z/var/www/html/RAG/RAG_venv/lib/python3.10/site-packages/skimage/feature/tests/test_util.pytest_feature_detector   s   "r   c                   C   s>   t t t d d  W d    d S 1 sw   Y  d S r   )r	   r
   r   r   extractr   r   r   r   test_descriptor_extractor   s   "r   c                   C   s   t t ttd W d    n1 sw   Y  t t ttd W d    n1 s3w   Y  t t ttd W d    n1 sOw   Y  ttd ttd ttd d S )N)   r   r   )r      )r   r   r   )r   r   )r   r   r   )r   r   r   )r	   r
   
ValueErrorr   npzerosr   r   r   r   test_prepare_grayscale_input_2D   s   r   c                  C   s   t ddgddgddgddgddgg} t jtd| dg d t jtd| dg d t jtd	| dg d
 t jtd| dg d t jtd| dg d d S )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   )	keypointsr   r   r   test_mask_border_keypoints$   s    (r!   zMatplotlib not installed)reasonshapes))r   r   )r      r   )r   r   r%   )r   r%   r%   )r$   r   )r&   r   )r'   r   c                    st  ddl m} ddl m} |d | \}}tjd d d }d d } jddd} jddd}t||f}	| \}
}t	|
}t	|}t
|||||	|d	 t
||||||	d
d t
||||||	dd t
||||||	dd tjd  fddtt|	D }t
||||||	|d t
||||||	tjddt|	dd t
||||||	dd |  d S )Nr   pyplotuseAggl   
*A r   )r   r   size)
keypoints0
keypoints1matchesaxT)r2   r/   r0   r1   only_matchesr)r2   r/   r0   r1   keypoints_colorr2   r/   r0   r1   matches_colorl   	A c                    s   g | ]	}  g d qS ))C0z#abc
aquamarine)choice).0_rngr   r   
<listcomp>{   s    z.test_plot_matched_features.<locals>.<listcomp>)r   r   r   )r   r   r   )numvertical)r2   r/   r0   r1   	alignment)
matplotlibr)   r+   subplotsr   randomdefault_rngintegerscolumn_stackr   r   rangelenlinspaceclose)r#   pltr+   figr2   r/   r0   idxs0idxs1r1   shape0shape1img0img1random_matches_colorr   r=   r   test_plot_matched_features7   s   

		



		rV   r7   r8   C1   c              
   C   s   ddl m} ddl m} |d | \}}dtjdd }dtjdd }tjjddd}tjjddd}t||f}	t	| t	|	ksIJ t
d}
t|
}d	}tjt|d
 t|
|||||	| d W d    d S 1 ssw   Y  d S )Nr   r(   r*   r,   r   r   r-   r   za`matches_color` needs to be a single color or a sequence of length equal to the number of matchesmatchr6   )rC   r)   r+   rD   r   rE   randrandintrH   rJ   r   
zeros_liker	   r
   r   r   )r7   rM   r+   r<   r2   r/   r0   rO   rP   r1   rS   rT   regexr   r   r   &test_plot_matched_features_color_error   s2   

"r_   c                  C   s   ddl m}  ddl m} |d |  \}}dtjdd }dtjdd }tjjddd}tjjddd}t||f}t	d}	t
|	}
tjtd	d
 t|	|
||||tt|d W d    d S 1 slw   Y  d S )Nr   r(   r*   r,   r   r   r-   r   z.* not a valid value for colorrY   r6   )rC   r)   r+   rD   r   rE   r[   r\   rH   r   r]   r	   r
   r   r   arangerJ   )rM   r+   r<   r2   r/   r0   rO   rP   r1   rS   rT   r   r   r   1test_plot_matched_features_matplotlib_color_error   s,   

"ra   )numpyr   r	   "skimage._shared._dependency_checksr   skimage.feature.utilr   r   r   r   r   r   r   r   r!   markskipifparametrizerV   r`   r_   ra   r   r   r   r   <module>   s&    	Y "