ó
    Å“,jÊ4  ã                   ó6  • S SK rSSKJrJrJrJr  SSKJrJ	r	J
r
Jr  SSKJr  SSKJr  SSKJr  SS	KJr  \R(                  " S
5      r/ SQr\" SS5       H6  r\" \\" \5         * \\" \5         S-   5       H  rS\S\-   S\-   4'   M     M8      " S S\\5      rg)é    Né   )ÚFeatureDetectorÚDescriptorExtractorÚ_mask_border_keypointsÚ_prepare_grayscale_input_2Dé   )Úcorner_fastÚcorner_orientationsÚcorner_peaksÚcorner_harris)Úpyramid_gaussian)Úcheck_nD)ÚNP_COPY_IF_NEEDED)Ú	_orb_loop)é   r   )é   r   r   r   é   r   r   é   r   é   é   é
   é	   é   é   é   iñÿÿÿé   r   c                   óR   • \ rS rSrSr      SS jrS rS rS rS r	S r
S	 rS
rg)ÚORBé   aÀ  Oriented FAST and rotated BRIEF feature detector and binary descriptor
extractor.

Parameters
----------
n_keypoints : int, optional
    Number of keypoints to be returned. The function will return the best
    `n_keypoints` according to the Harris corner response if more than
    `n_keypoints` are detected. If not, then all the detected keypoints
    are returned.
fast_n : int, optional
    The `n` parameter in `skimage.feature.corner_fast`. Minimum number of
    consecutive pixels out of 16 pixels on the circle that should all be
    either brighter or darker w.r.t test-pixel. A point c on the circle is
    darker w.r.t test pixel p if ``Ic < Ip - threshold`` and brighter if
    ``Ic > Ip + threshold``. Also stands for the n in ``FAST-n`` corner
    detector.
fast_threshold : float, optional
    The ``threshold`` parameter in ``feature.corner_fast``. Threshold used
    to decide whether the pixels on the circle are brighter, darker or
    similar w.r.t. the test pixel. Decrease the threshold when more
    corners are desired and vice-versa.
harris_k : float, optional
    The `k` parameter in `skimage.feature.corner_harris`. Sensitivity
    factor to separate corners from edges, typically in range ``[0, 0.2]``.
    Small values of `k` result in detection of sharp corners.
downscale : float, optional
    Downscale factor for the image pyramid. Default value 1.2 is chosen so
    that there are more dense scales which enable robust scale invariance
    for a subsequent feature description.
n_scales : int, optional
    Maximum number of scales from the bottom of the image pyramid to
    extract the features from.

Attributes
----------
keypoints : (N, 2) array
    Keypoint coordinates as ``(row, col)``.
scales : (N,) array
    Corresponding scales.
orientations : (N,) array
    Corresponding orientations in radians.
responses : (N,) array
    Corresponding Harris corner responses.
descriptors : (Q, `descriptor_size`) array of dtype bool
    2D array of binary descriptors of size `descriptor_size` for Q
    keypoints after filtering out border keypoints with value at an
    index ``(i, j)`` either being ``True`` or ``False`` representing
    the outcome of the intensity comparison for i-th keypoint on j-th
    decision pixel-pair. It is ``Q == np.sum(mask)``.

References
----------
.. [1] Ethan Rublee, Vincent Rabaud, Kurt Konolige and Gary Bradski
      "ORB: An efficient alternative to SIFT and SURF"
      http://www.vision.cs.chubu.ac.jp/CV-R/pdf/Rublee_iccv2011.pdf

Examples
--------
>>> from skimage.feature import ORB, match_descriptors
>>> img1 = np.zeros((100, 100))
>>> img2 = np.zeros_like(img1)
>>> rng = np.random.default_rng(19481137)  # do not copy this value
>>> square = rng.random((20, 20))
>>> img1[40:60, 40:60] = square
>>> img2[53:73, 53:73] = square
>>> detector_extractor1 = ORB(n_keypoints=5)
>>> detector_extractor2 = ORB(n_keypoints=5)
>>> detector_extractor1.detect_and_extract(img1)
>>> detector_extractor2.detect_and_extract(img2)
>>> matches = match_descriptors(detector_extractor1.descriptors,
...                             detector_extractor2.descriptors)
>>> matches
array([[0, 0],
       [1, 1],
       [2, 2],
       [3, 4],
       [4, 3]])
