+
    
åûj->  ã                  ó.  € R t ^ RIHt ^ RIt^ RIt^ RIHtHtHt ^ RI	t	^ RI
HtHt ^ RIHt ^ RIHtHt R"t^
t^t^t^
t^tR#tRtRt^t^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 lt#R R lt$R R lt%R R lt&R R lt'R R lt(R  R! lt)R# )$aC  DEGENSAC kernels: fundamental matrices unaffected by a dominant plane (Chum, Werner and Matas, CVPR 2005).

:class:`~kornia.geometry.ransac.RANSAC` runs them for seven-point fundamental matrices. They follow Chum's C
implementation in pydegensac (``DegUtils.c``, ``ranH.c``, ``rtools.h``, ``exp_ranF.c``): the H-degeneracy test of a
seven-point sample (``checksample``), the local optimization of the homography (``innerH``), and the plane-and-parallax
search (``rFtH``). Points are Hartley-normalized homogeneous points, and every threshold is a squared distance in that
frame.
)ÚannotationsN)ÚListÚOptionalÚTuple)Ú_sampson_from_quadratic_basisÚ_sampson_quadratic_basis)Úcross_product_matrix)Úfind_homography_dltÚsampson_homography_distanceg+‡ÙÎ÷ï?i N  gffffffî?c               ó    € V ^8„  d   QhRRRR/# )é   ÚFútorch.TensorÚreturn© )Úformats   "ÚUC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\kornia\geometry\_degensac.pyÚ__annotate__r   :   s   € ÷ 8ñ 8�\ð 8 lñ 8ó    c                óÄ  € V P                   p\        P                  P                  VR. RO3,          VR. RO3,          4      pVP	                  4       P                  R4      P                  ^4      pV\        P                  ! V P                  ^ ,          V P                  R7      V3,          pWDP	                  4       P                  RRR7      P                  4       ,          # )zlUnit left null vectors ``(B, 3)`` of rank-2 matrices ``(B, 3, 3)``: ``F^T e' = 0``, the epipoles in image 2.ºNNN©ÚdeviceT©Úkeepdim)é    r   é   )r   r   r   éÿÿÿÿ)ÚmTÚtorchÚlinalgÚcrossÚsquareÚsumÚargmaxÚarangeÚshaper   Úrsqrt)r   ÚcolumnsÚcrossesÚbestÚes   &    r   Ú_left_epipoler,   :   s    € à�d‰d€GÜ�l‰l× Ñ  ¨ªI¨Õ!6¸ÀÂ9ÀÕ8MÓN€GØ�>‰>Ó×Ñ Ó#×*Ñ*¨1Ó-€DØ”—’˜QŸW™W Q�Z°·±Ô9¸4Ð?Õ@€AØ�x‰x‹z�~‰~˜b¨$ˆ~Ó/×5Ñ5Ó7Õ7Ð7r   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r   r   Úx1Úx2r   r   )r   s   "r   r   r   C   s/   € ÷ Hñ H lð H¸ð HÈ,ð HÐ[gñ Hr   c                óÂ  € \        V P                  R^^4      4      P                  ! . V P                  RR O^N5!  p\        V4      V ,          p\        P
                  P                  W!VR,          P                  ,          4      p\        P
                  P                  W#R,          P                  V4      4      pWV,          P                  R4      VP                  4       P                  R4      ,          p\        P
                  P                  W4      w  r‰VP                  V	^ 8g  R,          \        R4      4      pVR,          VR,          VR	,          ,          ,
          # )
ap  Plane homographies ``(..., T, 3, 3)`` through triplets ``x1``, ``x2`` for ``F`` ``(..., 3, 3)``.

