o
    Õj‚  ã                   @   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  ƒ dS 1 s(w   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   úa/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/skimage/feature/tests/test_brief.pyÚ"test_color_image_unsupported_error   s
   
"ÿr   Údtype)Zfloat32Z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   ZcoinsZ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d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 )zEVerify the computed BRIEF descriptors with expected for uniform mode.r   r   r   r   r   r   Úuniformr    )r   r   ÚmodeÚrngN)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   Útest_uniform_mode2   s(   ÿø
õr-   c                   C   s:   t  t¡ tdd W d   ƒ d S 1 sw   Y  d S )NZfoobar)r+   )r   r   r   r   r   r   r   r   Útest_unsupported_modeQ   s   "ÿr.   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   r0   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_borderV   s   "r7   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sCJ ‚d S )	Nr/   r!   r    r   r1   r2   r3   r4   )r   r   r   r#   ÚrandomZdefault_rngr   ÚcopyÚdeepcopyr,   r   )r   r   r,   r'   ÚxÚzr   r   r   Útest_independent_rngb   s   "
r=   )Zpytestr9   Únumpyr   Zskimage._shared.testingr   Zskimager   Zskimage.featurer   r   r   Zskimage._sharedr   r   ÚmarkZparametrizer)   r-   r.   r7   r=   r   r   r   r   Ú<module>   s     