>>> detector_extractor1.keypoints[matches[:, 0]]
array([[59. , 59. ],
       [40. , 40. ],
       [57. , 40. ],
       [46. , 58. ],
       [58.8, 58.8]])
>>> detector_extractor2.keypoints[matches[:, 1]]
array([[72., 72.],
       [53., 53.],
       [70., 53.],
       [59., 71.],
       [72., 72.]])

c                 ó’   • Xl         X l        X0l        X@l        XPl        X`l        S U l        S U l        S U l        S U l	        S U l
        g )N)Ú	downscaleÚn_scalesÚn_keypointsÚfast_nÚfast_thresholdÚharris_kÚ	keypointsÚscalesÚ	responsesÚorientationsÚdescriptors)Úselfr!   r"   r#   r$   r%   r&   s          Ú¡C:\Users\johnn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\skimage/feature/orb.pyÚ__init__ÚORB.__init__w   sI   € ð #ŒØ ŒØ&ÔØŒØ,ÔØ ŒàˆŒØˆŒØˆŒØ ˆÔØˆÕó    c           	      ón   • [        U5      n[        [        XR                  S-
  U R                  S S95      $ )Nr   )Úchannel_axis)r   Úlistr   r"   r!   )r,   Úimages     r-   Ú_build_pyramidÚORB._build_pyramid�   s5   € Ü+¨EÓ2ˆÜÜØ—}‘} qÑ(¨$¯.©.Àtñó
ð 	
r0   c                 ó´  • UR                   n[        XR                  U R                  5      n[	        USS9n[        U5      S:X  a>  [        R                  " SUS9[        R                  " SUS9[        R                  " SUS94$ [        UR                  USS9nXE   n[        X[        5      n[        US	U R                  S
9nXtS S 2S4   US S 2S4   4   nXFU4$ )Nr   )Úmin_distancer   )r   r   ©Údtype)r   r   ©ÚdistanceÚk)Úmethodr=   )r:   r	   r$   r%   r   ÚlenÚnpÚzerosr   Úshaper
   Ú
OFAST_MASKr   r&   )	r,   Úoctave_imager:   Úfast_responser'   Úmaskr*   Úharris_responser)   s	            r-   Ú_detect_octaveÚORB._detect_octave•   sÒ   € Ø×"Ñ"ˆä# L·+±+¸t×?RÑ?RÓSˆÜ  ¸QÑ?ˆ	äˆy‹>˜QÓä—’˜ uÑ-Ü—’˜ UÑ+Ü—’˜ UÑ+ðð ô & l×&8Ñ&8¸)ÈbÑQˆØ‘Oˆ	ä*¨<ÄJÓOˆä'¨¸SÀDÇMÁMÑRˆØ#ªa°¨d¡O°YºqÀ!¸t±_Ð$DÑEˆ	à¨	Ð1Ð1r0   c           	      óè  • [        US5        U R                  U5      n/ n/ n/ n/ n[        [        U5      5       Hà  n[        R
                  " X'   5      n[        R                  " U5      R                  S:  a    O£U R                  U5      u  pšnUR                  X�R                  U-  -  5        UR                  U
5        UR                  [        R                  " U	R                  S   U R                  U-  UR                  S95        UR                  U5        Mâ     [        R                  " U5      n	[        R                  " U5      n
[        R                  " U5      n[        R                  " U5      nU	R                  S   U R                   :  a  X�l        XÀl        X l        X°l        gUR+                  5       SSS2   SU R                    nX�   U l        XÍ   U l        X­   U l        X½   U l        g)z}Detect oriented FAST keypoints along with the corresponding scale.

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

r   r   r9   Néÿÿÿÿ)r   r5   Úranger?   r@   ÚascontiguousarrayÚsqueezeÚndimrH   Úappendr!   ÚfullrB   r:   ÚvstackÚhstackr#   r'   r(   r*   r)   Úargsort)r,   r4   ÚpyramidÚkeypoints_listÚorientations_listÚscales_listÚresponses_listÚoctaverD   r'   r*   r)   r(   Úbest_indicess                 r-   ÚdetectÚ
ORB.detect¬   s±  € ô 	�˜Ôà×%Ñ% eÓ,ˆàˆØÐØˆØˆäœC ›LÖ)ˆFÜ×/Ò/°±Ó@ˆLä�zŠz˜,Ó'×,Ñ,¨qÓ0áà15×1DÑ1DÀ\Ó1RÑ.ˆI Yà×!Ñ! )¯n©n¸fÑ.DÑ"DÔEØ×$Ñ$ \Ô2Ø×ÑÜ—’Ø—O‘O AÑ&Ø—N‘N FÑ*Ø&×,Ñ,ñôð ×!Ñ! )Ö,ñ% *ô( —I’I˜nÓ-ˆ	Ü—y’yÐ!2Ó3ˆÜ—’˜;Ó'ˆÜ—I’I˜nÓ-ˆ	à�?‰?˜1Ñ × 0Ñ 0Ó0Ø&ŒNØ ŒKØ ,ÔØ&�Nð %×,Ñ,Ó.©t°¨tÑ4Ð5G°t×7GÑ7GÐHˆLØ&Ñ4ˆDŒNØ Ñ.ˆDŒKØ ,Ñ :ˆDÔØ&Ñ4ˆD�Nr0   c                 óÐ   • [        UR                  USS9n[        R                  " X$   [        R                  S[
        S9n[        R                  " X4   SSS9n[        XU5      nXT4$ )Né   r;   ÚC)r:   ÚorderÚcopyF)ra   rb   )r   rB   r@   ÚarrayÚintpr   r   )r,   rD   r'   r*   rF   r+   s         r-   Ú_extract_octaveÚORB._extract_octaveä   s`   € Ü% l×&8Ñ&8¸)ÈbÑQˆÜ—H’HØ‰O¤2§7¡7°#Ô<Mñ