``H = A - e' (M^{-1} b)^T`` with ``A = [e']_x F``, ``M`` the triplet's homogeneous first-image points as rows and
``b_i = (x'_i x A x_i)^T (x'_i x e') / |x'_i x e'|^2`` (Hartley and Zisserman, result 13.6; the paper's eq. 4).
A collinear triplet gives a NaN homography.
NÚnanr   éþÿÿÿ).Nr   r   ).NNr   ).N).Nr   N).Nr   )r,   Úreshaper&   r   r   r    r!   r   Ú	expand_asr#   r"   Úsolve_exÚmasked_fillÚfloat)
r   r.   r/   r+   ÚAÚc1Úc2ÚbÚvÚinfos
   &&&       r   Ú_homographies_from_fundamentalr>   C   s  € ô 	�a—i‘i  A qÓ)Ó*×2Ò2ÐD°A·G±G¸C¸R°LÐDÀ!ÓD€AÜ˜QÓ !Õ#€AÜ	�‰×	Ñ	˜B Q Õ%7×%:Ñ%:Õ :Ó	;€BÜ	�‰×	Ñ	˜BÐ"4Õ 5× ?Ñ ?ÀÓ CÓ	D€BØ	��‰�bÓ˜BŸI™I›KŸO™O¨BÓ/Õ/€AÜ�l‰l×#Ñ# BÓ*�G€AØ	�‰�t˜q‘y )Õ,¬e°E«lÓ;€AØˆ_Õ Ð"4Õ 5¸¸,½Õ GÕGÐGr   c          
     ó,   € V ^8„  d   QhRRRRRRRRRR/# )	r   r   r   r.   r/   Ú	thresholdr7   r   zOptional[torch.Tensor]r   )r   s   "r   r   r   T   s4   € ÷ 2ñ 2Øð2Ø%ð2Ø+7ð2ØDIð2àñ2r   c                ó4  € \         P                  ! \        VP                  R7      p\	        WV,          W$,          4      pV\         P
                  ! V4      P                  ^4      P                  ^4      ,          p\        V4      ^ 8X  d   R# \        VR,          VR,          V4      pVP                  ^4      R,          p\        W,          R,          W',          R,          RR7      p\        VR,          VR,          V4      pWc8  P                  ^4      ^8¬  \         P
                  ! V4      P                  ^4      P                  ^4      ,          p	\        V	P                  4       4      '       g   R# V\        V	P!                  4       R,          4      ,          # )	a  Chum's ``checksample``: a homography through at least five of the seven correspondences, if there is one.

``F`` ``(3, 3)`` is a seven-point model of the sample ``x1``, ``x2`` ``(7, 3)`` (homogeneous, ``w = 1``). Each
triplet of :data:`_TRIPLETS` gives a homography compatible with ``F``; it is refitted by DLT to the five
correspondences closest to it, and the sample is H-degenerate when five or more then have a squared Sampson
distance below ``threshold``. Returns the first such homography ``(3, 3)``, or None.
r   NÚsvd©Úsolver)Nr   ºNr   N)r   ºNé   N).rE   )r   r   )r   ÚtensorÚ	_TRIPLETSr   r>   ÚisfiniteÚflattenÚallÚlenr
   Úargsortr	   r#   ÚboolÚanyÚintÚnonzero)
r   r.   r/   r@   ÚindexÚHÚerrorsÚclosestÚrefitÚ
degenerates
   &&&&      r   Ú_h_degenerate_samplerY   T   s.  € ô �LŠLœ¨2¯9©9Ô5€EÜ& q¨U­)°RµYÓ?€AØ	Œ%�.Š.˜Ó
