+
    åûjV-  ã                   óž  € R t ^RIHtHtHt ^RIHtHt ^RIH	t	 ^RI
Ht ^RIHtHt ^RIHtHt ^RIHtHtHt ^RIHtHtHtHtHtHtHtHtHtH t H!t!H"t"H#t# ^R	I$H%t%H&t& ^R
I'H(t(H)t)H*t*H+t+H,t,H-t-H.t.H/t/H0t0H1t1H2t2H3t3H4t4H5t5H6t6H7t7H8t8H9t9H:t:H;t;H<t< ^RI=H>t> ^RI?H@t@ ^RIAHBtB ^RICHDtDHEtEHFtFHGtGHHtHHItIHJtJHKtKHLtL ^RIMHNtN ^RIOHPtPHQtQHRtR ^RISHTtTHUtUHVtVHWtWHXtXHYtYHZtZH[t[H\t\H]t] ^RI^H_t_H`t`Hata ^RIbHctc ^RIdHeteHftfHgtg ^RIhHitiHjtj ^RIkHltl ^RImHntn ^RIoHptpHqtqHrtr . RNRNRNRNRNRNRNR NR!NR"NR#NR$NR%NR&NR'NR(NR)NR*NR+NR,NR-NR.NR/NR0NR1NR2NR3NR4NR5NR6NR7NR8NR9NR:NR;NR<NR=NR>NR?NR@NRANRBNRCNRDNRENRFNRGNRHNRINRJNRKNRLNRMNRNNRONRPNRQNRRNRSNRTNRUNRVNRWNRXNRYNRZNR[NR\NR]NR^NR_NR`NRaNRbNRcNRdNReNRfNRgNRhNRiNRjNRkNRlNRmNRnNRoNRpNRqNRrNtsRs# )tam  Detect, describe and match local features, from classical operators to pretrained models.

Images are floating-point tensors ``(B, C, H, W)`` in :math:`[0, 1]`. Keypoints use ``(x, y)`` pixels with integer
pixel centres, except :class:`DeDoDe` and :class:`LoFTR`, which place pixel ``i`` at ``i + 0.5``. Line endpoints use
``(row, col)``. See each model's conventions for resizing and coordinate limitations.

A local affine frame (LAF) ``[A | c]`` has shape ``(B, N, 2, 3)`` in pixels. It describes a patch with centre ``c``,
scale :math:`\sqrt{|\det A|}` and orientation ``atan2(a12, a11)`` in degrees. Detectors that return LAFs pad unused
slots with zero frames. Use :func:`laf_is_filled` to keep detected features and discard padded slots; apply the
same mask to LAFs, responses and descriptors.

Which function to use:

- Match images: :class:`LoFTR` without a detector; :class:`LocalFeatureMatcher` with a local feature and a
  descriptor-only matcher; :meth:`~kornia.feature.XFeat.match_xfeat` or :meth:`~kornia.feature.XFeat.match_xfeat_star`.
- Detect and describe learned keypoints: :class:`ALIKED` (subpixel), :class:`DISK` (integer pixels), :class:`XFeat`
  (64-D descriptors) or :class:`DeDoDe` (separate detector and descriptor networks); load with ``from_pretrained``.
- Store per-image learned features: :class:`ALIKEDFeatures` and :class:`DISKFeatures` hold keypoints and descriptors.
- Compose a detector and a LAF descriptor: :class:`LocalFeature`; the presets below return the same output tuple.
- Extract SIFT features: :class:`SIFTFeatureScaleSpace` refines scale-space extrema;
  :class:`SIFTFeature` detects independently at each pyramid level and takes one image per call.
- Extract HardNet features from blobs: :class:`DoGHardNet`, :class:`DoGAffNetHardNet` or :class:`HesAffNetHardNet`;
  from corners: :class:`GFTTAffNetHardNet`; the AffNet presets also adapt affine shape.
- Extract HardNet features with KeyNet: :class:`KeyNetHardNet` or :class:`KeyNetAffNetHardNet`, one image per call.
- Detect LAFs: :class:`ScaleSpaceDetector` refines scale-space extrema in a batch; :class:`MultiResolutionDetector`
  finds per-level 2D maxima in one image; :class:`KeyNetDetector` uses the learned :class:`KeyNet` response.
- Score corners: :func:`harris_response` or :func:`gftt_response`; module forms: :class:`CornerHarris`,
  :class:`CornerGFTT`.
- Score blobs: :func:`hessian_response` or :func:`dog_response_single`; module forms: :class:`BlobHessian`,
  :class:`BlobDoGSingle`; for Gaussian scale stacks: :func:`dog_response` and :class:`BlobDoG`.
- Describe grayscale patches: :class:`SIFTDescriptor` or :class:`MKDDescriptor`; learned 32 x 32 descriptors:
  :class:`HardNet`, :class:`HardNet8`, :class:`HyNet`, :class:`SOSNet`, :class:`TFeat`.
- Describe LAFs in an image: :class:`LAFDescriptor` reuses a patch descriptor, :func:`get_laf_descriptors` takes one
  per call, and :class:`SIFTDescriptorFromPyramid` computes SIFT without extracting patches.
- Describe every position: :class:`DenseSIFTDescriptor`; convert SIFT bin layouts:
  :func:`convert_sift_descriptor_layout`.
- Orient LAFs: :class:`LAFOrienter` with :class:`PatchDominantGradientOrientation` or the learned :class:`OriNet`.
- Adapt affine shape: :class:`LAFAffineShapeEstimator` with :class:`PatchAffineShapeEstimator`, or the learned
  :class:`LAFAffNetShapeEstimator`; pass LAFs through unchanged: :class:`PassLAF`.
- Match descriptors: :func:`match_nn` (nearest), :func:`match_mnn` (mutual), :func:`match_snn` (ratio test),
  :func:`match_smnn` (mutual and ratio), or :class:`DescriptorMatcher`; padded batches: :func:`match_smnn_batched`.
- Match descriptors with LAF geometry: :func:`match_fginn`, :func:`match_adalam` or
  :class:`GeometryAwareDescriptorMatcher`.
- Match with a learned model: :class:`LightGlueMatcher` takes descriptors and LAFs; :class:`LightGlue` takes feature
  dictionaries; :class:`OnnxLightGlue` runs an exported model with onnxruntime.
- Verify matches geometrically: :class:`~kornia.geometry.ransac.RANSAC` fits a model and selects its inliers.
- Build LAFs: :func:`laf_from_center_scale_ori`, :func:`ellipse_to_laf` or :func:`laf_from_three_points`.
- Read LAFs: :func:`get_laf_center`, :func:`get_laf_scale`, :func:`get_laf_orientation`, :func:`laf_to_three_points`
  or :func:`laf_to_boundary_points`.
- Transform LAFs: :func:`scale_laf`, :func:`rotate_laf`, :func:`set_laf_orientation`, :func:`make_upright`,
  :func:`perspective_transform_lafs`, :func:`normalize_laf` or :func:`denormalize_laf`.
- Check LAFs: :func:`laf_is_filled` selects detections, :func:`laf_is_valid` checks finite nonsingular frames,
  :func:`laf_is_inside_image` checks bounds, and :func:`KORNIA_CHECK_LAF` checks shape.
- Extract patches: :func:`extract_patches_from_pyramid` limits aliasing; :func:`extract_patches_simple` samples
  directly.
- Process line segments: :class:`SOLD2` detects, describes and matches; :class:`SOLD2_detector` detects only.
- Reuse network components: :class:`FilterResponseNorm2d` and :class:`TLU` from HyNet; :class:`XFeatModel` and
  :class:`InterpolateSparse2d` from XFeat.
- Deblur a fast-moving object: :class:`DeFMO` produces RGBA sub-frames.

:class:`LocalFeatureMatcher` accepts descriptor-only matchers. To use :class:`LightGlueMatcher`, extract features
first and pass their descriptors and LAFs to it directly. For learned keypoints, construct LAFs with
:func:`laf_from_center_scale_ori`; subtract 0.5 from DeDoDe coordinates first and match XFeat outputs with gradients
disabled. See the model and matcher docstrings for complete recipes.

Choosing an implementation by device. Kornia's local-feature pipelines run at their authors' speed or faster on
CUDA, x86 and Apple M1 CPUs and Apple MPS, and are as accurate on the cohorts measured. Choose differently here:

- :class:`ALIKED` on CUDA: compile it for repeated inference. Eager, it runs at 0.8x the authors' speed; compiled, at
  1.6x. On CPUs keep it eager, at 1.7-2.0x.
- SIFT on a CPU: use OpenCV's, 8-14x faster than kornia's on the Apple M1 CPU. Kornia's is for images on a GPU,
  gradients or batches; :class:`SIFTFeature` takes one image per call, :class:`SIFTFeatureScaleSpace` a batch.
- :func:`match_snn` and :func:`match_smnn` on CUDA or the Apple M1 CPU: faiss's exact k-nearest-neighbour search
  returns the same matches up to 2.2x faster. On the x86 CPU, kornia is the fastest.
- :meth:`~kornia.feature.XFeat.match_xfeat_star` departs from the authors' refinement on purpose: much more
  accurate on planar scenes, mixed on PhotoTourism (see :class:`XFeat`).

Figures per device and the protocol (640 px images, 2,048 features, PyTorch 2.14):
https://kornia.readthedocs.io/en/latest/applications/image_matching.html#feature-speed-by-device
)ÚLAFAffineShapeEstimatorÚLAFAffNetShapeEstimatorÚPatchAffineShapeEstimator)ÚALIKEDÚALIKEDFeatures)ÚDeDoDe)ÚDeFMO)ÚDISKÚDISKFeatures)ÚHardNetÚHardNet8)ÚTLUÚFilterResponseNorm2dÚHyNet)ÚDoGAffNetHardNetÚ
DoGHardNetÚGFTTAffNetHardNetÚHesAffNetHardNetÚKeyNetAffNetHardNetÚKeyNetHardNetÚLAFDescriptorÚLightGlueMatcherÚLocalFeatureÚLocalFeatureMatcherÚSIFTFeatureÚSIFTFeatureScaleSpaceÚget_laf_descriptors)ÚKeyNetÚKeyNetDetector)ÚKORNIA_CHECK_LAFÚdenormalize_lafÚellipse_to_lafÚextract_patches_from_pyramidÚextract_patches_simpleÚget_laf_centerÚget_laf_orientationÚget_laf_scaleÚlaf_from_center_scale_oriÚlaf_from_three_pointsÚlaf_is_filledÚlaf_is_inside_imageÚlaf_is_validÚlaf_to_boundary_pointsÚlaf_to_three_pointsÚmake_uprightÚnormalize_lafÚperspective_transform_lafsÚ
rotate_lafÚ	scale_lafÚset_laf_orientation)Ú	LightGlue)ÚOnnxLightGlue)ÚLoFTR)	ÚDescriptorMatcherÚGeometryAwareDescriptorMatcherÚmatch_adalamÚmatch_fginnÚ	match_mnnÚmatch_nnÚ
match_smnnÚmatch_smnn_batchedÚ	match_snn)ÚMKDDescriptor)ÚLAFOrienterÚOriNetÚ PatchDominantGradientOrientation)
ÚBlobDoGÚBlobDoGSingleÚBlobHessianÚ
CornerGFTTÚCornerHarrisÚdog_responseÚdog_response_singleÚgftt_responseÚharris_responseÚhessian_response)ÚMultiResolutionDetectorÚPassLAFÚScaleSpaceDetector)ÚSIFTDescriptorFromPyramid)ÚDenseSIFTDescriptorÚSIFTDescriptorÚconvert_sift_descriptor_layout)ÚSOLD2ÚSOLD2_detector)ÚSOSNet)ÚTFeat)ÚInterpolateSparse2dÚXFeatÚ
XFeatModelr   r	   r   rU   r   r   rD   rE   rF   rG   rH   r
   r   r   rR   r7   r   r   r   r   r8   r   r   r   r   rY   r   r   r   r   r   r   r   rA   r4   r   r6   r   r   r@   rN   r5   rB   rO   r   rC   rS   rQ   r   r   rV   rW   rP   rX   rZ   r[   rT   r    rI   rJ   r!   r"   r#   r$   r   r%   r&   rK   rL   rM   r'   r(   r)   r*   r+   r,   r-   r.   r9   r:   r;   r<   r=   r>   r?   r/   r0   r1   r2   r3   N)tÚ__doc__Úaffine_shaper   r   r   Úalikedr   r   Údedoder   Údefmor   Údiskr	   r
   Úhardnetr   r   Úhynetr   r   r   Ú
integratedr   r   r   r   r   r   r   r   r   r   r   r   r   Úkeynetr   r   Úlafr   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   Ú	lightgluer4   Úlightglue_onnxr5   Úloftrr6   Úmatchingr7   r8   r9   r:   r;   r<   r=   r>   r?   Úmkdr@   ÚorientationrA   rB   rC   Ú	responsesrD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   Úscale_space_detectorrN   rO   rP   ÚsiftrQ   ÚsiftdescrR   rS   rT   Úsold2rU   rV   ÚsosnetrW   ÚtfeatrX   ÚxfeatrY   rZ   r[   Ú__all__© ó    ÚSC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\kornia\feature\__init__.pyÚ<module>ry      s  ðñ$O÷b fÑ eß *Ý Ý ß $ß &ß 3Ñ 3÷÷ ÷ õ ÷ +÷÷ ÷ ÷ ÷ õ õ. !Ý )Ý ÷
÷ 
õ 
õ ß NÑ N÷÷ ÷ ÷ WÑ VÝ +ß YÑ Yß (Ý Ý ß 9Ñ 9ð[Øð[à
ð[ð ð[ð ð	[ð
 
ð[ð ð[ð ð[ð ð[ð ð[ð ð[ð ð[ð ð[ð ð[ð ð[ð ð[ð  ð![ð" ð#[ð$ ð%[ð& ð'[ð( ð)[ð* %ð+[ð, ð-[ð. ð/[ð0 ð1[ð2 ð3[ð4 ð5[ð6 ð7[ð8 ð9[ð: ð;[ð< ð=[ð> ð?[ð@ ðA[ðB ðC[ðD ðE[ðF ðG[ðH ðI[ðJ ðK[ðL ðM[ðN ðO[ðP ðQ[ðR ðS[ðT ðU[ðV ðW[ðX ðY[ðZ  ð[[ð\ 'ð][ð^ ð_[ð`  ða[ðb ðc[ðd ðe[ðf ðg[ðh ði[ðj ðk[ðl ðm[ðn ðo[ðp ðq[ðr %ðs[ðt ðu[ðv ðw[ðx ðy[ðz ð{[ð| #ð}[ð~ ð[ð@ ðA[ðB ðC[ðD ðE[ðF ðG[ðH ðI[ðJ ðK[ðL ðM[ðN  ðO[ðP ðQ[ðR ðS[ðT ðU[ðV ðW[ðX ðY[ðZ ð[[ð\ ð][ð^ ð_[ð` ða[ðb ðc[ðd ðe[ðf ðg[ðh ði[ðj ðk[ðl ðm[ðn !ðo[ðp ðq[ðr ðs[ðt ðu[‚rw   