
    9i                     @    S SK rS SKJr  SS\R                  SS4S jrg)    N)cdist   T      ?c                 4   U R                   S   UR                   S   :w  a  [        S5      eUc/  [        R                  " U R                  [
        5      (       a  SnOSn0 nUS:X  a  X7S'   [        X4SU0UD6n[        R                  " U R                   S   5      n	[        R                  " USS	9n
U(       a$  [        R                  " USS	9nXU
   :H  nX   n	X   n
U[        R                  :  a  XU
4   U:  nX   n	X   n
US
:  a{  XU
4   n[        R                  XU
4'   [        R                  " X   SS	9nXU4   n[        R                  " [        R                  5      R                  XS:H  '   X-  nUU:  nX   n	X   n
[        R                  " X45      nU$ )a%  Brute-force matching of descriptors.

For each descriptor in the first set this matcher finds the closest
descriptor in the second set (and vice-versa in the case of enabled
cross-checking).

Parameters
----------
descriptors1 : (M, P) array
    Descriptors of size P about M keypoints in the first image.
descriptors2 : (N, P) array
    Descriptors of size P about N keypoints in the second image.
metric : {'euclidean', 'cityblock', 'minkowski', 'hamming', ...} , optional
    The metric to compute the distance between two descriptors. See
    `scipy.spatial.distance.cdist` for all possible types. The hamming
    distance should be used for binary descriptors. By default the L2-norm
    is used for all descriptors of dtype float or double and the Hamming
    distance is used for binary descriptors automatically.
p : int, optional
    The p-norm to apply for ``metric='minkowski'``.
max_distance : float, optional
    Maximum allowed distance between descriptors of two keypoints
    in separate images to be regarded as a match.
cross_check : bool, optional
    If True, the matched keypoints are returned after cross checking i.e. a
    matched pair (keypoint1, keypoint2) is returned if keypoint2 is the
    best match for keypoint1 in second image and keypoint1 is the best
    match for keypoint2 in first image.
max_ratio : float, optional
    Maximum ratio of distances between first and second closest descriptor
    in the second set of descriptors. This threshold is useful to filter
    ambiguous matches between the two descriptor sets. The choice of this
    value depends on the statistics of the chosen descriptor, e.g.,
    for SIFT descriptors a value of 0.8 is usually chosen, see
    D.G. Lowe, "Distinctive Image Features from Scale-Invariant Keypoints",
    International Journal of Computer Vision, 2004.

Returns
-------
matches : (Q, 2) array
    Indices of corresponding matches in first and second set of
    descriptors, where ``matches[:, 0]`` denote the indices in the first
    and ``matches[:, 1]`` the indices in the second set of descriptors.

   zDescriptor length must equal.hamming	euclidean	minkowskipmetricr   )axisr   )shape
ValueErrornp
issubdtypedtypeboolr   arangeargmininffinfofloat64epscolumn_stack)descriptors1descriptors2r   r   max_distancecross_check	max_ratiokwargs	distancesindices1indices2matches1maskbest_distancessecond_best_indices2second_best_distancesratiomatchess                     U/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/skimage/feature/match.pymatch_descriptorsr,      s   n ! 2 21 55899~==++T22F FF slJJ6JIyy++A./Hyy+H99YQ/H-->>bff8+,|;>>3"X#56(*	H$%!yy)<1E )4H*H I<>HHRZZ<P<T<Tq896y >>oox23GN    )numpyr   scipy.spatial.distancer   r   r,    r-   r+   <module>r1      s&     ( br-   