a
    
d                     @   s   d dl Zd dlmZ d dlmZ d dlmZ d dlmZ d dl	m
Z
 d dlmZ e Zejd  dd	 Zd
d Zdd Zdd Zdd Ze dd Zdd ZdS )    N)assert_array_equal)moon)CENSURE)run_in_parallel)testing)rescalec                  C   s8   t jdd} t jdd}t | t |  dS )z>Censure feature detector should work on 2D image of any shape.i,     N)nprandomZrandr   detect)Z
rect_imageZsquare_image r   k/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/skimage/feature/tests/test_censure.py"test_censure_on_rectangular_images   s    r   c                   C   s@   t t" t td W d   n1 s20    Y  dS )z?Censure keypoints can be extracted from gray-scale images only.)   r      N)r   raises
ValueErrorr   r   r	   zerosr   r   r   r   4test_keypoints_censure_color_image_unsupported_error   s    r   c                   C   s8   t t tdd W d   n1 s*0    Y  dS )zJMode argument in keypoints_censure can be either DoB, Octagon or
    STAR.dummymodeNr   r   r   r   r   r   r   r   *test_keypoints_censure_mode_validity_error   s    r   c                   C   s:   t t tddd W d   n1 s,0    Y  dS )z~Difference between the the max_scale and min_scale parameters in
    keypoints_censure should be greater than or equal to two.      )Z	min_scaleZ	max_scaleNr   r   r   r   r   (test_keypoints_censure_scale_range_error#   s    r   c                  C   sz   t  } | t tddgddgddgddgd	d
gddgddgddgddgg	}tg d}t|| j t|| j dS )znVerify the actual Censure keypoints and their corresponding scale with
    the expected values for DoB filter.   i  $   .   w   i^        i     ie     i  t   i     i  i  )	r      r'   r   r   r   r   r   r   N)r   r   imgr	   arrayr   	keypointsscalesdetectorZexpected_keypointsZexpected_scalesr   r   r   %test_keypoints_censure_moon_image_dob*   s    

	r.   c                  C   sr   t dd} | ttdddd tddgd	d
gddgddgddgg}tg d}t|| j t|| j dS )zrVerify the actual Censure keypoints and their corresponding scale with
    the expected values for Octagon filter.Zoctagonr         ?FconstantZanti_aliasingr            Y      W   j   ;   o   C   )r   r      r   r'   N	r   r   r   r(   r	   r)   r   r*   r+   r,   r   r   r   )test_keypoints_censure_moon_image_octagon>   s    


r>   c               
   C   s~   t dd} | ttdddd tddgd	d
gddgddgddgddgddgg}tg d}t|| j t|| j dS )zoVerify the actual Censure keypoints and their corresponding scale with
    the expected values for STAR filter.Zstarr   r/   Fr0   r1   r2   r3   r4   r5      V   k   r9   m   @   r:   r;   q   F   )r   r   r'   r   r<   r   r   Nr=   r,   r   r   r   &test_keypoints_censure_moon_image_starT   s     


rF   )numpyr	   Zskimage._shared.testingr   Zskimage.datar   Zskimage.featurer   r   Zskimage._sharedr   Zskimage.transformr   r(   r
   seedr   r   r   r   r.   r>   rF   r   r   r   r   <module>   s    
