U
    ?h                     @   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   T/var/www/html/venv/lib/python3.8/site-packages/skimage/feature/tests/test_censure.py"test_censure_on_rectangular_images   s    r   c                	   C   s,   t t t td W 5 Q R X dS )z?Censure keypoints can be extracted from gray-scale images only.)   r      N)r   raises
ValueErrorr   r   r	   Zzerosr   r   r   r   4test_keypoints_censure_color_image_unsupported_error   s    r   c                	   C   s$   t t tdd W 5 Q R X 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 5 Q R X 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   s   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dddddddddg	}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   N)r   r   imgr	   arrayr   	keypointsscalesZdetectorZexpected_keypointsZexpected_scalesr   r   r   %test_keypoints_censure_moon_image_dob*   s    

	r,   c                  C   sx   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dddddg}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&   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dddddddg}t|| j t|| j dS )zoVerify the actual Censure keypoints and their corresponding scale with
    the expected values for STAR filter.starr   r-   Fr.   r/   r0   r1   r2   r3      V   k   r7   m   @   r8   r9   q   F   r   r   r&   r:   Nr;   r+   r   r   r   &test_keypoints_censure_moon_image_starT   s     


rE   )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<   rE   r   r   r   r   <module>   s    
