+
    åûj¾a  ã                   ó  € R t ^ RIt^ RIt^ RIHtHt ^ RIHt ^ RIHt ^ RI	H
t
 ^ RIHtHtHtHt R!R R lltR!R	 R
 lltR"tR R ltR R ltR R ltR R ltR R ltR#R R lltR!R R lltR!R R lltR$R R lltR R ltR R  ltR# )%zWDistances of correspondences to a fundamental matrix: Sampson, symmetric and one-sided.N)ÚTensorÚ	ones_like)ÚKORNIA_CHECK_IS_TENSOR)Úconvert_points_to_homogeneous)Ú_epipolar_design_rows)Ú
_inf_whereÚ_nonzeroÚ_sqrt_or_zeroÚpoint_line_distancec          
      óT   € V ^8„  d   QhR\         R\         R\         R\        R\         /# ©é   Úpts1Úpts2ÚFmÚsquaredÚreturn©r   Úbool)Úformats   "Ú]C:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\kornia\geometry\epipolar\_metrics.pyÚ__annotate__r      s1   € ÷ 92ñ 92´&ð 92Äð 92ÌFð 92Ô]að 92Ômsñ 92ó    c                óP  € \        V\        4      '       g   \        R\        V4       24      hVP                  RR R8w  d   \        RVP                   24      hV R,          pV R,          pVR,          pVR,          pV P                  R,          ^8X  d
   V R	,          M
\        V4      pVP                  R,          ^8X  d
   VR	,          M
\        V4      p	VR
,          R,          p
VR,          R,          pVR,          R,          pVR,          R,          pVR,          R,          pVR,          R,          pVR,          R,          pVR,          R,          pVR,          R,          pW¤,          Wµ,          ,           WÈ,          ,           pWÔ,          Wå,          ,           Wø,          ,           pVV,          VV,          ,           VV,          ,           pW¦,          W×,          ,           VV	,          ,           pW¶,          Wç,          ,           VV	,          ,           pVV,          VV,          ,           V	V,          ,           ^,          pVV,          VV,          ,           VV,          ,           VV,          ,           p\        V\        V4      ,          V^ 8H  4      pV'       d   V# \        V4      # )áz  Return Sampson distance for correspondences given the fundamental matrix.

Args:
    pts1: correspondences from the left images with shape ``(*, N, 2)`` or ``(*, N, 3)``. If they are not
          homogeneous, converted automatically.
    pts2: correspondences from the right images with shape ``(*, N, 2)`` or ``(*, N, 3)``. If they are not
          homogeneous, converted automatically.
    Fm: Fundamental matrices with shape ``(*, 3, 3)``. Called Fm to avoid ambiguity with torch.nn.functional.
    squared: if True (default), the squared distance is returned.

Returns:
    the computed Sampson distance with shape ``(*, N)``.

ú#Fm type is not a torch.Tensor. Got Nú#Fm must be a (*, 3, 3) tensor. Got éþÿÿÿ©é   r   ©.ºNNNé    ©.r!   é   éÿÿÿÿ©.r!   r   ©.r"   r"   ©.N©.r"   r$   ©.r"   r   ©.r$   r"   ©.r$   r$   ©.r$   r   ©.r   r"   ©.r   r$   ©.r   r   )
Ú
isinstancer   Ú	TypeErrorÚtypeÚshapeÚ
ValueErrorr   r   r   r	   )r   r   r   r   ÚxÚyÚuÚvÚw1Úw2Úf00Úf01Úf02Úf10Úf11Úf12Úf20Úf21Úf22ÚFx0ÚFx1ÚFx2ÚFt0ÚFt1ÚnumÚdenÚouts   &&&&                       r   Ú'_sampson_epipolar_distance_manual_impl_rM      s  € ô �bœ&×!Ò!ÜÐ=¼dÀ2»h¸ZÐHÓIÐIà	‡x�x��€}˜ÔÜÐ>¸r¿x¹x¸jÐIÓJÐJð 	ˆY�€AØˆY�€AØˆY�€AØˆY�€Aà ŸJ™J r�N¨aÔ/ˆˆiŽ´Y¸q³\€BØ ŸJ™J r�N¨aÔ/ˆˆiŽ´Y¸q³\€Bð ˆY�-˜	Õ
"€CØ
ˆY�-˜	Õ
"€CØ
ˆY�-˜	Õ
"€CØ
ˆY�-˜	Õ
"€CØ
ˆY�-˜	Õ
"€CØ
ˆY�-˜	Õ
"€CØ
ˆY�-˜	Õ
"€CØ
ˆY�-˜	Õ
"€CØ
ˆY�-˜	Õ
"€Cð �'�C•GÕ
˜c�hÕ
&€CØ
�'�C•GÕ
˜c�hÕ
&€CØ
��'�C˜!•GÕ
˜c B�hÕ
&€Cð �'�C•GÕ
˜c B�hÕ
&€CØ
�'�C•GÕ
˜c B�hÕ
&€Cð ˆs�7�Q˜•WÕ˜r C�xÕ'¨AÕ
-€Cà
��)�c˜C•iÕ
 #¨¥)Õ