×
#Ñ
# AÓ
&×
*Ñ
*¨1Ó
-Õ.€AÜ
ˆ1ƒv�„{ÙÜ(¨¨K­¸"¸[½/È1ÓM€FØ�n‰n˜QÓ Õ&€GÜ ¥¨GÕ 4°bµkÀ'Õ6JÐSXÔY€EÜ(¨¨K­¸"¸[½/È5ÓQ€FØÑ%×*Ñ*¨1Ó-°Ñ2´e·n²nÀUÓ6K×6SÑ6SÐTUÓ6V×6ZÑ6ZÐ[\Ó6]Õ]€JÜ�
—‘Ó ×!Ò!ÙØ”�Z×'Ñ'Ó)¨$Õ/Ó0Õ1Ð1r   c          
     ó,   € V ^8„  d   QhRRRRRRRRRR/# )	r   r   r   r.   r/   r@   r7   r   zList[Optional[torch.Tensor]]r   )r   s   "r   r   r   m   s4   € ÷ ñ ØðØ%ðØ+7ðØDIðà!ñr   c                óR  € R.\        V 4      ,          p\        V 4      ^ 8X  d   V# \        P                  ! \        VP                  R7      p\        WRV3,          VRV3,          4      P                  ^ ^4      p\        P                  ! V4      P                  ^4      P                  ^4      P                  4       P                  4       p\        V4      ^ 8X  d   V# V\        \        4      ,          pWRR3,          W(RR3,          r©\        WšWg,          4      pVP                  ^4      R,          P                  RR^4      p\        V	P                  ^V4      V
P                  ^V4      RR7      p\        WšV4      pW³8  P                  ^4      ^8¬  \        P                  ! V4      P                  ^4      P                  ^4      ,          pVP                  4       P                  4       P!                  4        F,  p\#        W�,          4      pVV,          e   K!  Wß,          VV&   K.  	  V# )	ao  Batch the deterministic degeneracy tests of ``F`` ``(B, 3, 3)`` and samples ``(B, 7, 3)``.

Return the first qualifying triplet's refitted homography per sample, or None, as
:func:`_h_degenerate_sample` does. RANSAC still recovers these samples in draw order; batching only their
independent checks preserves the private generator and the previously searched planes.
Nr   r   rE   rB   rC   )r   rF   Nr   )rM   r   rH   rI   r   r>   rK   rJ   rL   rR   r
   rN   Úexpandr	   Úgatherr#   ÚtolistrQ   )r   r.   r/   r@   ÚresultrS   rT   ÚrowsÚownersÚp1Úp2rU   rV   rW   rX   ÚrowÚowners   &&&&             r   Ú_h_degenerate_samplesrf   m   sº  € ð -1¨6´C¸³F­?€FÜ
