Ë
    ÿ[;jq  ã                   ót   — 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y)é    Né   )Úimg_as_float)Ú_supported_float_typeÚcheck_nDc                   ó   — e Zd Zd„ Zd„ Zy)ÚFeatureDetectorc                 ó8   — t        j                  g «      | _        y ©N)ÚnpÚarrayÚ
keypoints_©Úselfs    ú]G:\00. PROJECTS\API\Inventory\templateJSON\kerjaOCR\Lib\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   
   s   „ ò'ó	$r   r   c                   ó   — e Zd Zd„ Zd„ Zy)ÚDescriptorExtractorc                 ó8   — t        j                  g «      | _        y r
   )r   r   Údescriptors_r   s    r   r   zDescriptorExtractor.__init__   s   € ÜŸH™H R›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      s   „ ò)ó$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<   n1| j                  d   |j                  d   kD  r| j                  d   |d<   | j                  d   |j                  d   k  r|j                  d   |
d<   n1| j                  d   |j                  d   kD  r| j                  d   |d<   |
| j                  k7  rHt        j                  |
| j
                  ¬«      }| |d| j                  d   …d| j                  d   …f<   |} ||j                  k7  rHt        j                  ||j
                  ¬«      }||d|j                  d   …d|j                  d   …f<   |}t        j                  | j                  «      }|	dk(  rt        j                  | |gd¬«      }d|d<   n5|	dk(  rt        j                  | |gd¬«      }d|d<   nd|	› d	�}t        |«      ‚|sR|j                  |dd…df   |dd…df   d
|¬«       |j                  |dd…df   |d   z   |dd…df   |d   z   d
|¬«       |j                  |d¬«       |j                  d| j                  d   |d   z   | j                  d   |d   z   df«       |j                  d   }ddlm} |€Ht        j                  j                  d¬«      }t!        |«      D �cg c]  }|j                  d«      ‘Œ }}nK ||«      rt!        |«      D �cg c]  }|‘Œ }}n*t#        |d«      rt%        |«      |k(  r|}nd}t        |«      ‚t'        |«      D ]F  \  }}|\  }}|j)                  ||df   ||df   |d   z   f||df   ||df   |d   z   fd||   ¬«       ŒH yc c}w c c}w )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)Úseedé   Ú__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   ÚrandomÚ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   ÚrngÚ_ÚcolorsÚerror_messageÚiÚmatchÚidx0Úidx1s                              r   Úplot_matched_featuresr]   ,   sì  € ôl ˜&Ó!€FÜ˜&Ó!€Fä�f—l‘lÓ#€JÜ�f—l‘lÓ#€Jà‡|�|�A�˜Ÿ™ a™Ò(ØŸ™ Q™ˆ
�1ŠØ	�‰�a‰˜6Ÿ<™<¨™?Ò	*ØŸ™ Q™ˆ
�1‰à‡|�|�A�˜Ÿ™ a™Ò(ØŸ™ Q™ˆ
�1ŠØ	�‰�a‰˜6Ÿ<™<¨™?Ò	*ØŸ™ Q™ˆ
�1‰à�V—\‘\Ò!Ü—X‘X˜j°·±Ô=ˆ
Ø;Aˆ
Ð$�V—\‘\ !‘_Ð$Ð&7¨¯©°Q©Ð&7Ð7Ñ8Øˆà�V—\‘\Ò!Ü—X‘X˜j°·±Ô=ˆ
Ø;Aˆ
Ð$�V—\‘\ !‘_Ð$Ð&7¨¯©°Q©Ð&7Ð7Ñ8Øˆä�X‰X�f—l‘lÓ#€FØ�LÒ Ü—‘ ¨Ð/°aÔ8ˆØˆˆqŠ	Ø	�jÒ	 Ü—‘ ¨Ð/°aÔ8ˆØˆˆqŠ	ðØ(˜kð *ðð 	ô ˜ÓÐáØ
�
‰
Ø’q˜!�tÑØ’q˜!�tÑØØ&ð	 	ô 	
ð 	�
‰
Ø’q˜!�tÑ˜v a™yÑ(Ø’q˜!�tÑ˜v a™yÑ(ØØ&ð	 	ô 	
ð ‡I�Iˆe˜&€IÔ!Ø‡G�GˆQ�—‘˜Q‘ &¨¡)Ñ+¨V¯\©\¸!©_¸vÀa¹yÑ-HÈ!ÐLÔMàŸ™ aÑ(Ðå/àÐÜ�i‰i×#Ñ#¨Ð#Ó+ˆÜ).Ð/@Ô)AÓBÑ)A A�#—*‘*˜Q•-Ð)AˆÑBÙ	�}Ô	%Ü).Ð/@Ô)AÓBÑ)A A’-Ð)AˆÑBÜ	� 	Ô	*¬s°=Ó/AÐEVÒ/Và‰ðFð 	ô ˜Ó'Ð'ä˜gÖ&‰ˆˆ5Ø‰
ˆˆdØ
�‰Ø˜˜a˜Ñ  *¨T°1¨WÑ"5¸¸q¹	Ñ"AÐBØ˜˜a˜Ñ  *¨T°1¨WÑ"5¸¸q¹	Ñ"AÐBØØ˜‘)ð	 	õ 	
ñ 'ùò CùâBs   ÌOÍ	Oc                 óª   — t        j                  | «      } t        | d«       t        | «      } t	        | j
                  «      }| j                  |d¬«      S )Nr   F©Úcopy)r   Úsqueezer   r   r   r+   Úastype©r   Úfloat_dtypes     r   Ú_prepare_grayscale_input_2Dre   º   sE   € Ü�J‰J�uÓ€EÜˆU�AÔÜ˜Ó€EÜ'¨¯©Ó4€KØ�<‰<˜¨%ˆ<Ó0Ð0r   c                 ó¾   — t        j                  | «      } t        | t        dd«      «       t	        | «      } t        | j                  «      }| j                  |d¬«      S )Nr   é   Fr_   )r   ra   r   rC   r   r   r+   rb   rc   s     r   Ú_prepare_grayscale_input_nDrh   Â   sK   € Ü�J‰J�uÓ€EÜˆU”E˜!˜Q“KÔ Ü˜Ó€EÜ'¨¯©Ó4€KØ�<‰<˜¨%ˆ<Ó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_keypointsro   Ê   s�   € ð( �q‰>€DØ�q‰>€Dð �Q‰,˜)¢A q D™/Ñ	)Ø’Q˜�T‰?˜d X™o°Ñ1Ñ2ñ	4à�q‰L˜I¢a¨ d™OÑ+ñ	-ð ’Q˜�T‰?˜d X™o°Ñ1Ñ2ñ	4ð 	ð €Kr   )Únumpyr   Úutilr   Ú_shared.utilsr   r   r   r   r]   re   rh   ro   r   r   r   Ú<module>rs      sH   ðÛ å ÷÷$ñ $÷ $ñ $ð4 ØØØôK
ò\1ò1ór   