+¨c°C­iÕ
7€Cä˜S¤8¨C£=Õ0°#¸±(Ó;€Cßˆ3Ð1œ}¨SÓ1Ð1r   c          
      óT   € V ^8„  d   QhR\         R\         R\         R\        R\         /# r   r   )r   s   "r   r   r   [   s1   € ÷ &2ñ &2´&ð &2Äð &2ÌFð &2Ô]að &2Ômsñ &2r   c                ó8  € V P                   R,          ^8X  d   \        V 4      p VP                   R,          ^8X  d   \        V4      pVP                  RRR7      pW,          pW,          pW,          P                  RR7      P	                  ^4      pVR,          P                  ^RR7      P	                  ^4      VR,          P                  ^RR7      P	                  ^4      ,           p\        V\        V4      ,          V^ 8H  4      p	V'       d   V	# \        V	4      # )r   ©Údim0Údim1©Údimr%   r   ©.ºNr   N)	r4   r   Ú	transposeÚsumÚpowÚnormr   r   r	   )
r   r   r   r   ÚF_tÚ
line1_in_2Ú
line2_in_1Ú	numeratorÚdenominatorrL   s
   &&&&      r   Ú'_sampson_epipolar_distance_matmul_impl_r`   [   sú   € ð ‡z�z�"…~˜ÔÜ,¨TÓ2ˆà‡z�z�"…~˜ÔÜ,¨TÓ2ˆð —,‘, B¨R�,Ó0€CØ�€JØ�€Jð Õ*×/Ñ/°BÐ/Ó7×;Ñ;¸AÓ>€Ið % WÕ-×2Ñ2°1¸"Ð2Ó=×AÑAÀ!ÓDÀzÐRYÕGZ×G_ÑG_Ð`aÐgiÐG_ÓGj×GnÑGnÐopÓGqÕq€KÜ˜Y¬°+Ó)>Õ>ÀÈqÑ@PÓQ€Cßˆ3Ð1œ}¨SÓ1Ð1r   c                ó<   € V ^8„  d   QhR\         R\         R\        /# )r   r   r   r   r   )r   s   "r   r   r   Š   s&   € ÷ tñ tœð t¤vð t´$ñ tr   c                ó  € \         P                  ! V P                  RR 4      ^8H  ;'       dV    \         P                  ! VP                  RR 4      ^8H  ;'       d(    V P                  R,          VP                  R,          8H  # )ziWhether ``pts1`` and ``pts2`` are one set of correspondences: leading dimensions of size 1, equal counts.Nr   )ÚmathÚprodr4   )r   r   s   &&r   Ú_shares_pointsre   Š   sg   € ä�9Š9�T—Z‘Z  �_Ó%¨Ñ*×sÐs¬t¯yªy¸¿¹ÀCÀR¸Ó/IÈQÑ/N×sÐsÐSW×S]ÑS]Ð^`ÕSaÐei×eoÑeoÐprÕesÑSsÐsr   c                óH   € V ^8„  d   QhR\         R\         R\         R\         /# )r   ÚFÚx1Úx2r   ©r   )r   s   "r   r   r   �   s.   € ÷ Sñ S”vð S¤6ð S¬vð S¼&ñ Sr   c                ó(  € V P                   ^ ,          VP                   ^ ,          rCV P                  ^V,          ^4      VP                  ,          P                  V^V4      pV P                  R,          P                  ^V,          ^4      VP                  ,          P                  V^V4      pVR,          VR,          ,          VR,          VR,          ,          ,           VR,          VR,          ,          ,           pVR,          P                  4       VR,          P                  4       ,           VR,          P                  4       ,           VR,          P                  4       ,           p\        VP                  4       \        V4      ,          V^ 8H  4      # )ap  Squared Sampson distances ``(M, N)`` of fundamental matrices ``(M, 3, 3)`` on homogeneous points ``(N, 3)``.

