ó
 ‰\c           @   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 j d ƒ d	 „  Z d
 „  Z d „  Z d „  Z d „  Z e ƒ  d „  ƒ Z d „  Z d S(   iÿÿÿÿN(   t   assert_array_equal(   t   moon(   t   CENSURE(   t   test_parallel(   t   testing(   t   rescalei    c          C   sN   t  j j d d ƒ }  t  j j d d ƒ } t ƒ  j | ƒ t ƒ  j |  ƒ d S(   s>   Censure feature detector should work on 2D image of any shape.i,  iÈ   N(   t   npt   randomt   randR   t   detect(   t
   rect_imaget   square_image(    (    sA   lib/python2.7/site-packages/skimage/feature/tests/test_censure.pyt"   test_censure_on_rectangular_images   s    c        	   C   s3   t  j t ƒ  t ƒ  j t j d ƒ ƒ Wd QXd S(   s?   Censure keypoints can be extracted from gray-scale images only.i   i   N(   i   i   i   (   R   t   raisest
   ValueErrorR   R	   R   t   zeros(    (    (    sA   lib/python2.7/site-packages/skimage/feature/tests/test_censure.pyt4   test_keypoints_censure_color_image_unsupported_error   s    c           C   s'   t  j t ƒ  t d d ƒ Wd QXd S(   sJ   Mode argument in keypoints_censure can be either DoB, Octagon or
    STAR.t   modet   dummyN(   R   R   R   R   (    (    (    sA   lib/python2.7/site-packages/skimage/feature/tests/test_censure.pyt*   test_keypoints_censure_mode_validity_error   s    c        	   C   s-   t  j t ƒ  t d d d d ƒ Wd QXd S(   s~   Difference between the the max_scale and min_scale parameters in
    keypoints_censure should be greater than or equal to two.t	   min_scalei   t	   max_scalei   N(   R   R   R   R   (    (    (    sA   lib/python2.7/site-packages/skimage/feature/tests/test_censure.pyt(   test_keypoints_censure_scale_range_error#   s    c          C   sÄ   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 d d d d d d d d d g	 ƒ } t | |  j ƒ t | |  j ƒ d S(   sn   Verify the actual Censure keypoints and their corresponding scale with
    the expected values for DoB filter.i   iñ  i$   i.   iw   i^  i¹   i±   i  iú   ie  iï   iÏ  it   iÐ  i„   iÓ  i  i   i   i   N(   R   R	   t   imgR   t   arrayR    t	   keypointst   scales(   t   detectort   expected_keypointst   expected_scales(    (    sA   lib/python2.7/site-packages/skimage/feature/tests/test_censure.pyt%   test_keypoints_censure_moon_image_dob*   s    								*c       
   C   sµ   t  d d ƒ }  |  j t t d d t d t d d ƒƒ t j d d g d	 d
 g d d g d d g d d g g ƒ } t j d d d d d g ƒ } t | |  j ƒ t | |  j	 ƒ d S(   sr   Verify the actual Censure keypoints and their corresponding scale with
    the expected values for Octagon filter.R   t   octagong      Ð?t   multichannelt   anti_aliasingt   constanti   i   i   iY   i   iW   ij   i;   io   iC   i   i   i   i   N(
   R   R	   R   R   t   FalseR   R   R    R   R   (   R   R   R   (    (    sA   lib/python2.7/site-packages/skimage/feature/tests/test_censure.pyt)   test_keypoints_censure_moon_image_octagon>   s    
			c       
   C   sÍ   t  d d ƒ }  |  j t t d d t d t 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 d d d d d d d g ƒ } t | |  j ƒ t | |  j	 ƒ d S(   so   Verify the actual Censure keypoints and their corresponding scale with
    the expected values for STAR filter.R   t   starg      Ð?R    R!   R"   i   i   i   iY   i   iV   ik   i;   im   i@   io   iC   iq   iF   i   i   i   i   N(
   R   R	   R   R   R#   R   R   R    R   R   (   R   R   R   (    (    sA   lib/python2.7/site-packages/skimage/feature/tests/test_censure.pyt&   test_keypoints_censure_moon_image_starU   s    
					$(   t   numpyR   t   skimage._shared.testingR    t   skimage.dataR   t   skimage.featureR   R   t   skimage._sharedR   t   skimage.transformR   R   R   t   seedR   R   R   R   R   R$   R&   (    (    (    sA   lib/python2.7/site-packages/skimage/feature/tests/test_censure.pyt   <module>   s   						