ˆ	ô —x’x Ñ 2¸#ÀEÑJˆä ¸ÓFˆàÐ Ð r0   c                 óÄ  • [        US5        U R                  U5      n/ n/ n[        R                  " U5      [        R                  " U R                  5      -  R                  [        R                  5      n[        [        U5      5       HŠ  n	X‰:H  n
[        R                  " U
5      S:”  d  M#  [        R                  " XY   5      nX*   nXÀR                  U	-  -  nXJ   nU R                  X¼U5      u  pïUR                  U5        UR                  U5        MŒ     [        R                  " U5      R                  [        5      U l        [        R"                  " U5      U l        g)a  Extract rBRIEF binary descriptors for given keypoints in image.

Note that the keypoints must be extracted using the same `downscale`
and `n_scales` parameters. Additionally, if you want to extract both
keypoints and descriptors you should use the faster
`detect_and_extract`.

Parameters
----------
image : 2D array
    Input image.
keypoints : (N, 2) array
    Keypoint coordinates as ``(row, col)``.
scales : (N,) array
    Corresponding scales.
orientations : (N,) array
    Corresponding orientations in radians.

r   r   N)r   r5   r@   Úlogr!   Úastyperd   rL   r?   ÚsumrM   re   rP   rR   ÚviewÚboolr+   rS   Úmask_)r,   r4   r'   r(   r*   rU   Údescriptors_listÚ	mask_listÚoctavesrZ   Úoctave_maskrD   Úoctave_keypointsÚoctave_orientationsr+   rF   s                   r-   ÚextractÚORB.extractï   s!  € ô( 	�˜Ôà×%Ñ% eÓ,ˆàÐØˆ	ô —6’6˜&“>¤B§F¢F¨4¯>©>Ó$:Ñ:×BÑBÄ2Ç7Á7ÓKˆäœC ›LÖ)ˆFà!Ñ+ˆKä�vŠv�kÓ" QÕ&Ü!×3Ò3°G±OÓD�à#,Ñ#9Ð Ø §N¡N°FÑ$:Ñ:Ð Ø&2Ñ&?Ð#à$(×$8Ñ$8Ø Ð4Gó%Ñ!�ð !×'Ñ'¨Ô4Ø× Ñ  Ö&ñ! *ô$ Ÿ9š9Ð%5Ó6×;Ñ;¼DÓAˆÔÜ—Y’Y˜yÓ)ˆ�
r0   c           	      óÀ  • [        US5        U R                  U5      n/ n/ n/ n/ n/ n[        [        U5      5       GHq  n[        R
                  " X(   5      n	[        R                  " U	5      R                  S:  a    GO3U R                  U	5      u  p«n[        U
5      S:X  aL  UR                  U
5        UR                  U5        UR                  [        R                  " S[        S95        M²  U R                  XšU5      u  pÞX®   U R                  U-  -  nUR                  U5        UR                  XÎ   5        UR                  X¾   5        UR                  U R                  U-  [        R                  " UR                  S   [        R                   S9-  5        UR                  U5        GMt     [        U5      S:X  a  [#        S5      e[        R$                  " U5      n
[        R&                  " U5      n[        R&                  " U5      n[        R&                  " U5      n[        R$                  " U5      R)                  [        5      nU
R                  S   U R*                  :  a   X l        UU l        X°l        XÀl        XÐl        gUR7                  5       SSS2   SU R*                   nU
U   U l        UU   U l        UU   U l        UU   U l        UU   U l        g)zÃDetect oriented FAST keypoints and extract rBRIEF descriptors.

Note that this is faster than first calling `detect` and then
`extract`.

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

r   r   )r   é   r9   znORB found no features. Try passing in an image containing greater intensity contrasts between adjacent pixels.NrK   )r   r5   rL   r?   r@   rM   rN   rO   rH   rP   rA   rl   re   r!   ÚonesrB   rd   ÚRuntimeErrorrR   rS   rk   r#   r'   r(   r*   r)   r+   rT   )r,   r4   rU   rV   rY   rX   rW   rn   rZ   rD   r'   r*   r)   r+   rF   Úscaled_keypointsr(   r[   s                     r-   Údetect_and_extractÚORB.detect_and_extract"  s�  € ô 	�˜Ôà×%Ñ% eÓ,ˆàˆØˆØˆØÐØÐäœC ›L×)ˆFÜ×/Ò/°±Ó@ˆLä�zŠz˜,Ó'×,Ñ,¨qÓ0âà15×1DÑ1DÀ\Ó1RÑ.ˆI Yä�9‹~ Ó"Ø×%Ñ% iÔ0Ø×%Ñ% iÔ0Ø ×'Ñ'¬¯ª°ÄÑ(FÔGÙà $× 4Ñ 4Ø¨ó!ÑˆKð  )™°·±ÀÑ1GÑGÐØ×!Ñ!Ð"2Ô3Ø×!Ñ! )¡/Ô2Ø×$Ñ$ \Ñ%7Ô8Ø×ÑØ—‘ Ñ&Ü—'’'Ð*×0Ñ0°Ñ3¼2¿7¹7ÑCñDôð ×#Ñ# K×0ñ7 *ô: ˆ{Ó˜qÓ ÜðGóð ô
 —I’I˜nÓ-ˆ	Ü—I’I˜nÓ-ˆ	Ü—’˜;Ó'ˆÜ—y’yÐ!2Ó3ˆÜ—i’iÐ 0Ó1×6Ñ6´tÓ<ˆà�?‰?˜1Ñ × 0Ñ 0Ó0Ø&ŒNØ ˆDŒKØ ,ÔØ&ŒNØ*Õð %×,Ñ,Ó.©t°¨tÑ4Ð5G°t×7GÑ7GÐHˆLØ& |Ñ4ˆDŒNØ  Ñ.ˆDŒKØ ,¨\Ñ :ˆDÔØ& |Ñ4ˆDŒNØ*¨<Ñ8ˆDÕr0   )r+   r!   r$   r%   r&   r'   rm   r#   r"   r*   r)   r(   N)g333333ó?r   iô  r   g{®Gáz´?g{®Gáz¤?)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r.   r5   rH   r\   re   rt   r{   Ú__static_attributes__© r0   r-   r   r      sC   † ñ[ð~ ØØØØØô ò,
ò2ò.65òp	!ò1*õfL9r0   r   )Únumpyr@   Úfeature.utilr   r   r   r   Úcornerr	   r
   r   r   Ú	transformr   Ú_shared.utilsr   Ú_shared.compatr   Úorb_cyr   rA   rC   Ú
OFAST_UMAXrL   ÚiÚabsÚjr   rƒ   r0   r-   Ú<module>r�      sŸ   ðÛ ÷ó ÷ RÓ QÝ (Ý $Ý .å ð �XŠX�hÓ€
ÚI€
Ù	ˆs�BŽ€AÙ�J™s 1›vÑ&Ð&¨
±3°q³6Ñ(:¸QÑ(>Ö?ˆØ%&ˆ
�2˜‘6˜2 ™6�>Ó"ó @ñ 
ô
U9ˆ/Ð.õ U9r0   