ó
    Å“,jI(  ã                   ó„   • S SK r S SK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  SSKJr           S
S	 jrg)é    N)Úarctan2ÚexpÚpiÚsqrté   )Údraw)Úimg_as_float)Úgaussian)Úcheck_nD)Úgray2rgbc
                 ó  • [        U SS5        [        U 5      n U R                  n
Ub)  Ub&  [        U5      S-
  [        U5      :w  a  [	        S5      eUb  [        U5      nUS   nUb  [        U5      S-
  nUc/  [        U5       Vs/ s H  o²US-   -  [        SU-  5      -  PM     nnUc,  [        U5       Vs/ s H  o²US-   -  [        U5      -  PM     nnUS;  a  [	        S5      e[        R                  " U R                  U
S	9n[        R                  " U R                  U
S	9n[        R                  " U SSS
9USS2SS24'   [        R                  " U SSS
9USS2SS24'   [        US-  US-  -   5      n[        XÜ5      nU[        -  n[        U5       Vs/ s H  nSU-  [        -  U-  [        -
  PM     nn[        R                  " U4U R                  -   U
S	9n[        U5       H`  u  nn[!        U[        R"                  " UU-
  5      -  5      UUSS2SS24'   [        R$                  " UUSS2SS24   U5      UUSS2SS24'   Mb     US   /U-   n[        R                  " US-   4UR                  -   U
S	9n[        US-   5       H7  n[        U5       H%  n['        UUSS2SS24   X{   SS9UUUSS2SS24'   M'     M9     [        U5       Vs/ s H  nS[        -  U-  U-  PM     nnX4-  S-   U-  n[        R                  " UU R                  S   SU-  -
  U R                  S   SU-  -
  4U
S	9nUSSS2X"* 2X"* 24   USU2SS2SS24'   Un[        U5       HÅ  n[        U5       H³  nU[)        [+        X‹   [,        R.                  " UU   5      -  5      5      -   nUR                  S   U-   nU[)        [+        X‹   [,        R"                  " UU   5      -  5      5      -   nUR                  S   U-   nUUS-   SS2UU2UU24   UUUU-   2SS2SS24'   UU-  nMµ     MÇ     USS2SSU2SSU24   nUR1                  SS5      R1                  SS5      nUS:w  aø  US-  nUS:X  a1  U[        R2                  " USS9SS2SS2[        R4                  4   -  nO¼US:X  a=  U[        [        R2                  " US-  SS95      SS2SS2[        R4                  4   -  nOyUS:X  as  [        SUU5       Hb  n[        [        R2                  " USS2SS2X»U-   24   S-  SS95      nUSS2SS2X»U-   24==   USS2SS2[        R4                  4   -  ss'   Md     U	(       Ga  [7        U 5      n[        UR                  S   5       GHð  n[        UR                  S   5       GHÏ  n/ SQn X±-  U-   n!UU-  U-   n"[8        R:                  " U!U"[)        US   5      5      u  n#n$n%[8        R<                  " UU#U$4U U%S9  [        R>                  " UUUSS24   5      n&[        U5       H�  u  n'nUUUU'4   U&-  n(US   U(-  [,        R.                  " U5      -  nUS   U(-  [,        R"                  " U5      -  n[8        R@                  " U!U"[)        U!U-   5      [)        U"U-   5      5      u  n#n$n%[8        R<                  " UU#U$4U U%S9  MŸ     [        U5       GH�  u  n)n*[        SU)-   5      U-  n+SU+-
  SU+4n [        U5       GHm  u  n,n-U![)        [+        U*[,        R.                  " U-5      -  5      5      -   n.U"[)        [+        U*[,        R"                  " U-5      -  5      5      -   n/[8        R:                  " U.U/[)        UU)S-      5      5      u  n#n$n%[8        R<                  " UU#U$4U U%S9  [        U5       H·  u  n'nUUUUU)U-  U-  -   U,U-  -   U'-   4   n(U(U&-  n(UU)S-      U(-  [,        R.                  " U5      -  nUU)S-      U(-  [,        R"                  " U5      -  n[8        R@                  " U.U/[)        U.U-   5      [)        U/U-   5      5      u  n#n$n%[8        R<                  " UU#U$4U U%S9  M¹     GMp     GM      GMÒ     GMó     UU4$ U$ s  snf s  snf s  snf s  snf )a  Extract DAISY feature descriptors densely for the given image.

DAISY is a feature descriptor similar to SIFT formulated in a way that
allows for fast dense extraction. Typically, this is practical for
bag-of-features image representations.

The implementation follows Tola et al. [1]_ but deviate on the following
points:

  * Histogram bin contribution are smoothed with a circular Gaussian
    window over the tonal range (the angular range).
  * The sigma values of the spatial Gaussian smoothing in this code do not
    match the sigma values in the original code by Tola et al. [2]_. In
    their code, spatial smoothing is applied to both the input image and
    the center histogram. However, this smoothing is not documented in [1]_
    and, therefore, it is omitted.

Parameters
----------
image : (M, N) array
    Input image (grayscale).
step : int, optional
    Distance between descriptor sampling points.
radius : int, optional
    Radius (in pixels) of the outermost ring.
rings : int, optional
    Number of rings.
histograms : int, optional
    Number of histograms sampled per ring.
orientations : int, optional
    Number of orientations (bins) per histogram.
normalization : [ 'l1' | 'l2' | 'daisy' | 'off' ], optional
    How to normalize the descriptors

      * 'l1': L1-normalization of each descriptor.
      * 'l2': L2-normalization of each descriptor.
      * 'daisy': L2-normalization of individual histograms.
      * 'off': Disable normalization.

sigmas : 1D array of float, optional
    Standard deviation of spatial Gaussian smoothing for the center
    histogram and for each ring of histograms. The array of sigmas should
    be sorted from the center and out. I.e. the first sigma value defines
    the spatial smoothing of the center histogram and the last sigma value
    defines the spatial smoothing of the outermost ring. Specifying sigmas
    overrides the following parameter.

        ``rings = len(sigmas) - 1``

ring_radii : 1D array of int, optional
    Radius (in pixels) for each ring. Specifying ring_radii overrides the
    following two parameters.

        ``rings = len(ring_radii)``
        ``radius = ring_radii[-1]``

    If both sigmas and ring_radii are given, they must satisfy the
    following predicate since no radius is needed for the center
    histogram.

        ``len(ring_radii) == len(sigmas) + 1``

visualize : bool, optional
    Generate a visualization of the DAISY descriptors

Returns
-------
descs : array
    Grid of DAISY descriptors for the given image as an array
    dimensionality  (P, Q, R) where

        ``P = ceil((M - radius*2) / step)``
        ``Q = ceil((N - radius*2) / step)``
        ``R = (rings * histograms + 1) * orientations``

descs_img : (M, N, 3) array (only if visualize==True)
    Visualization of the DAISY descriptors.

References
----------
.. [1] Tola et al. "Daisy: An efficient dense descriptor applied to wide-
       baseline stereo." Pattern Analysis and Machine Intelligence, IEEE
       Transactions on 32.5 (2010): 815-830.
.. [2] http://cvlab.epfl.ch/software/daisy
r   ÚimgNé   z"`len(sigmas)-1 != len(ring_radii)`éÿÿÿÿ)Úl1Úl2ÚdaisyÚoffzInvalid normalization method.)Údtype)ÚnÚaxisr   Úreflect)ÚsigmaÚmoder   g»½×Ùß|Û=r   )r   r   r   )r   r   r   )Úalpha)!r   r	   r   ÚlenÚ
ValueErrorÚrangeÚfloatÚnpÚzerosÚshapeÚdiffr   r   r   ÚemptyÚ	enumerater   ÚcosÚmultiplyr
   ÚintÚroundÚmathÚsinÚswapaxesÚsumÚnewaxisr   r   Úcircle_perimeter_aaÚ	set_colorÚmaxÚline_aa)0ÚimageÚstepÚradiusÚringsÚ
histogramsÚorientationsÚnormalizationÚsigmasÚ
ring_radiiÚ	visualizeÚfloat_dtypeÚiÚdxÚdyÚgrad_magÚgrad_oriÚorientation_kappaÚoÚorientation_anglesÚhistÚhist_smoothÚjÚthetaÚ	desc_dimsÚdescsÚidxÚy_minÚy_maxÚx_minÚx_maxÚnormsÚ	descs_imgÚcolorÚdesc_yÚdesc_xÚrowsÚcolsÚvalÚmax_binÚo_numÚbin_sizeÚr_numÚrÚcolor_offsetÚt_numÚtÚhist_yÚhist_xs0                                                   Ú¤C:\Users\johnn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\skimage/feature/_daisy.pyr   r      s‰  € ôD ˆU�A�uÔä˜Ó€EØ—+‘+€Kð 	ÑØÑ"Ü�‹K˜!‰Oœs :›Ó.äÐ=Ó>Ð>ØÑÜ�J“ˆØ˜B‘ˆØÑÜ�F“˜a‘ˆØ�~Ü?DÀU¼|ÓLº|¸!˜A ™EÑ"¤U¨1¨u©9Ó%5Ô5¹|ˆÐLØÑÜ?DÀU¼|ÓLº|¸!  A¡Ñ&¬¨u«Ô5¹|ˆ
ÐLØÐ8Ó8ÜÐ8Ó9Ð9ô 
�Š�%—+‘+ [Ñ	1€BÜ	�Š�%—+‘+ [Ñ	1€BÜ—’˜ !¨!Ñ,€B‚qˆ#ˆ2ˆ#€v�JÜ—’˜ !¨!Ñ,€B€sˆ€sŠA€v�Jô �B˜‘E˜B ™E‘MÓ"€HÜ�r‹€HØ$¤rÑ)ÐÜBGÈÔBUÓVÒBU¸Q˜!˜a™%¤"™* |Ñ3´bÔ8ÑBUÐÐVÜ�8Š8�\�O e§k¡kÑ1¸ÑE€DÜÐ,Ö-‰ˆˆ1äÐ-´·²°xÀ!±|Ó0DÑDÓEˆˆQ’’1ˆW‰äŸš D¨ªAªq¨¡M°8Ó<ˆˆQ’’1ˆW‹ñ	 .ð �Q‰iˆ[˜6Ñ!€FÜ—(’(˜E A™I˜<¨$¯*©*Ñ4¸KÑH€KÜ�5˜1‘9ÖˆÜ�|Ö$ˆAÜ&.Ø�Qšš1�W‘ V¡Y°Yñ'ˆK˜˜1ša¢˜
Ó#ó %ñ ô /4°JÔ.?Ó@Ò.?¨ˆQ”‰V�a‰Z˜*Ô$Ñ.?€EÐ@ØÑ# aÑ'¨<Ñ7€IÜ�HŠHØ	�E—K‘K ‘N Q¨¡ZÑ/°·±¸Q±À!ÀfÁ*Ñ1LÐMØñ€Eð "-¨Q²°6¸'°>À6È'À>Ð-QÑ!R€Eˆ-ˆ<ˆ-ššAÐ
ÑØ
€CÜ�5Ž\ˆÜ�zÖ"ˆAØœS¤ z¡}´t·x²xÀÀaÁÓ7IÑ'IÓ!JÓKÑKˆEØ—K‘K ‘N UÑ*ˆEØœS¤ z¡}´t·x²xÀÀaÁÓ7IÑ'IÓ!JÓKÑKˆEØ—K‘K ‘N UÑ*ˆEØ4?Ø�A‘’q˜% ˜+ u¨U {Ð2ñ5ˆE�#˜˜lÑ*Ð*ªAªqÐ0Ñ1ð �<ÑŠCó #ñ ð ’!‘V�t�V™V˜t˜VÐ#Ñ$€EØ�N‰N˜1˜aÓ ×)Ñ)¨!¨QÓ/€Eð ˜ÓØ�‰ˆØ˜DÓ Ø”R—V’V˜E¨Ñ*ª1ªa´·±Ð+;Ñ<Ñ<‰EØ˜dÓ"Ø”Tœ"Ÿ&š& ¨¡°Ñ2Ó3²A²q¼"¿*¹*Ð4DÑEÑE‰EØ˜gÓ%Ü˜1˜i¨Ö6�ÜœRŸVšV Eª!ªQ°¸Ñ4DÐ0DÐ*DÑ$EÈÑ$JÐQRÑSÓT�Ø’aš˜A LÑ 0Ð0Ð0Ó1°Uº1ºaÄÇÁÐ;KÑ5LÑLÕ1ñ 7÷ Ü˜U“Oˆ	Ü�u—{‘{ 1‘~×&ˆAÜ˜5Ÿ;™; q™>×*�â!�Ø™ FÑ*�Ø˜T™ FÑ*�Ü"&×":Ò":Ø˜F¤C¨¨q©	£Nó#‘��d˜Cô —’˜y¨4°¨,¸ÀSÒIÜŸ&š&  q¨!ªQ w¡Ó0�Ü )Ð*<Ö =‘H�E˜1à$ Q¨¨5 [Ñ1°GÑ;�HØ ™ XÑ-´·²¸³Ñ;�BØ ™ XÑ-´·²¸³Ñ;�BÜ&*§l¢lØ ¬¨F°R©KÓ(8¼#¸fÀr¹kÓ:Jó'‘O�D˜$ ô —N’N 9¨t°T¨l¸EÈÔMñ !>ô !*¨*× 5‘H�E˜1Ü#(¨¨U©Ó#3°eÑ#;�LØ Ñ-¨q°,Ð?�EÜ$-¨e×$4™˜˜qà!'¬#¬e°A¼¿ºÀ»±OÓ.DÓ*EÑ!E˜Ø!'¬#¬e°A¼¿ºÀ»±OÓ.DÓ*EÑ!E˜Ü*.×*BÒ*BØ" F¬C°°u¸q±yÑ0AÓ,Bó+™˜˜d Cô Ÿš y°4¸°,ÀÈSÒQÜ(1Ð2DÖ(E™H˜E 1à',Ø !Ø !Ø ,Ø"'¨*Ñ"4°|Ñ"Cñ!Dà"'¨,Ñ"6ñ!7ð #(ñ!(ð!)ñ(˜Hð %¨Ñ/˜HØ!'¨°©	Ñ!2°XÑ!=ÄÇÂÈÃÑ!K˜BØ!'¨°©	Ñ!2°XÑ!=ÄÇÂÈÃÑ!K˜BÜ.2¯lªlØ &¨´°F¸R±KÓ0@Ä#ÀfÈrÁkÓBRó/™O˜D $¨ô !ŸNšN¨9°t¸T°lÀEÐQTÔUô! )Fô %5ô !6ô' +ñ 'ð` �iÐÐàˆùòq MùâLùò Wùò$ As   Â a;Â7b Æ bËb
)	é   é   é   é   rg   r   NNF)r*   Únumpyr    r   r   r   r   Ú r   Ú
util.dtyper	   Ú_shared.filtersr
   Ú_shared.utilsr   rS   r   r   © ó    rc   Ú<module>ro      sC   ðÛ ã ß (Ó (å Ý %Ý &Ý $Ý ð
 
ØØ
ØØØØØØõlrn   