
    |hY                         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                  j                  d        d Zd	 Zd
 Zd Zd Z e       d        Zd Zy)    N)assert_array_equal)moon)CENSURE)run_in_parallel)testing)rescalec                      t         j                  j                  dd      } t         j                  j                  dd      }t               j	                  |       t               j	                  |        y)z>Censure feature detector should work on 2D image of any shape.i,     N)nprandomrandr   detect)
rect_imagesquare_images     a/var/www/html/test/engine/venv/lib/python3.12/site-packages/skimage/feature/tests/test_censure.py"test_censure_on_rectangular_imagesr      sJ    S)J99>>#s+LI\"IZ     c                      t        j                  t              5  t               j	                  t        j                  d             ddd       y# 1 sw Y   yxY w)z?Censure keypoints can be extracted from gray-scale images only.)   r      N)r   raises
ValueErrorr   r   r   zeros r   r   4test_keypoints_censure_color_image_unsupported_errorr      s<    	
	# 0	+./0 0 0s   -AAc                  x    t        j                  t              5  t        d       ddd       y# 1 sw Y   yxY w)zJMode argument in keypoints_censure can be either DoB, Octagon or
    STAR.dummymodeNr   r   r   r   r   r   r   *test_keypoints_censure_mode_validity_errorr!      s-     

	# W  s   09c                  z    t        j                  t              5  t        dd       ddd       y# 1 sw Y   yxY w)z~Difference between the the max_scale and min_scale parameters in
    keypoints_censure should be greater than or equal to two.      )	min_scale	max_scaleNr    r   r   r   (test_keypoints_censure_scale_range_errorr'   #   s/     

	# *!q)* * *s   1:c                  (   t               } | j                  t               t        j                  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        j                  g d      }t        || j                         t        || j                         y)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      r3   r$   r$   r   r$   r$   r$   N)r   r   imgr   arrayr   	keypointsscalesdetectorexpected_keypointsexpected_scaless      r   %test_keypoints_censure_moon_image_dobr<   *   s     yHOOCIH#J#J#J#J#J#J#J
	
 hh:;O)8+=+=>8r   c                  .   t        d      } | j                  t        t        ddd             t	        j
                  ddgd	d
gddgddgddgg      }t	        j
                  g d      }t        || j                         t        || j                         y)zrVerify the actual Censure keypoints and their corresponding scale with
    the expected values for Octagon filter.octagonr         ?Fconstantanti_aliasingr            Y      W   j   ;   o   C   )r   r$      r$   r3   N	r   r   r   r4   r   r5   r   r6   r7   r8   s      r   )test_keypoints_censure_moon_image_octagonrO   B   s    
 I&HOOGCULMB8b"XBx#rSRTI"VWhh/O)8+=+=>8r   c            
      :   t        d      } | j                  t        t        ddd             t	        j
                  ddgd	d
gddgddgddgddgddgg      }t	        j
                  g d      }t        || j                         t        || j                         y)zoVerify the actual Censure keypoints and their corresponding scale with
    the expected values for STAR filter.starr   r?   Fr@   rA   rC   rD   rE   rF      V   k   rJ   m   @   rK   rL   q   F   )r   r$   r3   r$   rM   r   r$   NrN   r8   s      r   &test_keypoints_censure_moon_image_starrY   R   s     F#HOOGCULM
bB8b"XRy3)c2Yb	R hh45O)8+=+=>8r   )numpyr   skimage._shared.testingr   skimage.datar   skimage.featurer   r   skimage._sharedr   skimage.transformr   r4   r   seedr   r   r!   r'   r<   rO   rY   r   r   r   <module>ra      sh     6  # 3 # % f 		q !0*90 9 99r   