§
    )Áôg‰  ã                   ó‚   — d dl ZddlmZ ddlmZmZ  G d„ d¦  «        Z G d„ d¦  «        Zd	dd
ddœd„Z	d„ Z
d„ Zd„ ZdS )é    Né   )Úimg_as_float)Ú_supported_float_typeÚcheck_nDc                   ó   — e Zd Zd„ Zd„ ZdS )ÚFeatureDetectorc                 ó8   — t          j        g ¦  «        | _        d S ©N)ÚnpÚarrayÚ
keypoints_©Úselfs    ú]/var/www/html/bac/bac_backend/python/env/lib/python3.11/site-packages/skimage/feature/util.pyÚ__init__zFeatureDetector.__init__   s   € Ýœ( 2™,œ,ˆŒˆˆó    c                 ó   — t          ¦   «         ‚)z}Detect keypoints in image.

        Parameters
        ----------
        image : 2D array
            Input image.

        ©ÚNotImplementedError)r   Úimages     r   ÚdetectzFeatureDetector.detect   s   € õ "Ñ#Ô#Ð#r   N)Ú__name__Ú
__module__Ú__qualname__r   r   © r   r   r   r   
   s2   € € € € € ð'ð 'ð 'ð	$ð 	$ð 	$ð 	$ð 	$r   r   c                   ó   — e Zd Zd„ Zd„ ZdS )ÚDescriptorExtractorc                 ó8   — t          j        g ¦  «        | _        d S r
   )r   r   Údescriptors_r   s    r   r   zDescriptorExtractor.__init__   s   € ÝœH R™LœLˆÔÐÐr   c                 ó   — t          ¦   «         ‚)zïExtract feature descriptors in image for given keypoints.

        Parameters
        ----------
        image : 2D array
            Input image.
        keypoints : (N, 2) array
            Keypoint locations as ``(row, col)``.

        r   )r   r   Ú	keypointss      r   ÚextractzDescriptorExtractor.extract   s   € õ "Ñ#Ô#Ð#r   N)r   r   r   r   r"   r   r   r   r   r      s2   € € € € € ð)ð )ð )ð$ð $ð $ð $ð $r   r   ÚkFÚ
horizontal)Úkeypoints_colorÚmatches_colorÚonly_matchesÚ	alignmentc                óÒ  ‡‡— t          | ¦  «        } t          |¦  «        }t          | j        ¦  «        }
t          |j        ¦  «        }| j        d         |j        d         k     r|j        d         |
d<   n,| j        d         |j        d         k    r| j        d         |d<   | j        d         |j        d         k     r|j        d         |
d<   n,| j        d         |j        d         k    r| j        d         |d<   |
| j        k    r>t          j        |
| j        ¬¦  «        }| |d| j        d         …d| j        d         …f<   |} ||j        k    r>t          j        ||j        ¬¦  «        }||d|j        d         …d|j        d         …f<   |}t          j        | j        ¦  «        }|	dk    rt          j        | |gd¬¦  «        }d|d<   n9|	dk    rt          j        | |gd¬¦  «        }d|d<   nd|	› d	�}t          |¦  «        ‚|sl| 	                    |dd…df         |dd…df         d
|¬¦  «         | 	                    |dd…df         |d         z   |dd…df         |d         z   d
|¬¦  «         | 
                    |d¬¦  «         |                     d| j        d         |d         z   | j        d         |d         z   df¦  «         |j        d         }ddlm} ‰€<t          j                             d¬¦  «        Šˆfd„t!          |¦  «        D ¦   «         }n^ |‰¦  «        rˆfd„t!          |¦  «        D ¦   «         }n7t#          ‰d¦  «        rt%          ‰¦  «        |k    r‰}nd}t          |¦  «        ‚t'          |¦  «        D ]_\  }}|\  }}|                     ||df         ||df         |d         z   f||df         ||df         |d         z   fd||         ¬¦  «         Œ`dS )a�  Plot matched features between two images.

    .. versionadded:: 0.23

    Parameters
    ----------
    image0 : (N, M [, 3]) array
        First image.
    image1 : (N, M [, 3]) array
        Second image.
    keypoints0 : (K1, 2) array
        First keypoint coordinates as ``(row, col)``.
    keypoints1 : (K2, 2) array
        Second keypoint coordinates as ``(row, col)``.
    matches : (Q, 2) array
        Indices of corresponding matches in first and second sets of
        descriptors, where `matches[:, 0]` (resp. `matches[:, 1]`) contains
        the indices in the first (resp. second) set of descriptors.
    ax : matplotlib.axes.Axes
        The Axes object where the images and their matched features are drawn.
    keypoints_color : matplotlib color, optional
        Color for keypoint locations.
    matches_color : matplotlib color or sequence thereof, optional
        Single color or sequence of colors for each line defined by `matches`,
        which connect keypoint matches. See [1]_ for an overview of supported
        color formats. By default, colors are picked randomly.
    only_matches : bool, optional
        Set to True to plot matches only and not the keypoint locations.
    alignment : {'horizontal', 'vertical'}, optional
        Whether to show the two images side by side (`'horizontal'`), or one above
        the other (`'vertical'`).

    References
    ----------
    .. [1] https://matplotlib.org/stable/users/explain/colors/colors.html#specifying-colors

    Notes
    -----
    To make a sequence of colors passed to `matches_color` work for any number of
    `matches`, you can wrap that sequence in :func:`itertools.cycle`.
    r   é   )ÚdtypeNr$   )ÚaxisÚverticalzV`plot_matched_features` accepts either 'horizontal' or 'vertical' for alignment, but 'z~' was given. See https://scikit-image.org/docs/dev/api/skimage.feature.html#skimage.feature.plot_matched_features for details.Únone)Ú