The line ``F x1`` and the first two components of ``F^T x2`` of every model come from ``(3M, 3) @ (3, N)`` and
``(2M, 3) @ (3, N)`` products; the residual ``x2 . (F x1)`` and the squared gradient norm are then formed in the
order of the manual implementation, with its guard of the singular denominator. Expanding either into monomials
of the coordinates, as :func:`_sampson_quadratic_basis` does, cancels near the epipoles: on pixel-scale float32
points 0.01-1000 px from both epipoles an expanded denominator returned negative and infinite distances, and for
``F = [[1, 0, -1000], [0, 1, -1000], [-1000, -1000, 2e6]]``, ``x1 = (1000.1, 1000.2)``, ``x2 = (1000.3, 1000.4)``
an expanded residual gives 0.0521 where this gives the manual path's 0.0319 (float64: 0.0403).
)r!   rV   )r!   r"   )r!   r$   )r!   r   )r4   ÚreshapeÚTÚviewÚmTÚsquarer   r   )	rg   rh   ri   ÚmÚnÚlinesÚlines_tÚresidualr_   s	   &&&      r   Ú_sampson_errorsrv   �   s#  € ð �7‰7�1�:�r—x‘x •{€qØ�Y‰Y�q˜1•u˜aÓ  2§4¡4Õ'×-Ñ-¨a°°AÓ6€EØ�t‰t�E�{×"Ñ" 1 q¥5¨!Ó,¨r¯t©tÕ3×9Ñ9¸!¸QÀÓB€GØ�$�x˜% �+Õ%¨¨4­°5¸µ;Õ(>Õ>ÀÀDÅÈEÐRVÍKÕAWÕW€HØ˜•+×$Ñ$Ó&¨¨t­×);Ñ);Ó)=Õ=ÀÈÅ×@TÑ@TÓ@VÕVÐY`ÐaeÕYf×YmÑYmÓYoÕo€KÜ�h—o‘oÓ'¬(°;Ó*?Õ?ÀÐPQÑAQÓRÐRr   c          
      óT   € V ^8„  d   QhR\         R\         R\         R\        R\         /# r   r   )r   s   "r   r   r   ¢   s1   € ÷ 5ñ 5´&ð 5Äð 5ÌFð 5Ô]að 5Ôflñ 5r   c                óš  € V P                   R,          p\        P                  ! \        P                  ! V P                  VP                  4      VP                  4      p\        P                  ! V\        P                  4      pV P                  W@P                   R,          4      P                  V4      pVP                  WAP                   R,          4      P                  V4      pVP                   R,          ^8X  d   \        V4      pVP                   R,          ^8X  d   \        V4      p\        VP                  R^^4      P                  V4      Wx4      p	V'       g   \        V	4      p	\        P                  ! V P                   RR VP                   RR VP                   RR 4      p
V	P
                  ! . V
OVN5!  P                  V4      # )a  Sampson distances of many fundamental matrices on one set of correspondences, by :func:`_sampson_errors`.

``pts1`` and ``pts2`` have leading dimensions of size 1; the result has the broadcast shape ``(*, N)``. Half
precision is computed in float32 and returned in the input dtype.
Nr   r%   )r4   ÚtorchÚpromote_typesÚdtypeÚfloat32rl   Útor   rv   r	   Úbroadcast_shapes)r   r   r   r   Ú
num_pointsr{   Úworkrh   ri   rL   r4   s   &&&&       r   Ú'_sampson_epipolar_distance_shared_impl_r�   ¢   sM  € ð —‘˜B•€JÜ×Ò¤× 3Ò 3°D·J±JÀÇ
Á
Ó KÈRÏXÉXÓV€EÜ×Ò˜u¤e§m¡mÓ4€DØ	�‰�j§*¡*¨R¥.Ó	1×	4Ñ	4°TÓ	:€BØ	�‰�j§*¡*¨R¥.Ó	1×	4Ñ	4°TÓ	:€BØ	‡x�x�…|�qÔÜ*¨2Ó.ˆØ	‡x�x�…|�qÔÜ*¨2Ó.ˆÜ
˜"Ÿ*™* R¨¨AÓ.×1Ñ1°$Ó7¸Ó
@€CßÜ˜CÓ ˆÜ×"Ò" 4§:¡:¨c¨r ?°D·J±J¸sÀ°OÀRÇXÁXÈcÈrÀ]ÓS€EØ�;Š;Ð*˜Ð*˜zÓ*×-Ñ-¨eÓ4Ð4r   c                ó<   € V ^8„  d   QhR\         R\         R\         /# )r   rh   ri   r   rj   )r   s   "r   r   r   ¸   s!   € ÷ ñ ¤ð ¬Vð ¼ñ r   c                ó  € V P                   ^ ,          pV P                  ^^V,          4      p\        W4      P                  VRRV13&   \        W 4      P                  VRVR13&   \        W4      P                  VRVR13&   V# )a–  Per-correspondence monomials ``(27, 2N)`` of the Sampson distance, for RANSAC's sampling loop only.

