a
    
dV                     @   s   d dl Z d dlZd dlZd dlmZ d dlmZ d dlm	Z	m
Z
mZ d dlmZ dd Ze jdg d	d
d Ze jdg d	dd Zdd Ze jdg d	dd Zdd ZdS )    N)assert_array_equal)data)BRIEFcorner_peakscorner_harris)testingc                  C   s\   t d} t ddgddgg}tt t | | W d   n1 sN0    Y  dS )z=Brief descriptors can be evaluated on gray-scale images only.)   r                  N)npzerosZasarrayr   raises
ValueErrorr   extract)img	keypoints r   i/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/skimage/feature/tests/test_brief.py"test_color_image_unsupported_error   s    
r   dtype)float32float64Zuint8intc              
   C   s   t  | }tt|dddd}tddd}|||dd  tjg d	g d
g d	g dg d
g dg d	g dgt	d}t
|j| dS )zDVerify the computed BRIEF descriptors with expected for normal mode.r   r   皙?Zmin_distanceZthreshold_absZthreshold_rel      )descriptor_sizesigmaN)   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   )r"   r   r"   r   r   r"   r"   r   r   )r   coinsastyper   r   r   r   r   arrayboolr   descriptorsr   r   r   	extractorexpectedr   r   r   test_normal_mode   s$    

	r,   c              
   C   s   t  | }tt|dddd}tddddd	}td
g  tddddd W d   n1 sd0    Y  |||dd  t	j
g dg dg dg dg dg dg dg dgtd}t|j| dS )zEVerify the computed BRIEF descriptors with expected for uniform mode.r   r   r   r   r   r   uniformr"   )r    r!   moderngz&`sample_seed` is a deprecated argument)r    r!   r.   Zsample_seedN)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"   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   r   r   Zexpected_warningsr   r   r&   r'   r   r(   r)   r   r   r   test_uniform_mode,   s(    
.
	r0   c                   C   s8   t t tdd W d    n1 s*0    Y  d S )NZfoobar)r.   )r   r   r   r   r   r   r   r   test_unsupported_modeF   s    r1   c                 C   sl   t jd| d}t ddgddgddgddgg}tddd}||| |jjd	 d
ks\J t|jd d S )Nd   r3   r#   r"   r   2   P   )   Z
patch_sizer/   r   r	   )FTTT)	r   r   r&   r   r   r(   shaper   mask)r   r   r   r*   r   r   r   test_borderK   s    "r:   c                  C   s   t jdtd} t ddgddgddgddgg}t j }td|d}t|j	 }|  |
| | t|j	 }||ksJ d S )	Nr2   r#   r"   r   r4   r5   r6   r7   )r   r   r   r&   randomZdefault_rngr   copydeepcopyr/   r   )r   r   r/   r*   xzr   r   r   test_independent_rngW   s    "
r@   )Zpytestr<   numpyr   Zskimage._shared.testingr   Zskimager   Zskimage.featurer   r   r   Zskimage._sharedr   r   markZparametrizer,   r0   r1   r:   r@   r   r   r   r   <module>   s   