facecolorsÚ
edgecolorsÚgray)Úcmap)Úis_color_like)Úseedc                 ó:   •— g | ]}‰                      d ¦  «        ‘ŒS )é   )Úrandom)Ú.0Ú_Úrngs     €r   ú
<listcomp>z)plot_matched_features.<locals>.<listcomp>£   s#   ø€ ÐBÐBÐB A�#—*’*˜Q‘-”-ÐBÐBÐBr   c                 ó   •— g | ]}‰‘ŒS r   r   )r8   r9   r&   s     €r   r;   z)plot_matched_features.<locals>.<listcomp>¥   s   ø€ ÐBÐBÐB A�-ÐBÐBÐBr   Ú__len__zb`matches_color` needs to be a single color or a sequence of length equal to the number of matches.ú-)Úcolor)r   ÚlistÚshaper   Úzerosr+   r   ÚconcatenateÚ
ValueErrorÚscatterÚimshowr,   Úmatplotlib.colorsr3   r7   Údefault_rngÚrangeÚhasattrÚlenÚ	enumerateÚplot)Úimage0Úimage1Ú
keypoints0Ú
keypoints1ÚmatchesÚaxr%   r&   r'   r(   Ú
new_shape0Ú
new_shape1Ú
new_image0Ú
new_image1Úoffsetr   ÚmesgÚnumber_of_matchesr3   ÚcolorsÚerror_messageÚiÚmatchÚidx0Úidx1r:   s          `                 @r   Úplot_matched_featuresra   ,   s  øø€ õl ˜&Ñ!Ô!€FÝ˜&Ñ!Ô!€Få�f”lÑ#Ô#€JÝ�f”lÑ#Ô#€Jà„|�A„˜œ aœÒ(Ð(Øœ Qœˆ
�1‰ˆØ	Œ�aŒ˜6œ<¨œ?Ò	*Ð	*Øœ Qœˆ
�1‰à„|�A„˜œ aœÒ(Ð(Øœ Qœˆ
�1‰ˆØ	Œ�aŒ˜6œ<¨œ?Ò	*Ð	*Øœ Qœˆ
�1‰à�V”\Ò!Ð!Ý”X˜j°´Ð=Ñ=Ô=ˆ
Ø;Aˆ
Ð$�V”\ !”_Ð$Ð&7¨¬°Q¬Ð&7Ð7Ñ8Øˆà�V”\Ò!Ð!Ý”X˜j°´Ð=Ñ=Ô=ˆ
Ø;Aˆ
Ð$�V”\ !”_Ð$Ð&7¨¬°Q¬Ð&7Ð7Ñ8ØˆåŒX�f”lÑ#Ô#€FØ�LÒ Ð Ý” ¨Ð/°aÐ8Ñ8Ô8ˆØˆˆq‰	ˆ	Ø	�jÒ	 Ð	 Ý” ¨Ð/°aÐ8Ñ8Ô8ˆØˆˆq‰	ˆ	ðØ(ðð ð ð 	õ ˜ÑÔÐàð 
Ø
�
Š
Ø�q�q�q˜!�tÔØ�q�q�q˜!�tÔØØ&ð	 	ñ 	
ô 	
ð 	
ð 	�
Š
Ø�q�q�q˜!�tÔ˜v aœyÑ(Ø�q�q�q˜!�tÔ˜v aœyÑ(ØØ&ð	 	ñ 	
ô 	
ð 	
ð ‡I‚Iˆe˜&€IÑ!Ô!Ð!Ø‡G‚GˆQ�”˜Q” &¨¤)Ñ+¨V¬\¸!¬_¸vÀa¼yÑ-HÈ!ÐLÑMÔMÐMàœ aÔ(Ðà/Ð/Ð/Ð/Ð/Ð/àÐÝŒi×#Ò#¨Ð#Ñ+Ô+ˆØBÐBÐBÐB­Ð/@Ñ)AÔ)AÐBÑBÔBˆˆØ	ˆ�}Ñ	%Ô	%ð 
(ØBÐBÐBÐB­Ð/@Ñ)AÔ)AÐBÑBÔBˆˆÝ	� 	Ñ	*Ô	*ð (­s°=Ñ/AÔ/AÐEVÒ/VÐ/VàˆˆðFð 	õ ˜Ñ'Ô'Ð'å˜gÑ&Ô&ð 
ð 
‰ˆˆ5Ø‰
ˆˆdØ
�ŠØ˜˜a˜Ô  *¨T°1¨WÔ"5¸¸q¼	Ñ"AÐBØ˜˜a˜Ô  *¨T°1¨WÔ"5¸¸q¼	Ñ"AÐBØØ˜”)ð	 	ñ 	
ô 	
ð 	
ð 	
ð
ð 
r   c                 ó¾   — t          j        | ¦  «        } t          | d¦  «         t          | ¦  «        } t	          | j        ¦  «        }|                      |d¬¦  «        S )Nr   F©Úcopy)r   Úsqueezer   r   r   r+   Úastype©r   Úfloat_dtypes     r   Ú_prepare_grayscale_input_2Dri   º   sS   € ÝŒJ�uÑÔ€EÝˆU�AÑÔÐÝ˜ÑÔ€EÝ'¨¬Ñ4Ô4€KØ�<Š<˜¨%ˆ<Ñ0Ô0Ð0r   c                 óÚ   — t          j        | ¦  «        } t          | t          dd¦  «        ¦  «         t	          | ¦  «        } t          | j        ¦  «        }|                      |d¬¦  «        S )Nr   é   Frc   )r   re   r   rI   r   r   r+   rf   rg   s     r   Ú_prepare_grayscale_input_nDrl   Â   s[   € ÝŒJ�uÑÔ€EÝˆU•E˜!˜Q‘K”KÑ Ô Ð Ý˜ÑÔ€EÝ'¨¬Ñ4Ô4€KØ�<Š<˜¨%ˆ<Ñ0Ô0Ð0r   c                 óÐ   — | d         }| d         }|dz
  |dd…df         k     |dd…df         ||z
  dz   k     z  |dz
  |dd…df         k     z  |dd…df         ||z
  dz   k     z  }|S )að  Mask coordinates that are within certain distance from the image border.

    Parameters
    ----------
    image_shape : (2,) array_like
        Shape of the image as ``(rows, cols)``.
    keypoints : (N, 2) array
        Keypoint coordinates as ``(rows, cols)``.
    distance : int
        Image border distance.

    Returns
    -------
    mask : (N,) bool array
        Mask indicating if pixels are within the image (``True``) or in the
        border region of the image (``False``).

    r   r*   Nr   )Úimage_shaper!   ÚdistanceÚrowsÚcolsÚmasks         r   Ú_mask_border_keypointsrs   Ê   sŸ   € ð( �qŒ>€DØ�qŒ>€Dð �Q‰,˜) A A A q Dœ/Ò	)Ø�Q�Q�Q˜�TŒ?˜d X™o°Ñ1Ò2ñ	4à�q‰L˜I a a a¨ dœOÒ+ñ	-ð �Q�Q�Q˜�TŒ?˜d X™o°Ñ1Ò2ñ	4ð 	ð €Kr   )Únumpyr   Úutilr   Ú_shared.utilsr   r   r   r   ra   ri   rl   rs   r   r   r   ú<module>rw      sÿ   ðØ Ð Ð Ð à Ð Ð Ð Ð Ð ðð ð ð ð ð ð ð ð$ð $ð $ð $ð $ñ $ô $ð $ð $ð $ð $ð $ð $ñ $ô $ð $ð4 ØØØðK
ð K
ð K
ð K
ð K
ð\1ð 1ð 1ð1ð 1ð 1ðð ð ð ð r   