``[vec F, vec Q1, vec Q2] @ basis`` gives the epipolar residuals and the squared gradient norms of every model in
one product, with ``Q1 = F[:2]^T F[:2]`` and ``Q2 = F[:, :2] F[:, :2]^T``: ``x2^T F x1`` is linear in
``vec(x2 x1^T)``, and ``|F[:2] x1|^2 + |F[:, :2]^T x2|^2 = x1^T Q1 x1 + x2^T Q2 x2`` in ``vec(x1 x1^T)`` and
``vec(x2 x2^T)``. It writes 2N values per model where :func:`_sampson_errors` writes 5N, which is RANSAC's reason
to keep it (ALIKED matches, N ~ 700: 5.6 against 7.0 ms per pair on CPU, 10.0 against 11.4 ms on CUDA). The
expansion cancels near the epipoles, which is harmless only on Hartley-normalized homogeneous points ``(N, 3)``
and unit-norm models: on 58.3M float32 inlier decisions at 0.5-4 px from 90 PhotoTourism pairs it disagreed with
float64 24 times and the line form 30 times.
:Né	   NN:r„   é   N:r…   NN)r4   Ú	new_zerosr   rm   )rh   ri   rr   Úbasiss   &&  r   Ú_sampson_quadratic_basisrˆ   ¸   sz   € ð 	�‰��€AØ�L‰L˜˜Q �UÓ#€EÜ)¨"Ó1×3Ñ3€Eˆ"ˆbˆqˆbˆ&�MÜ+¨BÓ3×5Ñ5€Eˆ$�‘ˆ(�OÜ*¨2Ó2×4Ñ4€Eˆ#ˆq‰rˆ'�NØ€Lr   c                ó<   € V ^8„  d   QhR\         R\         R\         /# )r   rg   r‡   r   rj   )r   s   "r   r   r   Ì   s!   € ÷ ;ñ ;¤Vð ;´Fð ;¼vñ ;r   c                óÎ  € VP                   ^,          ^,          pV R,          P                  V R,          ,          pV R,          V R,          P                  ,          p\        P                  ! V P	                  ^4      VP	                  ^4      VP	                  ^4      .^4      V,          pVRRV13,          P                  4       VRVR13,          ,          P                  ^ 4      # )aF  Squared Sampson distances ``(M, N)`` of fundamental matrices ``(M, 3, 3)`` from :func:`_sampson_quadratic_basis`.

A cancelled denominator can come out negative. ``clamp_min(0)`` lifts such a distance to 0, which keeps the inlier
decisions of the unguarded ratio (a negative value is below every threshold) without the MSAC contribution above
1, and passes NaN through, so a non-finite correspondence stays an outlier. A floor on the denominator instead
turned 1849 of 2.56M near-epipole decisions into false inliers. A value guard for a no-grad loop, not a gradient
guard (#4229).
r!   N)r!   rV   r!   )r!   r!   rV   )r4   ro   ry   ÚcatÚflattenrp   Ú	clamp_min)rg   r‡   rr   Úq1Úq2rL   s   &&    r   Ú_sampson_from_quadratic_basisr�   Ì   s«   € ð 	�‰�A�˜!Õ€AØ	
ˆ8��‰˜!˜H�+Õ	%€BØ	
ˆ8��q˜•{—~‘~Õ	%€BÜ
�)Š)�Q—Y‘Y˜q“\ 2§:¡:¨a£=°"·*±*¸Q³-Ð@À!Ó
DÀuÕ
L€CØ��2�A�2��J×ÑÓ # a¨© e¥*Õ,×7Ñ7¸Ó:Ð:r   c                ól   € V ^8„  d   QhR\         R\         R\         R\        R\        R\        R\         /# )r   r   r   r   r   ÚepsÚuse_matmul_at_less_than_pointsr   )r   r   ÚfloatÚint)r   s   "r   r   r   Ü   s`   € ÷ FLñ FLÜ
ðFLä
ðFLô 	ðFLô ð	FLô
 