ˆ1ƒv�„{ØˆÜ�LŠLœ¨2¯9©9Ô5€EÜ& q¨Q°¨X­,¸¸1¸e¸8½ÓE×MÑMÈaÐQRÓS€AÜ�>Š>˜!Ó×$Ñ$ QÓ'×+Ñ+¨AÓ.×6Ñ6Ó8×@Ñ@ÓB€DÜ
ˆ4ƒy�A„~ØˆØ”Sœ“^Õ#€FØ˜˜2�Õ ¨1¨b =Õ 1ˆÜ(¨°µÓ9€FØ�n‰n˜QÓ Õ,×3Ñ3°B¸¸AÓ>€GÜ §	¡	¨!¨WÓ 5°r·y±yÀÀGÓ7LÐUZÔ[€EÜ(¨°Ó7€FØÑ%×*Ñ*¨1Ó-°Ñ2´e·n²nÀUÓ6K×6SÑ6SÐTUÓ6V×6ZÑ6ZÐ[\Ó6]Õ]€JØ×!Ñ!Ó#×+Ñ+Ó-×4Ñ4Ö6ˆÜ�F•KÓ ˆØ�%�=Ô Ø!�JˆF�5‹Mñ 7ð €Mr   c               ó0   € V ^8„  d   QhRRRRRRRRRRRR/# )r   rT   r   r.   r/   ÚfirstÚsecondr   r   )r   s   "r   r   r   Œ   s<   € ÷ >ñ >Øð>Ø%ð>Ø+7ð>Ø@Lð>ØVbð>àñ>r   c                óŒ  € \         P                  P                  WP                  ,          V4      p\         P                  P                  WS,          WT,          4      pWS,          P	                  RR7      WT,          P	                  RR7      ,          pVP	                  RR7      ^@\         P
                  ! VP                  4      P                  ,          V,          8*  pVP                  VR,          \        R4      4      p\        V4      V ,          p	W™P                  4       P                  RRR7      P                  4       ,          # )aº  Fundamental matrices ``(P, 3, 3)`` of unit Frobenius norm from a plane homography and pairs of correspondences.

Plane and parallax (Hartley and Zisserman, section 13.3): the line through ``H x1`` and ``x2`` of an off-plane
correspondence passes through the epipole, so two of them give ``e' = l_i x l_j`` and ``F = [e']_x H``. ``x1``,
``x2`` are homogeneous ``(n, 3)``; ``first`` and ``second`` ``(P,)`` index them. Parallel lines give NaN.
©Údimr1   Tr   r   )r   N)r2   r   )r   r    r!   r   ÚnormÚfinfoÚdtypeÚepsr6   r7   r   r"   r#   r'   )
rT   r.   r/   rh   ri   ÚlinesÚepipolesÚscaleÚparallelr   s
   &&&&&     r   Ú_plane_parallax_fundamentalsru   Œ   sç   € ô �L‰L×Ñ˜r§D¡D�y¨"Ó-€EÜ�|‰|×!Ñ! %¥,°µÓ>€Hð �L×Ñ "ÐÓ%¨­×(:Ñ(:¸rÐ(:Ó(BÕB€EØ�}‰} ˆ}Ó$¨¬U¯[ª[¸¿¹Ó-H×-LÑ-LÕ(LÈuÕ(TÑT€HØ×#Ñ# H¨WÕ$5´u¸U³|ÓD€HÜ˜XÓ&¨Õ*€AØ�x‰x‹z�~‰~˜h°ˆ~Ó5×;Ñ;Ó=Õ=Ð=r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   rU   r   r@   r7   r   r   )r   s   "r   r   r       s&   € ÷ Lñ L�|ð L°ð L¸,ñ Lr   c                ót   € RV \         V,          ,          ,
          P                  R4      P                  ^4      # )zfChum's ``SC_M`` score ``(C,)`` of squared errors ``(C, N)``: ``sum(max(0, 1 - e / (9/4 threshold)))``.g      ð?ç        )Ú_GAIN_SCALEÚ	clamp_minr#   )rU   r@   s   &&r   Ú
_msac_gainr{       s-   € à�&œK¨)Õ3Õ4Õ4×?Ñ?ÀÓD×HÑHÈÓKÐKr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úgainsr   Úaliver   zOptional[int]r   )r   s   "r   r   r   ¥   s!   € ÷ 	ñ 	˜<ð 	°ð 	Àñ 	r   c                óL  € \         P                  ! V\         P                  ! V 4      ,          V \         P                  ! V \        P
                  ) 4      4      p \        \         P                  ! V 4      P                  4       4      '       g   R# \        V P                  4       4      # )zâIndex of the first largest finite gain among live candidates, or None.

Candidates are in the order Chum's loops visit them; ``scoreLess`` is strict, so a tie keeps the earlier one, which
is also the index ``argmax`` returns.
N)
r   ÚwhererJ   Ú	full_likeÚmathÚinfrO   rP   rQ   r$   )r}   r~   s   &&r   Ú_best_candidater„   ¥   sj   € ô �KŠK˜¤§¢¨uÓ 5Õ5°u¼e¿oºoÈeÔVZ×V^ÑV^ÐU^Ó>_Ó`€EÜ”—’˜uÓ%×)Ñ)Ó+×,Ò,ÙÜˆu�|‰|‹~ÓÐr   c               ó0   € V ^8„  d   QhRRRRRRRRRRR	R
/# )r   rT   r   r.   r/   r@   r7   Ú	generatorúOptional[torch.Generator]r   z!Tuple[torch.Tensor, torch.Tensor]r   )r   s   "r   r   r   ±   s<   € ÷ ?.ñ ?.Øð?.Ø%ð?.Ø+7ð?.ØDIð?.ØVoð?.à&ñ?.r   c                ó  aaaaaa€ SP                   ^ ,          oSR,          SR,          uooR VV3R llpR VVVV3R llpV! V R,          4      ^ ,          pWs8*  p\        VP                  4       4      p	V	^8  d   W3# V! VP                  \        R4      \        V	^,          \        4      4      p
V! V
4      pW³8*  pVP                  ^4      ^8¬  pV
.p\        W³4      .pV.pV! V\        4      p
\        V,          pVV,
          \        ,          p\        \        4       F|  pV! V
4      pVP                  V
4       VP                  \        W³4      4       VP                  V4       VV8*  pWÜP                  ^4      ^8¬  ,          pV! V\        4      p
VV,          pK~  	  V! V
4      pVP                  V
4       VP                  \        W³4      4       VP                  V4       \        \        P                  ! V^4      P!                  4       \        P                  ! V^4      P!                  4       4      pVf   W3# \        P                  ! V^4      P!                  ^ ^4      V,          pVV! VR,          4      ^ ,          3# )ar  Chum's ``innerH``: the local optimization of ``H`` ``(3, 3)``, scored with the homography Sampson distance.

``x1``, ``x2`` are ``(N, 2)`` float64 host points and ``threshold`` is ``16 t``. ``inHrani`` runs
:data:`_RAN_REP` repetitions, batched here: each fits a DLT to a random subset of ``min(n / 2, 12)`` of the ``n``
inliers of ``H`` and refines it with ``iterH``: a fit to that model's inliers, then :data:`_ILSQ_ITERS` refits with
the selection threshold lowered from ``4 * threshold`` by ``3 * threshold / 4`` after each, every fit using at most
:data:`_INL_LIMIT` selected points, a random subset when there are more. A repetition whose subset model has fewer
than 4 inliers contributes nothing; one whose selection falls below 4 points stops. Every evaluated model is a
candidate, ranked by :func:`_msac_gain`. ``innerH`` passes 10 as the argument it calls ``iters``, which
``inHrani`` receives as ``inlLimit``; the repetition count is the constant ``RAN_REP``, also 10.

Returns:
    The best candidate, or ``H`` when no repetition produced one (``inHrani`` leaves it unchanged), and its squared
    Sampson distances ``(N,)``.
Nc               ó    € V ^8„  d   QhRRRR/# )r   Úmodelsr   r   r   )r   s   "r   r   Ú'_inner_homography.<locals>.__annotate__Æ   s   € ÷ ?ñ ?˜,ð ?¨<ñ ?r   c                ó   <€ \        SSV 4      # ©N)r
   )rŠ   Úpts1Úpts2s   &€€r   Ú	errors_ofÚ$_inner_homography.<locals>.errors_ofÆ   s   ø€ Ü*¨4°°vÓ>Ð>r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úselectedr   ÚcaprQ   r   r   )r   s   "r   r   r‹   É   s&   € ÷ \ñ \�lð \¨ð \°ñ \r   c                ól  <€ \         P                  ! V P                  SSP                  R 7      P	                  V ( R4      pVP                  \        VS4      ^R7      pVP                  ^ 8¬  P                  SP                  4      p\        SVP                  ,          SVP                  ,          VRR7      # )©r†   ro   rk   rB   rC   g      ð¿)r   Úrandr&   ro   r6   ÚtopkÚminÚvaluesÚtor	   Úindices)	r“   r”   ÚkeysÚtopÚweightsr†   Ún_pointsr.   r/   s	   &&   €€€€r   ÚfitÚ_inner_homography.<locals>.fitÉ   s†   ø€ ä�zŠz˜(Ÿ.™.°IÀRÇXÁXÔN×ZÑZÐ\dÐ[dÐfjÓkˆØ�i‰iœ˜C Ó*°ˆiÓ2ˆØ—:‘: ‘?×&Ñ& r§x¡xÓ0ˆÜ" 2 c§k¡k¥?°B°s·{±{µOÀWÐUZÔ[Ð[r   r   )r&   rQ   r#   r\   Ú_RAN_REPr™   Ú_SUBSET_CAPr{   Ú
_INL_LIMITÚ_TCÚ_ILSQ_ITERSÚrangeÚappendr„   r   ÚstackrK   )rT   r.   r/   r@   r†   r�   r¡   ÚbaseÚinliersÚcountrŠ   rU   r“   r~   Ú
candidatesr}   ÚliveÚ	selectionÚstepÚ_r*   Úwinnerr    rŽ   r�   s   &ff&f                 @@@r   Ú_inner_homographyr´   ±   s&  ý€ ð$ �x‰x˜�{€HØ�D•˜2˜d�8€J€Dˆ$÷?ñ ?÷\ó \ñ �Q�t•WÓ˜aÕ €DØÑ€GÜ�—‘“Ó€EØˆq„yØˆwˆÙ�—‘¤¨"Ó-¬s°5¸Aµ:¼{Ó/KÓL€FÙ�vÓ€FØÑ"€HØ�L‰L˜‹O˜qÑ €EØ&, X€JÜ!+¨FÓ!>Ð ?€EØ %˜w€DÙ�œ:Ó&€FÜ�i•€IØ˜	Õ!¤[Õ0€DÜ”;ÖˆÙ˜6Ó"ˆØ×Ñ˜&Ô!Ø�‰”Z Ó2Ô3Ø�‰�EÔØ˜YÑ&ˆØŸ™ a›¨AÑ-Õ.ˆÙ�XœzÓ*ˆØ�TÕŠ	ñ  ñ �vÓ€FØ×Ñ�fÔØ	‡L�L”˜FÓ.Ô/Ø‡K�K�ÔÜœ5Ÿ;š; u¨aÓ0×8Ñ8Ó:¼E¿KºKÈÈaÓ<P×<XÑ<XÓ<ZÓ[€DØ‚|ØˆwˆÜ�[Š[˜ QÓ'×/Ñ/°°1Ó5°dÕ;€FØ‘9˜V D�\Ó*¨1Õ-Ð-Ð-r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úplaner   ÚseenúList[torch.Tensor]r   rO   r   )r   s   "r   r   r   ó   s'   € ÷ mñ m˜,ð mÐ.@ð mÀTñ mr   c                óx   a € \         ;QJ d    V 3R lV 4       F  '       g   K   R# 	  R# ! V 3R lV 4       4      # )a/  Whether the inlier mask ``plane`` matches one in ``seen``: a Jaccard index of at least 0.95.

Every degenerate record setter of a dominant plane finds that plane again; VSAC likewise skips the local
optimization of a model whose inliers repeat the best one's (Ivashechkin, Barath and Matas, ICCV 2021).
c              3  ó¼   <"  € T FQ  p\        SV,          P                  4       4      \        \        SV,          P                  4       4      ,          8¬  x € KS  	  R # 5ir�   ©r7   r#   Ú_SAME_PLANE)Ú.0Úotherr¶   s   & €r   Ú	<genexpr>Ú!_repeats_plane.<locals>.<genexpr>ù   sB   øé € ÐlÑgkÐ^cŒu�e˜e•m×(Ñ(Ó*Ó+¬{¼UÀEÈEÅM×CVÑCVÓCXÓ=YÕ/YÖYÓgkùs   ƒAATF©rP   )r¶   r·   s   f&r   Ú_repeats_planerÂ   ó   s0   ø€ ÷ ‹3ÔlÑgkÓl�3Œ3ÐlŠ3Ðlˆ3ÔlÑgkÓlÓlÐlr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r¬   r   r·   r¸   r   rO   r   )r   s   "r   r   r   ü   s'   € ÷ gñ g˜<ð gÐ/Að gÀdñ gr   c                óx   a € \         ;QJ d    V 3R lV 4       F  '       g   K   R# 	  R# ! V 3R lV 4       4      # )a_  Whether 95% or more of the inlier mask ``inliers`` lies inside one plane of ``seen``.

The test for a sample's own, noisier homography before its refinement: its inliers are a subset of a plane already
refined in the call rather than a match of it. Another plane's correspondences are inliers of the first plane only
near the line where the two meet.
c              3  ó®   <"  € T FJ  p\        SV,          P                  4       4      \        \        SP                  4       4      ,          8¬  x € KL  	  R # 5ir�   r»   )r½   r¶   r¬   s   & €r   r¿   Ú _inside_plane.<locals>.<genexpr>  s;   øé € ÐfÑaeÐX]Œu�g •o×*Ñ*Ó,Ó-´¼uÀWÇ[Á[Ã]Ó?SÕ1SÖSÓaeùs   ƒAATFrÁ   )r¬   r·   s   f&r   Ú_inside_planerÇ   ü   s0   ø€ ÷ ‹3ÔfÑaeÓf�3Œ3ÐfŠ3Ðfˆ3ÔfÑaeÓfÓfÐfr   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   ÚsupportrQ   ÚtotalÚ
confidencer7   r   r   )r   s   "r   r   r     s.   € ÷ 
[ñ 
[˜ð 
[ Sð 
[°eð 
[Àñ 
[r   c           	     óD  € W8¼  d   ^# W ^,
          ,          W^,
          ,          ,          pVR8:  d   \         P                  # \        \         P                  \        P                  ! \        P
                  ! V) 4      \        P
                  ! V) 4      ,          4      4      # )zØTwo-point samples needed for ``confidence`` with ``support`` inliers among ``total`` correspondences.

:meth:`~kornia.geometry.ransac.RANSAC.max_samples_by_conf` for a sample of two, which this module cannot import.
rx   )ÚsysÚmaxsizer™   r‚   ÚceilÚlog1p)rÉ   rÊ   rË   Úprobabilitys   &&& r   Ú_pair_drawsrÒ     sl   € ð
 ÔÙØ q�[Õ)¨U¸aµiÕ-@ÕA€KØ�cÔÜ�{‰{ÐÜŒs�{‰{œDŸIšI¤d§j¢j°*°Ó&=ÄÇ
Â
ÈKÈ<Ó@XÕ&XÓYÓZÐZr   c               ó4   € V ^8„  d   QhRRRRRRRRRRR	R
RR/# )r   rT   r   r.   r/   r@   r7   ÚbatchrQ   r†   r‡   r   z+Optional[Tuple[torch.Tensor, torch.Tensor]]r   )r   s   "r   r   r     sN   € ÷ (6ñ (6Øð(6àð(6ð 	ð(6ð ð	(6ð
 ð(6ð )ð(6ð 1ñ(6r   c           	     óâ  € VP                   ^ ,          p\        W4      pVP                  ^ ^^4      p\        P                  ! ^ \        P
                  VP                  R7      p	^ ^ \        rËp
W¼8  EdÃ   \        WLV,
          4      p\        P                  ! WÕ\        P                  R7      V,          P                  4       p\        P                  ! WÕ\        P                  R7      V^,
          ,          P                  4       pWÿV8¬  P                  4       ,           p\        WW.P                  VP                  4      VP                  VP                  4      4      p\        VV4      V8  P                  ^4      p\        P                  ! V	V.4      P!                  \        \"        \%        V	4      V,           4      4      w  p	p\        P                  ! VV.4      V,          pW½,          p\'        V
\)        V	^ ,          4      4      p
V
\*        8”  g   EK¥  \        V^\-        W¦\.        4      ,          4      pEKÉ  V	\*        8„  p\1        VP3                  4       4      '       g   R# VV,          V	V,          3# )aò  Chum's ``rFtH``: plane-and-parallax RANSAC over pairs of off-plane correspondences.

``x1``, ``x2`` ``(n, 3)`` are the off-plane correspondences, normalized, on their device; ``H`` is the plane
homography there and ``threshold`` is ``2 t``. Pairs are drawn on the host from ``generator`` (a device's generator
cannot draw on the host) in batches of ``batch`` and moved to the device. A model's support counts the off-plane
correspondences with a squared Sampson distance below ``threshold``; drawing stops at twice the two-point bound for
the best support at confidence 0.999, as ``rFtH``'s loop runs to ``2 * max_sam``, or after 20000 draws.

Returns:
    Up to eight models with more than four off-plane inliers and their support, best first, or None.
)ro   r   r–   N)r&   r   Ú	new_zerosr   ÚzerosÚlongr   Ú_PP_MAX_DRAWSr™   r—   Úfloat64ru   r›   r   r#   Úcatr˜   Ú_PP_KEEPrM   ÚmaxrQ   Ú_PP_MIN_SUPPORTrÒ   Ú_PP_CONFIDENCErO   rP   )rT   r.   r/   r@   rÔ   r†   ÚnÚbasisÚkeptÚkept_supportr*   ÚdrawnÚlimitÚsizerh   ri   rŠ   rÉ   ÚorderÚ
qualifyings   &&&&&&              r   Ú_plane_parallax_searchré     sË  € ð& 	�‰��€AÜ$ RÓ,€EØ�<‰<˜˜1˜aÓ €DÜ—;’;˜q¬¯
©
¸2¿9¹9ÔE€LØ˜Aœ}�€DØ
�-Ü�5 %�-Ó(ˆÜ—’˜D¼U¿]¹]ÔKÈaÕO×UÑUÓWˆÜ—*’*˜T¼e¿m¹mÔLÐPQÐTUÕPUÕV×\Ñ\Ó^ˆØ U™?×0Ñ0Ó2Õ2ˆÜ-¨a°R¿¹À"Ç)Á)Ó9LÈfÏiÉiÐXZ×XaÑXaÓNbÓcˆÜ0°¸Ó?À)ÑK×PÑPÐQRÓSˆÜ#Ÿiši¨°wÐ(?Ó@×EÑEÄcÌ(ÔTWÐXdÓTeÐhlÕTlÓFmÓnÑˆ�eÜ�yŠy˜$ ˜Ó(¨Õ/ˆØ�ˆÜ�4œ˜\¨!�_Ó-Ó.ˆØ”/×!Ü˜˜q¤;¨t¼Ó#GÕGÓH‹EØ¤Ñ/€JÜ�
—‘Ó ×!Ò!ÙØ�
Õ˜\¨*Õ5Ð5Ð5r   ))r   r   r   )é   é   rG   )r   r   é   )rê   rë   rì   )r   rG   rì   g      @)*Ú__doc__Ú
__future__r   r‚   rÍ   Útypingr   r   r   r   Ú!kornia.geometry.epipolar._metricsr   r   Ú kornia.geometry.epipolar.numericr   Úkornia.geometry.homographyr	   r
   rI   r£   r§   r¦   r¥   r¤   ry   rß   rÙ   rÞ   rÜ   r¼   r,   r>   rY   rf   ru   r{   r„   r´   rÂ   rÇ   rÒ   ré   r   r   r   Ú<module>ró      s¨   ðñ$õ #ã Û 
ß (Ñ (ã ç eÝ Aß Wð D€	à€Ø€Ø€Ø€
Ø€à€à€Ø€Ø€Ø€à€õ8õHõ"2õ2õ>>õ(Lõ
	õ?.õDmõgõ
[÷(6r   