
    9i                     v    S SK rSSKJr  SSKJrJr   " S S5      r " S S5      rS	SS
SS.S jr	S r
S rS rg)    N   )img_as_float)_supported_float_typecheck_nDc                        \ rS rSrS rS rSrg)FeatureDetector
   c                 :    [         R                  " / 5      U l        g N)nparray
keypoints_selfs    T/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/skimage/feature/util.py__init__FeatureDetector.__init__   s    ((2,    c                     [        5       e)zUDetect keypoints in image.

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

NotImplementedError)r   images     r   detectFeatureDetector.detect   s     "##r   )r   N)__name__
__module____qualname____firstlineno__r   r   __static_attributes__ r   r   r   r   
   s    '	$r   r   c                        \ rS rSrS rS rSrg)DescriptorExtractor   c                 :    [         R                  " / 5      U l        g r   )r   r   descriptors_r   s    r   r   DescriptorExtractor.__init__   s    HHRLr   c                     [        5       e)zExtract 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   extractDescriptorExtractor.extract   s     "##r   )r%   N)r   r   r   r   r   r)   r   r    r   r   r"   r"      s    )$r   r"   kF
horizontal)keypoints_colormatches_coloronly_matches	alignmentc                   [        U 5      n [        U5      n[        U R                  5      n
[        UR                  5      nU R                  S   UR                  S   :  a  UR                  S   U
S'   O2U R                  S   UR                  S   :  a  U R                  S   US'   U R                  S   UR                  S   :  a  UR                  S   U
S'   O2U R                  S   UR                  S   :  a  U R                  S   US'   XR                  :w  aD  [        R                  " XR
                  S9nXSU R                  S   2SU R                  S   24'   Un XR                  :w  aD  [        R                  " XR
                  S9nXSUR                  S   2SUR                  S   24'   Un[        R                  " U R                  5      nU	S:X  a  [        R                  " X/SS9nSUS'   O3U	S:X  a  [        R                  " X/SS9nSUS'   OSU	 S	3n[        U5      eU(       dL  UR                  USS2S4   USS2S4   S
US9  UR                  USS2S4   US   -   USS2S4   US   -   S
US9  UR                  USS9  UR                  SU R                  S   US   -   U R                  S   US   -   S45        UR                  S   nSSKJn  UcH  [        R                  R                  SS9n[!        U5       Vs/ s H  nUR                  S5      PM     nnOYU" U5      (       a  [!        U5       Vs/ s H  nUPM     nnO0[#        US5      (       a  [%        U5      U:X  a  UnOSn[        U5      e['        U5       HD  u  nnUu  nnUR)                  UUS4   UUS4   US   -   4UUS4   UUS4   US   -   4SUU   S9  MF     gs  snf s  snf )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   zerosr3   r   concatenate
ValueErrorscatterimshowr4   matplotlib.colorsr;   randomdefault_rngrangehasattrlen	enumerateplot)image0image1
keypoints0
keypoints1matchesaxr-   r.   r/   r0   
new_shape0
new_shape1
new_image0
new_image1offsetr   mesgnumber_of_matchesr;   rng_colorserror_messageimatchidx0idx1s                              r   plot_matched_featuresre   ,   s   l &!F&!Ffll#Jfll#J||Aa(Q
1	a6<<?	*Q
1||Aa(Q
1	a6<<?	*Q
1\\!XXj=
;A$V\\!_$&7Q&778\\!XXj=
;A$V\\!_$&7Q&778XXfll#FL /a8q		j	 /a8q	(k * 	 


q!tq!t&	 	 	
 	

q!tvay(q!tvay(&	 	 	
 IIe&I!GGQQ&)+V\\!_vay-H!LMa(/ii###+)./@)AB)AA#**Q-)AB	}	%	%)./@)AB)AA-)AB			*	*s=/AEV/VF 	 ''g&5
d
a *T1W"5q	"ABa *T1W"5q	"AB)	 	 	
 ' CBs   O>Oc                     [         R                  " U 5      n [        U S5        [        U 5      n [	        U R
                  5      nU R                  USS9$ )Nr   Fcopy)r   squeezer   r   r   r3   astyper   float_dtypes     r   _prepare_grayscale_input_2Drm      sE    JJuEUAE'4K<<%<00r   c                     [         R                  " U 5      n [        U [        SS5      5        [	        U 5      n [        U R                  5      nU R                  USS9$ )Nr      Frg   )r   ri   r   rK   r   r   r3   rj   rk   s     r   _prepare_grayscale_input_nDrp      sK    JJuEUE!QK E'4K<<%<00r   c                     U S   nU S   nUS-
  USS2S4   :  USS2S4   X2-
  S-   :  -  US-
  USS2S4   :  -  USS2S4   XB-
  S-   :  -  nU$ )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   r2   Nr    )image_shaper(   distancerowscolsmasks         r   _mask_border_keypointsrw      s    ( q>Dq>D Q,)AqD/	)QT?do12	4qLIadO+	- QT?do12	4 	 Kr   )numpyr   utilr   _shared.utilsr   r   r   r"   re   rm   rp   rw   r    r   r   <module>r{      sH     $ $ $ $4 K
\11r   