ðFLô %(ðFLô ñFLr   c                óð  € VP                   RR R8w  d   \        RVP                    24      hV P                   R,          pVP                  P                  R8H  ;'       d    We8  p\        P
                  ! VP                   RR 4      pV^8¼  dJ   \        W4      '       d9   VP                  P                  R8X  g   W†,          \        8¼  d   \        WW#4      # V'       d   \        WW#4      # \        WW#4      # )aZ  Compute the Sampson distance of correspondences to a fundamental matrix, to first order.

``d = sampson_epipolar_distance(pts1, pts2, Fm)`` takes matched points of the first and the second image,
``(*, N, 2)``, and fundamental matrices ``(*, 3, 3)`` with :math:`x_2^\top F x_1 = 0`, as
:func:`find_fundamental` returns them, and returns the squared Sampson distance of each correspondence,
``(*, N)`` with the leading dimensions of the points and ``Fm`` broadcast. It approximates to first order the
smallest squared distance by which the two points together must move to satisfy the epipolar constraint, in the
squared units of the points; ``squared=False`` returns its square root. It is the residual that
:class:`~kornia.geometry.ransac.RANSAC` scores fundamental and essential matrices with. For the distances of the
points to the epipolar lines themselves, use :func:`symmetrical_epipolar_distance` or the one-sided
:func:`left_to_right_epipolar_distance` and :func:`right_to_left_epipolar_distance`.

Convention:
    - ``pts1`` are first-image points and ``pts2`` second-image points
      (see :ref:`two-view geometry <two-view-conventions>`). A 3-vector point is used as given, so it must have
      :math:`w = 1`.
    - One set of correspondences scored against several matrices (points with leading dimensions of size 1)
      is computed from two matrix products for all of them, in at least float32: on the CPU always, and on
      other devices from ``2**16`` matrix-point pairs. The result matches the per-matrix computation to
      roundoff.
    - The value does not depend on the scale of ``Fm``, and ``squared=False`` returns exactly 0, with a zero
      gradient, for an exact match. A correspondence whose two epilines both have :math:`a = b = 0`, as under a
      degenerate ``Fm``, is at distance ``inf``.

Args:
    pts1: points in the first image with shape ``(*, N, 2)`` or ``(*, N, 3)``.
    pts2: points in the second image with shape ``(*, N, 2)`` or ``(*, N, 3)``.
    Fm: Fundamental matrices with shape ``(*, 3, 3)``. Called Fm to avoid ambiguity with torch.nn.functional.
    squared: if True (default), the squared distance is returned, else its square root.
    eps: unused; it was added to the denominator and inside the square root, which made the value depend on the
        scale of ``Fm`` and an exact match score :math:`\sqrt{\epsilon}` (#4881). The singular case is guarded
        exactly instead. Accepted so that existing calls keep working.
    use_matmul_at_less_than_points: If ``Fm`` is on CUDA and the number of points is less than this value,
        use the matmul implementation.

Returns:
    the computed Sampson distance with shape ``(*, N)``.

See Also:
    - :func:`symmetrical_epipolar_distance`: the summed squared distances of both points to their epipolar
      lines, not a first-order geometric error.
    - :func:`left_to_right_epipolar_distance`: the unsquared distance in image 2 only.
    - :func:`right_to_left_epipolar_distance`: the unsquared distance in image 1 only.
    - :func:`~kornia.geometry.homography.sampson_homography_distance`: the same first-order error for a
      homography.

Nr   ÚcudaÚcpur   r   )r4   r5   Údevicer3   rc   rd   re   Ú%_SAMPSON_SHARED_MIN_PAIRS_ACCELERATORr�   r`   rM   )	r   r   r   r   r’   r“   r   ÚmatmulÚ
num_modelss	   &&&&&&   r   Úsampson_epipolar_distancer�   Ü   sÇ   € ðr 
‡x�x��€}˜ÔÜÐ>¸r¿x¹x¸jÐIÓJÐJØ—‘˜B•€JØ�Y‰Y�^‰^˜vÑ%×UÐU¨*Ñ*U€FÜ—’˜2Ÿ8™8 C R˜=Ó)€Jà�aŒÜ˜4×&Ò&Ø�Y‰Y�^‰^˜uÔ$¨
Õ(?ÔChÔ(hä6°tÀ2ÓOÐOßÜ6°tÀ2ÓOÐOÜ2°4¸rÓKÐKr   c          
      óT   € V ^8„  d   QhR\         R\         R\         R\        R\         /# r   r   )r   s   "r   r   r   %  s2   € ÷ .2ñ .2´fð .2ÄFð .2ÔPVð .2Ôaeð .2Ôqwñ .2r   c                óê  € \        V\        4      '       g   \        R\        V4       24      hVP                  RR R8w  d   \        RVP                   24      hV R,          pV R,          pVR,          pVR,          pV P                  R	,          ^8X  d
   V R
,          M
\        V4      pVP                  R	,          ^8X  d
   VR
,          M
\        V4      p	VR,          R,          p
VR,          R,          pVR,          R,          pVR,          R,          pVR,          R,          pVR,          R,          pVR,          R,          pVR,          R,          pVR,          R,          pW¤,          Wµ,          ,           WÈ,          ,           pWÔ,          Wå,          ,           Wø,          ,           pVV,          VV,          ,           VV,          ,           pW¦,          W×,          ,           VV	,          ,           pW¶,          Wç,          ,           VV	,          ,           pVV,          VV,          ,           V	V,          ,           P                  ^4      pVP                  ^4      VP                  ^4      ,           pVP                  ^4      VP                  ^4      ,           pR\        V4      ,          R\        V4      ,          ,           p\        VV,          V^ 8H  V^ 8H  ,          4      pV'       d   V# \        V4      # )zdReturn symmetric epipolar distance for correspondences given the fundamental matrix (CPU-optimized).r   Nr   ç      ð?r   r   r    r#   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   )r1   r   r2   r3   r4   r5   r   rY   r   r   r	   )r   r   r   r   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   Únorm1Únorm2Úden_invrL   s   &&&&                         r   Ú+_symmetrical_epipolar_distance_manual_impl_r¤   %  sS  € ä�bœ&×!Ò!ÜÐ=¼dÀ2»h¸ZÐHÓIÐIà	‡x�x��€}˜ÔÜÐ>¸r¿x¹x¸jÐIÓJÐJð 	ˆY�€AØˆY�€AØˆY�€AØˆY�€Að !ŸJ™J r�N¨aÔ/ˆˆiŽ´Y¸q³\€BØ ŸJ™J r�N¨aÔ/ˆˆiŽ´Y¸q³\€Bð ˆY�-˜	Õ
"€CØ
ˆY�-˜	Õ
"€CØ
ˆY�-˜	Õ
"€CØ
ˆY�-˜	Õ
"€CØ
ˆY�-˜	Õ
"€CØ
ˆY�-˜	Õ
"€CØ
ˆY�-˜	Õ
"€CØ
ˆY�-˜	Õ
"€CØ
ˆY�-˜	Õ
"€Cð �'�C•GÕ
˜c�hÕ
&€CØ
�'�C•GÕ
˜c�hÕ
&€CØ
��'�C˜!•GÕ
˜c B�hÕ
&€Cð �'�C•GÕ
˜c B�hÕ
&€CØ
�'�C•GÕ
˜c B�hÕ
&€Cð ˆs�7�Q˜•WÕ˜r C�xÕ'×
,Ñ
,¨QÓ
/€Cð �G‰G�A‹J˜Ÿ™ ›Õ#€EØ�G‰G�A‹J˜Ÿ™ ›Õ#€EØ”H˜U“OÕ# c¬H°U«OÕ&;Õ;€GÜ˜S 7�]¨U°a©Z¸EÀQ¹JÕ,GÓH€Cßˆ3Ð1œ}¨SÓ1Ð1r   c          
      óT   € V ^8„  d   QhR\         R\         R\         R\        R\         /# r   r   )r   s   "r   r   r   V  s2   € ÷ 2ñ 2´fð 2ÄFð 2ÔPVð 2Ôaeð 2Ôqwñ 2r   c                 ó€  € V P                   R,          ^8X  d   \        V 4      p VP                   R,          ^8X  d   \        V4      pVP                  RRR7      pW,          pW,          pW,          P                  RR7      P	                  ^4      pVR,          P                  ^RR7      P	                  ^4      pVR,          P                  ^RR7      P	                  ^4      p	R\        V4      ,          R\        V	4      ,          ,           p
\        Wz,          V^ 8H  V	^ 8H  ,          4      pV'       d   V# \        V4      # )r$   rP   rS   r    r%   r   rU   )	r4   r   rW   rX   rY   rZ   r   r   r	   )r   r   r   r   r[   r\   r]   r^   r¡   r¢   Údenominator_invrL   s   &&&&        r   Ú+_symmetrical_epipolar_distance_matmul_impl_r¨   V  s  € Ø‡z�z�"…~˜ÔÜ,¨TÓ2ˆØ‡z�z�"…~˜ÔÜ,¨TÓ2ˆà—,‘, B¨R�,Ó0€CØ�€JØ�€JàÕ*×/Ñ/°BÐ/Ó7×;Ñ;¸AÓ>€Ià˜wÕ'×,Ñ,¨Q°BÐ,Ó7×;Ñ;¸AÓ>€EØ˜wÕ'×,Ñ,¨Q°BÐ,Ó7×;Ñ;¸AÓ>€EØ!¤H¨U£OÕ3°c¼HÀU»OÕ6KÕK€OÜ˜YÕ8¸5ÀA¹:È%ÐSTÉ*Õ:UÓV€Cßˆ3Ð1œ}¨SÓ1Ð1r   c                ó`   € V ^8„  d   QhR\         R\         R\         R\        R\        R\         /# )r   r   r   r   r   r’   r   )r   r   r”   )r   s   "r   r   r   i  sD   € ÷ *Pñ *PÜ
ð*PÜð*PÜ$*ð*PÜ59ð*PÜGLð*Päñ*Pr   c                óô   € VP                   RR R8w  d   \        RVP                    24      hVP                  P                  R8X  d'   V P                   R,          pVR8  d   \	        WW#4      # \        WW#4      # )a“  Compute the sum of the squared distances of both points of a correspondence to their epipolar lines.

``d = symmetrical_epipolar_distance(pts1, pts2, Fm)`` takes the arguments of :func:`sampson_epipolar_distance`
and returns, per correspondence, ``(*, N)``, the squared distance of ``pts2`` to the epipolar line
:math:`F x_1` in image 2 plus the squared distance of ``pts1`` to the line :math:`F^\top x_2` in image 1: the
squares of :func:`left_to_right_epipolar_distance` and :func:`right_to_left_epipolar_distance` added.
``squared=False`` returns the square root of that sum. For the first-order geometric error of moving both points,
use :func:`sampson_epipolar_distance`.

Convention:
    - Argument order and units as :func:`sampson_epipolar_distance`.
    - The value does not depend on the scale of ``Fm``, and ``squared=False`` returns exactly 0 for an exact
      match, as in :func:`sampson_epipolar_distance`. A correspondence with an epiline of :math:`a = b = 0` in
      either image is at distance ``inf``.

Args:
   pts1: points in the first image with shape ``(*, N, 2)`` or ``(*, N, 3)``.
   pts2: points in the second image with shape ``(*, N, 2)`` or ``(*, N, 3)``.
   Fm: Fundamental matrices with shape ``(*, 3, 3)``. Called Fm to avoid ambiguity with torch.nn.functional.
   squared: if True (default), the squared distance is returned, else its square root.
   eps: unused, as in :func:`sampson_epipolar_distance` (#4881).

Returns:
    the computed Symmetrical distance with shape ``(*, N)``.

See Also:
    - :func:`sampson_epipolar_distance`: the first-order geometric error, which RANSAC scores with.
    - :func:`left_to_right_epipolar_distance`: one of the two terms, unsquared: the distance in image 2.
    - :func:`right_to_left_epipolar_distance`: the other term, unsquared: the distance in image 1.
    - :func:`~kornia.geometry.homography.symmetric_transfer_error`: the two-image error of a homography.

Nr   r—   é'  r   r   )r4   r5   r™   r3   r¨   r¤   )r   r   r   r   r’   r   s   &&&&& r   Úsymmetrical_epipolar_distancer¬   i  sm   € ðH 
‡x�x��€}˜ÔÜÐ>¸r¿x¹x¸jÐIÓJÐJØ	‡y�y‡~�~˜ÔØ—Z‘Z •^ˆ
Ø˜ÔÜ>¸tÈ2ÓWÐWÜ6°tÀ2ÓOÐOr   c                óH   € V ^8„  d   QhR\         R\         R\         R\         /# ©r   r   r   r   r   rj   )r   s   "r   r   r   –  s(   € ÷ .1ñ .1¬&ð .1¼ð .1ÄFð .1Ìvñ .1r   c                ó.  € \        V 4       \        V4       \        V4       VP                  RR R8w  d   \        RVP                   24      hV P                  R,          ^8X  d   \        V 4      p VP	                  RRR7      pW,          p\        W4      # )a³  Compute the distance in image 2 from each second-image point to the epipolar line of its match.

``d = left_to_right_epipolar_distance(pts1, pts2, Fm)`` takes the arguments of
:func:`sampson_epipolar_distance` and returns, per correspondence, ``(*, N)``, the unsquared distance in the
second image from ``pts2`` to the epipolar line :math:`F x_1` of its match in ``pts1``, in the units of the
points. It does not measure anything in image 1: for the distance there, use
:func:`right_to_left_epipolar_distance`, and for both images :func:`symmetrical_epipolar_distance` or
:func:`sampson_epipolar_distance`.

Convention:
    - Argument order as :func:`sampson_epipolar_distance`.
    - The value does not depend on the scale of ``Fm``; a point whose epiline has :math:`a = b = 0` is at
      distance ``inf``, as in :func:`~kornia.geometry.linalg.point_line_distance`.

Args:
   pts1: points in the first image with shape ``(*, N, 2)`` or ``(*, N, 3)``.
   pts2: points in the second image with shape ``(*, N, 2)`` or ``(*, N, 3)``.
   Fm: Fundamental matrices with shape ``(*, 3, 3)``. Called Fm to
     avoid ambiguity with torch.nn.functional.

Returns:
    the one-sided distance with shape ``(*, N)``.

See Also:
    - :func:`right_to_left_epipolar_distance`: the distance in image 1 instead.
    - :func:`symmetrical_epipolar_distance`: both one-sided distances, squared and added.
    - :func:`sampson_epipolar_distance`: the first-order geometric error over both images.
    - :func:`~kornia.geometry.homography.oneway_transfer_error`: the image-2 error of a homography.
    - :func:`~kornia.geometry.linalg.point_line_distance`: the distance from points to given lines, without a
      fundamental matrix.

Nr   rP   r   r   r%   )r   r4   r5   r   rW   r
   )r   r   r   r[   r\   s   &&&  r   Úleft_to_right_epipolar_distancer°   –  s„   € ôB ˜4Ô Ü˜4Ô Ü˜2Ôà	‡x�x��€}˜ÔÜÐ>¸r¿x¹x¸jÐIÓJÐJà‡z�z�"…~˜ÔÜ,¨TÓ2ˆà—,‘, B¨R�,Ó0€CØ�€Jä˜tÓ0Ð0r   c                óH   € V ^8„  d   QhR\         R\         R\         R\         /# r®   rj   )r   s   "r   r   r   Ç  s(   € ÷ *1ñ *1¬&ð *1¼ð *1ÄFð *1Ìvñ *1r   c                ó  € \        V 4       \        V4       \        V4       VP                  RR R8w  d   \        RVP                   24      hVP                  R,          ^8X  d   \        V4      pW,          p\	        W4      # )aÊ  Compute the distance in image 1 from each first-image point to the epipolar line of its match.

``d = right_to_left_epipolar_distance(pts1, pts2, Fm)`` takes the arguments of
:func:`sampson_epipolar_distance` and returns, per correspondence, ``(*, N)``, the unsquared distance in the
first image from ``pts1`` to the epipolar line :math:`F^\top x_2` of its match in ``pts2``, in the units of the
points. It does not measure anything in image 2: for the distance there, use
:func:`left_to_right_epipolar_distance`, and for both images :func:`symmetrical_epipolar_distance` or
:func:`sampson_epipolar_distance`.

Convention:
    - Argument order as :func:`sampson_epipolar_distance`.
    - The value does not depend on the scale of ``Fm``; a point whose epiline has :math:`a = b = 0` is at
      distance ``inf``, as in :func:`~kornia.geometry.linalg.point_line_distance`.

Args:
   pts1: points in the first image with shape ``(*, N, 2)`` or ``(*, N, 3)``.
   pts2: points in the second image with shape ``(*, N, 2)`` or ``(*, N, 3)``.
   Fm: Fundamental matrices with shape ``(*, 3, 3)``. Called Fm to
     avoid ambiguity with torch.nn.functional.

Returns:
    the one-sided distance with shape ``(*, N)``.

See Also:
    - :func:`left_to_right_epipolar_distance`: the distance in image 2 instead.
    - :func:`symmetrical_epipolar_distance`: both one-sided distances, squared and added.
    - :func:`sampson_epipolar_distance`: the first-order geometric error over both images.

Nr   r   r   r%   )r   r4   r5   r   r
   )r   r   r   r]   s   &&& r   Úright_to_left_epipolar_distancer³   Ç  sq   € ô< ˜4Ô Ü˜4Ô Ü˜2Ôà	‡x�x��€}˜ÔÜÐ>¸r¿x¹x¸jÐIÓJÐJà‡z�z�"…~˜ÔÜ,¨TÓ2ˆà�€Jä˜tÓ0Ð0r   )Ti   )Tç:Œ0âŽyE>r«   )Tr´   )Ú__doc__rc   ry   r   r   Úkornia.core.checkr   Úkornia.geometry.conversionsr   Ú$kornia.geometry.epipolar.fundamentalr   Úkornia.geometry.linalgr   r   r	   r
   rM   r`   rš   re   rv   r�   rˆ   r�   r�   r¤   r¨   r¬   r°   r³   © r   r   Ú<module>r»      sw   ðñ$ ^ã ã ß #å 4Ý EÝ Fß [Ó [÷92÷x&2ðX ).Ð %õtõ
Sõ&5õ,õ(;÷ FL÷R.2÷b2÷&*PõZ.1÷b*1r   