+
    åûj2|  ã                   óx  € ^ RI t ^ RIHtHt ^ RIt^ RIHt ^ RIHt ^ RIH	t	H
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 ltRR R llt ! R R]P"                  4      t ! R R]P"                  4      t ! R R]P"                  4      t ! R R]P"                  4      t ! R R]P"                  4      tR# )é    N)ÚOptionalÚUnion)Únn©ÚKORNIA_CHECK_SHAPE)Úgaussian_blur2dÚspatial_gradientc                ó0   € V ^8„  d   QhR\         R\        /# )é   ÚsigmaÚreturn)ÚfloatÚint)Úformats   "ÚTC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\kornia\feature\responses.pyÚ__annotate__r      s   € ÷ 	ñ 	œEð 	¤cñ 	ó    c                 óf   € \        RV ,          R,           4      pV^,          ^ 8X  d
   V^,          pV# )g       @ç      ð?g       @)r   )r   Úksizes   & r   Ú_get_kernel_sizer      s1   € Ü�	˜EÕ! CÕ'Ó(€Eð ˆq…y�A„~Ø��
ˆØ€Lr   c          
      óÜ   € V ^8„  d   QhR\         P                  R\        \         P                  \        3,          R\        R\
        \         P                  ,          R\         P                  /# )r   ÚinputÚkÚ
grads_modeÚsigmasr   )ÚtorchÚTensorr   r   Ústrr   )r   s   "r   r   r   (   s`   € ÷ rñ rÜ�<‰<ðräŒU�\‰\œ5Ð Õ!ðrô ðrô ”U—\‘\Õ"ð	rô
 ‡\�\ñrr   c                ó¶  € \        V . RO4       Ve�   \        V\        P                  4      '       g   \	        R\        V4       24      h\        VP                  4      ^8X  d&   VP                  ^ 4      V P                  ^ 4      8w  d   \        RVP                   24      h\        W4      pVR,          pVR,          p\        V^,          RR4      p\        V^,          RR4      p\        WV,          RR4      p	Wx,          W™,          ,
          p
Wx,           pW¡V^,          ,          ,
          pVe*   WÃP                  ^4      P                  R^^^4      ,          pV# )	ag  Compute the Harris corner response det(M) - k trace(M)^2 of the windowed structure tensor M.

``R = harris_response(img, k)`` takes images ``(B, C, H, W)`` and returns the Harris response of every pixel of
every channel, ``(B, C, H, W)``, without non-maxima suppression: positive at a corner, negative along an edge and
zero on a constant image. ``k`` defaults to ``0.04``. To pass it to a detector as ``resp_module``, use its module
form :class:`CornerHarris`; for a corner response with no ``k`` to tune and no negative values up to roundoff,
use :func:`gftt_response`; for blobs, :func:`hessian_response`.

.. image:: _static/img/harris_response.png

The response map is computed according to the following formulation:

.. math::
    R = det(M) - k \cdot trace(M)^2

where :math:`w` are the weights of a window :math:`W`:

.. math::
    M = \sum_{(x,y) \in W} w(x, y)
    \begin{bmatrix}
        I^{2}_x & I_x I_y \\
        I_x I_y & I^{2}_y \\
    \end{bmatrix}

and :math:`k` is an empirically determined constant, usually in :math:`[0.04, 0.06]`.

Convention:
    - :math:`R` is signed and not clamped: positive at a corner, negative along an edge.
    - :math:`I_x` and :math:`I_y` come from :func:`~kornia.filters.spatial_gradient` with ``mode=grads_mode``,
      in intensity per pixel for both modes, and :math:`W` is a :math:`7 \times 7` Gaussian window of
      :math:`\sigma = 1` whose weights sum to one. A linear ramp of gradient :math:`g` therefore gives
      :math:`R = -k \|g\|^4` away from the border.
    - Apart from ``sigmas``, the response depends on the image's intensity scale: multiplying the image by ``c``
      multiplies the response by ``c ** 4``, and an offset does not change it, so a threshold tuned on images in
      ``[0, 1]`` does not carry over to ``[0, 255]``.
    - ``k`` is not validated.
    - Each channel is processed independently. The window extends its reflected border across short axes,
      including singleton pixels.

Args:
    input: input image with shape ``(B, C, H, W)``.
    k: the Harris detector free parameter, a number or a tensor that broadcasts against ``(B, C, H, W)``, such as
      ``(B, 1, 1, 1)`` for one value per image.
    grads_mode: can be ``'sobel'`` for standalone use or ``'diff'`` for use on Gaussian pyramid.
    sigmas: per-image scales with shape ``(B,)``. The response of image ``b`` is multiplied by
      ``sigmas[b] ** 4``, so that non-maxima suppression can compare the levels of a scale pyramid, as in
      `vlfeat <https://github.com/vlfeat/vlfeat/blob/master/vl/covdet.c>`_. Another type raises ``TypeError``
      and another shape ``ValueError``.

Return:
    the response map per channel with shape ``(B, C, H, W)``.

See Also:
    - :class:`CornerHarris`: the module form, with ``k`` and ``grads_mode`` fixed at construction.
    - :func:`gftt_response`: the smaller eigenvalue of the same structure tensor, with no ``k`` and not negative
      up to roundoff.
    - :func:`hessian_response`: a blob response from second derivatives, positive at blobs of both polarities.
    - :class:`ScaleSpaceDetector`: detects LAFs at the scale-space maxima of a response module such as
      :class:`CornerHarris`.

Example:
    >>> input = torch.tensor([[[
    ...    [0., 0., 0., 0., 0., 0., 0.],
    ...    [0., 1., 1., 1., 1., 1., 0.],
    ...    [0., 1., 1., 1., 1., 1., 0.],
    ...    [0., 1., 1., 1., 1., 1., 0.],
    ...    [0., 1., 1., 1., 1., 1., 0.],
    ...    [0., 1., 1., 1., 1., 1., 0.],
    ...    [0., 0., 0., 0., 0., 0., 0.],
    ... ]]])  # 1x1x7x7
    >>> # compute the response map; rounded for a platform-stable display
    >>> harris_response(input, 0.04).round(decimals=4) + 0.0
    tensor([[[[0.0042, 0.0054, 0.0035, 0.0006, 0.0035, 0.0054, 0.0042],
              [0.0054, 0.0068, 0.0046, 0.0014, 0.0046, 0.0068, 0.0054],
              [0.0035, 0.0046, 0.0034, 0.0014, 0.0034, 0.0046, 0.0035],
              [0.0006, 0.0014, 0.0014, 0.0006, 0.0014, 0.0014, 0.0006],
              [0.0035, 0.0046, 0.0034, 0.0014, 0.0034, 0.0046, 0.0035],
              [0.0054, 0.0068, 0.0046, 0.0014, 0.0046, 0.0068, 0.0054],
              [0.0042, 0.0054, 0.0035, 0.0006, 0.0035, 0.0054, 0.0042]]]])

ú'sigmas type is not a torch.Tensor. Got ú9Invalid sigmas shape, we expect B == input.size(0). Got: ©ÚBÚCÚHÚW©ºNNNr)   r   ©r)   r)   é   ©é   r-   ©r   r   éÿÿÿÿ)r   Ú
isinstancer   r   Ú	TypeErrorÚtypeÚlenÚshapeÚsizeÚ
ValueErrorr	   r   ÚpowÚview)r   r   r   r   Ú	gradientsÚdxÚdyÚdx2Údy2ÚdxyÚdet_mÚtrace_mÚscoress   &&&&         r   Úharris_responserB   (   s)  € ôn �uÒ2Ô3àÒÜ˜&¤%§,¡,×/Ò/ÜÐEÄdÈ6ÃlÀ^ÐTÓUÐUÜ�F—L‘LÓ! QÔ&¨F¯K©K¸«N¸e¿j¹jÈ»mÔ,KÜÐXÐY_×YeÑYeÐXfÐgÓhÐhä.¨uÓA€IØ  Õ)€BØ  Õ)€Bô (¨¨A­¨v°zÓB€CÜ'¨¨A­¨v°zÓB€CÜ'¨­°¸ÓD€Cà�) c¥iÕ/€EØ�I€Gð !¨°­
Õ#3Õ3€FàÒØŸ*™* Q›-×,Ñ,¨R°°A°qÓ9Õ9ˆà€Mr   c                óš   € V ^8„  d   QhR\         P                  R\        R\        \         P                  ,          R\         P                  /# ©r   r   r   r   r   ©r   r   r   r   )r   s   "r   r   r   �   sC   € ÷ cñ cÜ�<‰<ðcÜ%(ðcÜ<DÄUÇ\Á\Õ<Rðcä
‡\�\ñcr   c           
     ón  € \        V . RO4       Ve�   \        V\        P                  4      '       g   \	        R\        V4       24      h\        VP                  4      ^8X  d&   VP                  ^ 4      V P                  ^ 4      8w  d   \        RVP                   24      h\        W4      pVR,          pVR,          p\        V^,          R	R
4      p\        V^,          R	R
4      p\        WE,          R	R
4      pWg,           p	Wg,
          ^,          RV,          V,          ,           p
V
^ 8„  p\        P                  ! V\        P                  ! Wº\        P                  ! V
4      4      P                  4       R4      pRWœ,
          ,          pVe*   WÒP                  ^4      P!                  R^^^4      ,          pV# )aé  Compute the Shi-Tomasi corner response, the smaller eigenvalue of the windowed structure tensor.

``R = gftt_response(img)`` takes images ``(B, C, H, W)`` and returns the Shi-Tomasi ("good features to track")
response of every pixel of every channel, ``(B, C, H, W)``, without non-maxima suppression: large at a corner, near
zero along an edge and zero on a constant image. Unlike :func:`harris_response`, from the same structure tensor, it
has no ``k`` to tune. To pass it to a detector as ``resp_module``, use its module form :class:`CornerGFTT`; for
blobs, use :func:`hessian_response`.

.. image:: _static/img/gftt_response.png

The response map is computed according to the following formulation:

.. math::
    R = min(eig(M))

where :math:`M` is the windowed structure tensor of :func:`~kornia.feature.harris_response`, with the same
gradients and window.

Convention:
    - :math:`R` is not negative, up to roundoff. Along an edge, where it is near zero, the Harris response is
      negative.
    - Multiplying the image by ``c`` multiplies the response by ``c ** 2``, and an offset does not change it.
    - ``sigmas`` multiplies the response by ``sigmas ** 4``, the same power used by
      :func:`~kornia.feature.harris_response`. This is the function's scale-weighting convention, not a guarantee
      of scale invariance. The integration window :math:`W` stays fixed as the image blur changes; the response's
      decay with blur depends on the image structure, including the corner geometry.
    - Each channel is processed independently. The window extends its reflected border across short axes,
      including singleton pixels.

Args:
    input: input image with shape ``(B, C, H, W)``.
    grads_mode: can be ``'sobel'`` for standalone use or ``'diff'`` for use on Gaussian pyramid.
    sigmas: per-image scales with shape ``(B,)``. The response of image ``b`` is multiplied by
      ``sigmas[b] ** 4``, so that non-maxima suppression can compare the levels of a scale pyramid. Another type
      raises ``TypeError`` and another shape ``ValueError``.

Return:
    the response map per channel with shape ``(B, C, H, W)``.

See Also:
    - :class:`CornerGFTT`: the module form, with ``grads_mode`` fixed at construction.
    - :func:`harris_response`: the signed Harris measure of the same structure tensor, with a free ``k``.
    - :func:`hessian_response`: a blob response from second derivatives, without a window.
    - :class:`GFTTAffNetHardNet`: a :class:`ScaleSpaceDetector` on this response, with AffNet shapes and HardNet
      descriptors.

Example:
    >>> input = torch.tensor([[[
    ...    [0., 0., 0., 0., 0., 0., 0.],
    ...    [0., 1., 1., 1., 1., 1., 0.],
    ...    [0., 1., 1., 1., 1., 1., 0.],
    ...    [0., 1., 1., 1., 1., 1., 0.],
    ...    [0., 1., 1., 1., 1., 1., 0.],
    ...    [0., 1., 1., 1., 1., 1., 0.],
    ...    [0., 0., 0., 0., 0., 0., 0.],
    ... ]]])  # 1x1x7x7
    >>> # compute the response map; rounded for a platform-stable display
    >>> gftt_response(input).round(decimals=4) + 0.0
    tensor([[[[0.0379, 0.0456, 0.0283, 0.0121, 0.0283, 0.0456, 0.0379],
              [0.0456, 0.0598, 0.0402, 0.0168, 0.0402, 0.0598, 0.0456],
              [0.0283, 0.0402, 0.0545, 0.0245, 0.0545, 0.0402, 0.0283],
              [0.0121, 0.0168, 0.0245, 0.0276, 0.0245, 0.0168, 0.0121],
              [0.0283, 0.0402, 0.0545, 0.0245, 0.0545, 0.0402, 0.0283],
              [0.0456, 0.0598, 0.0402, 0.0168, 0.0402, 0.0598, 0.0456],
              [0.0379, 0.0456, 0.0283, 0.0121, 0.0283, 0.0456, 0.0379]]]])

r!   r"   g      @g        g      à?r#   r(   r*   r,   r.   r/   )r   r0   r   r   r1   r2   r3   r4   r5   r6   r	   r   ÚwhereÚ	ones_likeÚsqrtr7   r8   )r   r   r   r9   r:   r;   r<   r=   r>   r@   ÚdiscÚpositiveÚrootrA   s   &&&           r   Úgftt_responserM   �   sg  € ôL �uÒ2Ô3àÒÜ˜&¤%§,¡,×/Ò/ÜÐEÄdÈ6ÃlÀ^ÐTÓUÐUÜ�F—L‘LÓ! QÔ&¨F¯K©K¸«N¸e¿j¹jÈ»mÔ,KÜÐXÐY_×YeÑYeÐXfÐgÓhÐhä.¨uÓA€IØ  Õ)€BØ  Õ)€Bä'¨¨A­¨v°zÓB€CÜ'¨¨A­¨v°zÓB€CÜ'¨­°¸ÓD€Cà�I€Gð �)¨Õ)¨C°#­I¸­OÕ;€DØ�a‰x€HÜŸš X¬u¯{ª{¸8Ì5Ï?Ê?Ð[_ÓK`Ó/a×/fÑ/fÓ/hÐjmÓn€Dà '¥.Õ1€FàÒØŸ*™* Q›-×,Ñ,¨R°°A°qÓ9Õ9ˆà€Mr   c                óš   € V ^8„  d   QhR\         P                  R\        R\        \         P                  ,          R\         P                  /# rD   rE   )r   s   "r   r   r     sC   € ÷ ^ñ ^Ü�<‰<ð^Ü%(ð^Ü<DÄUÇ\Á\Õ<Rð^ä
‡\�\ñ^r   c                ó  € \        V . RO4       Ve�   \        V\        P                  4      '       g   \	        R\        V4       24      h\        VP                  4      ^8X  d&   VP                  ^ 4      V P                  ^ 4      8w  d   \        RVP                   24      h\        W^4      pVR,          pVR,          pVR,          pWF,          V^,          ,
          pVe*   WrP                  ^4      P                  R^^^4      ,          pV# )aÐ  Compute the blob response det(H) of the per-pixel Hessian, positive at bright and dark blobs alike.

``R = hessian_response(img)`` takes images ``(B, C, H, W)`` and returns the determinant of the Hessian of every
pixel of every channel, ``(B, C, H, W)``, without non-maxima suppression. Its module form :class:`BlobHessian` is
the default ``resp_module`` of :class:`ScaleSpaceDetector`. For a Difference-of-Gaussian response, which tells a
bright blob (a minimum) from a dark one (a maximum), use :func:`dog_response`; for corners,
:func:`harris_response` or :func:`gftt_response`.

.. image:: _static/img/hessian_response.png

The response map is computed according to the following formulation:

.. math::
    R = det(H)

where:

.. math::
    H =
    \begin{bmatrix}
        I_{xx} & I_{xy} \\
        I_{xy} & I_{yy} \\
    \end{bmatrix}

Convention:
    - :math:`R = I_{xx} I_{yy} - I_{xy}^2` is signed and pointwise, without a window: positive at bright and dark
      blobs alike, negative at a saddle. The second derivatives come from
      :func:`~kornia.filters.spatial_gradient` with ``mode=grads_mode`` and ``order=2``.
    - Multiplying the image by ``c`` multiplies the response by ``c ** 2``, and an offset does not change it.
    - Each channel is processed independently.

Args:
    input: input image with shape ``(B, C, H, W)``.
    grads_mode: can be ``'sobel'`` for standalone use or ``'diff'`` for use on Gaussian pyramid.
    sigmas: per-image scales with shape ``(B,)``. The response of image ``b`` is multiplied by
      ``sigmas[b] ** 4``, so that non-maxima suppression can compare the levels of a scale pyramid. Another type
      raises ``TypeError`` and another shape ``ValueError``.

Return:
    the response map per channel with shape ``(B, C, H, W)``.

Shape:
   - Input: ``(B, C, H, W)``
   - Output: ``(B, C, H, W)``

See Also:
    - :class:`BlobHessian`: the module form, with ``grads_mode`` fixed at construction.
    - :func:`dog_response`: a signed blob response of a scale stack, a minimum at a bright blob.
    - :func:`harris_response`: a corner response from first derivatives in a window.
    - :class:`ScaleSpaceDetector`: detects LAFs at the scale-space maxima of this response, its default.

Examples:
    >>> input = torch.tensor([[[
    ...    [0., 0., 0., 0., 0., 0., 0.],
    ...    [0., 1., 1., 1., 1., 1., 0.],
    ...    [0., 1., 1., 1., 1., 1., 0.],
    ...    [0., 1., 1., 1., 1., 1., 0.],
    ...    [0., 1., 1., 1., 1., 1., 0.],
    ...    [0., 1., 1., 1., 1., 1., 0.],
    ...    [0., 0., 0., 0., 0., 0., 0.],
    ... ]]])  # 1x1x7x7
    >>> # compute the response map; rounded for a platform-stable display
    >>> hessian_response(input).round(decimals=4) + 0.0
    tensor([[[[-0.0137, -0.0332, -0.0205,  0.0000, -0.0205, -0.0332, -0.0137],
              [-0.0332,  0.0098,  0.0381,  0.0000,  0.0381,  0.0098, -0.0332],
              [-0.0205,  0.0381,  0.0547,  0.0000,  0.0547,  0.0381, -0.0205],
              [ 0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000],
              [-0.0205,  0.0381,  0.0547,  0.0000,  0.0547,  0.0381, -0.0205],
              [-0.0332,  0.0098,  0.0381,  0.0000,  0.0381,  0.0098, -0.0332],
              [-0.0137, -0.0332, -0.0205,  0.0000, -0.0205, -0.0332, -0.0137]]]])

r!   r"   r#   r(   r*   )r)   r)   r   r/   )r   r0   r   r   r1   r2   r3   r4   r5   r6   r	   r7   r8   )r   r   r   r9   Údxxr>   ÚdyyrA   s   &&&     r   Úhessian_responserR     sç   € ôV �uÒ2Ô3àÒÜ˜&¤%§,¡,×/Ò/ÜÐEÄdÈ6ÃlÀ^ÐTÓUÐUä�F—L‘LÓ! QÔ&¨F¯K©K¸«N¸e¿j¹jÈ»mÔ,KÜÐXÐY_×YeÑYeÐXfÐgÓhÐhä.¨uÀ!ÓD€IØ! 'Õ*€CØ! 'Õ*€CØ! 'Õ*€Cà�9 s¨A¥vÕ-€FàÒØŸ*™* Q›-×,Ñ,¨R°°A°qÓ9Õ9ˆà€Mr   c                óX   € V ^8„  d   QhR\         P                  R\         P                  /# )r   r   r   ©r   r   )r   s   "r   r   r   d  s"   € ÷ .ñ .œŸ™ð .¬¯©ñ .r   c                óV   € \        V . RO4       V R,          V RRRR13,          ,
          # )aè  Compute Difference-of-Gaussian responses between adjacent levels of a (B, C, D, H, W) scale stack.

``R = dog_response(stack)`` takes a Gaussian scale stack ``(B, C, D, H, W)``, with its ``D`` levels along dim 2, and
returns the differences of adjacent levels, ``(B, C, D - 1, H, W)``. An octave of
:class:`~kornia.geometry.transform.ScalePyramid` is such a stack; to detect at the extrema, pass the module form
:class:`BlobDoG` to :class:`ScaleSpaceDetector` with ``scale_space_response=True`` and
``minima_are_also_good=True``. For the DoG of one image at two given blurs, use :func:`dog_response_single`.

Convention:
    - Output level ``i`` is ``input[:, :, i + 1] - input[:, :, i]`` along the level axis ``D`` (dim 2), so ``D``
      levels give ``D - 1``. For a stack blurred from fine to coarse, this is Lowe's
      :math:`L(k\sigma) - L(\sigma)`: negative at a bright blob, positive at a dark one.

Args:
    input: a Gaussian scale stack ``(B, C, D, H, W)``, its levels along ``D``.

Return:
    the response map per channel with shape ``(B, C, D - 1, H, W)``.

See Also:
    - :class:`BlobDoG`: the module form, to pass to :class:`ScaleSpaceDetector` as ``resp_module``.
    - :func:`dog_response_single`: the DoG of a ``(B, C, H, W)`` image, blurred at two given sigmas.
    - :func:`hessian_response`: a blob response of one image, positive at blobs of both polarities.
    - :class:`~kornia.geometry.transform.ScalePyramid`: builds the scale stacks, one ``(B, C, L, H_o, W_o)`` per
      octave.

r)   N)r$   r%   ÚLr&   r'   )r)   r)   :r+   NNr/   r   )r   s   &r   Údog_responserW   d  s-   € ô8 �uÒ7Ô8à��?˜U 1 a¨¨"¨ 9Õ-Õ-Ð-r   c                óp   € V ^8„  d   QhR\         P                  R\        R\        R\         P                  /# )r   r   Úsigma1Úsigma2r   )r   r   r   )r   s   "r   r   r   …  s3   € ÷ &ñ &œuŸ|™|ð &´Uð &Ì%ð &ÔZ_×ZfÑZfñ &r   c                ó–   € \        V . RO4       \        V4      p\        V4      p\        WV3W34      p\        WV3W"34      pWe,
          # )ao  Compute the Difference-of-Gaussian response of a (B, C, H, W) image, its sigma2 blur minus its sigma1 blur.

``R = dog_response_single(img, sigma1, sigma2)`` takes images ``(B, C, H, W)`` and returns, per channel, their
Gaussian blur of ``sigma2`` minus their blur of ``sigma1``, ``(B, C, H, W)``: for ``sigma2 > sigma1``, negative at
a bright blob and positive at a dark one. It blurs the image itself, so it needs no scale stack; for the
differences of adjacent levels of a precomputed stack, use :func:`dog_response`. Its module form is
:class:`BlobDoGSingle`.

.. image:: _static/img/dog_response_single.png

Convention:
    - Returns the Gaussian blur of ``sigma2`` minus that of ``sigma1``, the order of
      :func:`~kornia.feature.dog_response`; see its Convention block. Each kernel has the size
      ``int(8 * sigma + 1)``, rounded up to an odd number. The order of ``sigma1`` and ``sigma2`` is not checked:
      swapping them flips the sign.
    - Both blurs extend reflected borders across short axes, including singleton pixels.

Args:
    input: images ``(B, C, H, W)``.
    sigma1: lower gaussian sigma
    sigma2: bigger gaussian sigma

Return:
    the response map per channel with shape ``(B, C, H, W)``.

See Also:
    - :class:`BlobDoGSingle`: the module form, with ``sigma1`` and ``sigma2`` fixed at construction.
    - :func:`dog_response`: the differences of adjacent levels of a ``(B, C, D, H, W)`` scale stack.
    - :func:`hessian_response`: a blob response that is positive at blobs of both polarities.
    - :class:`SIFTFeature`: detects at the maxima of this response's magnitude on each level of an image pyramid.

r#   )r   r   r   )r   rY   rZ   Úks1Úks2Úg1Úg2s   &&&    r   Údog_response_singler`   …  sQ   € ôB �uÒ2Ô3Ü
˜6Ó
"€CÜ
˜6Ó
"€CÜ	˜ c 
¨VÐ,<Ó	=€BÜ	˜ c 
¨VÐ,<Ó	=€BØ�7€Nr   c                   ój   a a€ ] tR tRt oRtV3R lV 3R lltV3R lR ltR
V3R lR lltR	tVt	V ;t
# )ÚBlobDoGi®  a¼  Compute Difference-of-Gaussian responses of a (B, C, D, H, W) scale stack; the module form of dog_response.

``R = BlobDoG()(stack, sigmas)`` returns ``dog_response(stack)``, the ``(B, C, D - 1, H, W)`` differences of
adjacent levels, and ignores ``sigmas``. It is the ``resp_module`` that :class:`ScaleSpaceDetector` takes with
``scale_space_response=True``; since a bright blob is a DoG minimum, pass ``minima_are_also_good=True`` too, as
:class:`DoGHardNet` and the ``"patch"`` backend of :class:`SIFTFeatureScaleSpace` do. For the DoG of one image at
two given blurs, use :class:`BlobDoGSingle` instead.

Convention:
    Returns :func:`~kornia.feature.dog_response` of the ``(B, C, D, H, W)`` scale stack; see its Convention
    block.

See Also:
    - :func:`dog_response`: the function form.
    - :class:`BlobDoGSingle`: the DoG of a ``(B, C, H, W)`` image at two sigmas fixed at construction.
    - :class:`BlobHessian`: a per-level blob response, positive at blobs of both polarities.
    - :class:`ScaleSpaceDetector`: detects LAFs at the extrema of this response over its scale pyramid.
    - :class:`SIFTFeatureScaleSpace`: a SIFT preset whose ``"patch"`` backend is that detector on this response.

c                ó   <€ V ^8„  d   QhRR/# )r   r   N© )r   Ú__classdict__s   "€r   r   ÚBlobDoG.__annotate__Ä  s   ø€ ÷ ñ ˜$ñ r   c                ó$   <€ \         SV `  4        R # ©N)ÚsuperÚ__init__)ÚselfÚ	__class__s   &€r   rj   ÚBlobDoG.__init__Ä  s   ø€ Ü‰ÑÖr   c                ó    <€ V ^8„  d   QhRS[ /# ©r   r   ©r   )r   re   s   "€r   r   rf   Ç  s   ø€ ÷ 'ñ '™#ñ 'r   c                ó.   € V P                   P                  # rh   )rl   Ú__name__©rk   s   &r   Ú__repr__ÚBlobDoG.__repr__Ç  s   € Ø�~‰~×&Ñ&Ð&r   c                óx   <€ V ^8„  d   QhRS[ P                  RS[S[ P                  ,          RS[ P                  /# ©r   r   r   r   ©r   r   r   )r   re   s   "€r   r   rf   Ê  s6   ø€ ÷ 
#ñ 
#™UŸ\™\ð 
#±8¹E¿L¹LÕ3Ið 
#ÑUZ×UaÑUañ 
#r   c                ó   € \        V4      # )zîCompute Difference-of-Gaussians response maps.

Args:
    input: Input scale stack of shape ``(B, C, D, H, W)``.
    sigmas: Unused in this wrapper; kept for API compatibility.

Returns:
    DoG response tensor from :func:`dog_response`.
)rW   ©rk   r   r   s   &&&r   ÚforwardÚBlobDoG.forwardÊ  s   € ô ˜EÓ"Ð"r   rd   rh   ©rr   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__rj   rt   r{   Ú__static_attributes__Ú__classdictcell__Ú__classcell__©rl   re   s   @@r   rb   rb   ®  s-   ù‡ € ñ÷*ó ÷'ð '÷
#÷ 
#ò 
#r   rb   c                   ón   a a€ ] tR tRt oRtR
V3R lV 3R llltV3R lR ltRV3R lR lltR	tVt	V ;t
# )ÚBlobDoGSinglei×  a  Compute the Difference-of-Gaussian response of a (B, C, H, W) image; the module form of dog_response_single.

``R = BlobDoGSingle(sigma1, sigma2)(img, sigmas)`` returns ``dog_response_single(img, sigma1, sigma2)``, the
``(B, C, H, W)`` blur of ``sigma2`` minus the blur of ``sigma1``, and ignores ``sigmas``. Passed to
:class:`MultiResolutionDetector`, which keeps maxima only, it misses the centres of bright blobs, the DoG minima:
:class:`SIFTFeature` passes its magnitude instead. For the DoG of a whole scale stack, use :class:`BlobDoG`.

.. image:: _static/img/dog_response_single.png

Convention:
    Returns :func:`~kornia.feature.dog_response_single` with the constructor's ``sigma1`` and ``sigma2``; see its
    Convention block.

See Also:
    - :func:`dog_response_single`: the function form, with the sigmas passed on each call.
    - :class:`BlobDoG`: the DoG between adjacent levels of a ``(B, C, D, H, W)`` scale stack.
    - :class:`MultiResolutionDetector`: detects LAFs at the maxima of a per-image response on an image pyramid.

c                ó*   <€ V ^8„  d   QhRS[ RS[ RR/# )r   rY   rZ   r   N)r   )r   re   s   "€r   r   ÚBlobDoGSingle.__annotate__ì  s"   ø€ ÷ ñ ™uð ±Eð ÀDñ r   c                ó<   <€ \         SV `  4        Wn        W n        R # rh   )ri   rj   rY   rZ   )rk   rY   rZ   rl   s   &&&€r   rj   ÚBlobDoGSingle.__init__ì  s   ø€ Ü‰ÑÔØŒØŽr   c                ó    <€ V ^8„  d   QhRS[ /# ro   rp   )r   re   s   "€r   r   r‰   ñ  s   ø€ ÷ Xñ X™#ñ Xr   c                óh   € V P                   P                   R V P                   RV P                   R2# )z(sigma1=z	, sigma2=Ú))rl   rr   rY   rZ   rs   s   &r   rt   ÚBlobDoGSingle.__repr__ñ  s/   € Ø—.‘.×)Ñ)Ð*¨(°4·;±;°-¸yÈÏÉÈÐUVÐWÐWr   c                óx   <€ V ^8„  d   QhRS[ P                  RS[S[ P                  ,          RS[ P                  /# rw   rx   )r   re   s   "€r   r   r‰   ô  s;   ø€ ÷ Dñ D™UŸ\™\ð D±8¹E¿L¹LÕ3Ið DÑUZ×UaÑUañ Dr   c                óB   € \        WP                  V P                  4      # )a  Compute single-scale Difference-of-Gaussians response.

Args:
    input: Input tensor of shape ``(B, C, H, W)``.
    sigmas: Unused in this wrapper; kept for API compatibility.

Returns:
    Response tensor from :func:`dog_response_single` using stored
    ``sigma1`` and ``sigma2``.
)r`   rY   rZ   rz   s   &&&r   r{   ÚBlobDoGSingle.forwardô  s   € ô # 5¯+©+°t·{±{ÓCÐCr   )rY   rZ   ©r   gš™™™™™ù?rh   r}   r…   s   @@r   r‡   r‡   ×  s2   ù‡ € ñ÷(õ ÷
Xð X÷D÷ Dò Dr   r‡   c                   óz   a a€ ] tR tRt oRtRV3R lV 3R llltV3R lR ltRV3R lR lltV3R	 ltR
t	Vt
V ;t# )ÚCornerHarrisi  a&  Compute the Harris corner response with a fixed k; the module form of harris_response.

``R = CornerHarris(k)(img, sigmas)`` returns ``harris_response(img, k, grads_mode, sigmas)``, the ``(B, C, H, W)``
Harris response of ``(B, C, H, W)`` images, positive at a corner. ``k`` is stored as a buffer, so it moves with
:meth:`torch.nn.Module.to`. Pass it to :class:`ScaleSpaceDetector` as ``resp_module`` to detect corners over
scale; for a response with no ``k`` to choose, use :class:`CornerGFTT` instead.

.. image:: _static/img/harris_response.png

Convention:
    Returns :func:`~kornia.feature.harris_response` with the constructor's ``k`` and ``grads_mode``; see its
    Convention block. Unlike the function's, this ``k`` has no default. A ``float``, ``int`` or NumPy scalar
    ``k`` becomes a 0-dimensional float32 tensor, and a float64 image uses the number itself while the buffer
    still holds it; a tensor is stored as it is.

See Also:
    - :func:`harris_response`: the function form, with ``k`` defaulting to ``0.04``.
    - :class:`CornerGFTT`: the Shi-Tomasi corner response of the same structure tensor, without ``k``.
    - :class:`BlobHessian`: the Hessian-determinant blob response.
    - :class:`ScaleSpaceDetector`: detects LAFs at the scale-space maxima of a response module such as this one.

c                óT   <€ V ^8„  d   QhRS[ S[S[P                  3,          RS[RR/# )r   r   r   r   N)r   r   r   r   r   )r   re   s   "€r   r   ÚCornerHarris.__annotate__  s1   ø€ ÷ 
*ñ 
*™%¡¡u§|¡|Ð 3Õ4ð 
*Á#ð 
*ÐTXñ 
*r   c                óN  <€ \         SV `  4        R V n        \        V\        P
                  4      '       dW   \        V\        4      '       gA   \        V4      V n        V P                  R\        P                  ! \        V4      4      4       MV P                  RV4       W n        R # )Nr   )ri   rj   Ú	_k_numberr0   ÚnumbersÚRealÚboolr   Úregister_bufferr   Útensorr   )rk   r   r   rl   s   &&&€r   rj   ÚCornerHarris.__init__  so   ø€ Ü‰ÑÔà*.ˆŒÜ�aœŸ™×&Ò&¬z¸!¼T×/BÒ/Bä" 1›XˆDŒNØ× Ñ  ¤e§l¢l´5¸³8Ó&<Õ=à× Ñ   aÔ(Ø)Žr   c                ó    <€ V ^8„  d   QhRS[ /# ro   rp   )r   re   s   "€r   r   r—   (  s   ø€ ÷ Vñ V™#ñ Vr   c                óh   € V P                   P                   R V P                   RV P                   R2# )z(k=z, grads_mode=rŽ   )rl   rr   r   r   rs   s   &r   rt   ÚCornerHarris.__repr__(  s0   € Ø—.‘.×)Ñ)Ð*¨#¨d¯f©f¨X°]À4Ç?Á?ÐBSÐSTÐUÐUr   c                óx   <€ V ^8„  d   QhRS[ P                  RS[S[ P                  ,          RS[ P                  /# rw   rx   )r   re   s   "€r   r   r—   +  s;   ø€ ÷ Bñ B™UŸ\™\ð B±8¹E¿L¹LÕ3Ið BÑUZ×UaÑUañ Br   c                ó¦  € V P                   pV P                  P                  R4      pVEe   VP                  \        P
                  8X  dñ   VP                  4       '       dÛ   \        P                  ! V4      P                  VP                  VP                  R7      p\        P                  ! V.\        P
                  VP                  R7      pVP                  \        P
                  4      p\        P                  ! W58H  WgVP                  4       ,
          ,           V4      P                  VP                  4      p\        WV P                  V4      # )a!  Compute Harris corner response for each input channel.

Args:
    input: Input tensor of shape ``(B, C, H, W)``.
    sigmas: Optional per-image scales forwarded to :func:`harris_response`, which multiplies the
        response by ``sigmas ** 4``.

Returns:
    Harris response map tensor.
r™   )ÚdeviceÚdtype)r¦   r¥   )r   Ú__dict__Úgetr¦   r   Úfloat64Úis_floating_pointrž   Útor¥   rG   ÚdetachÚreshaper4   rB   r   )rk   r   r   r   ÚnumberÚbuiltÚexactÚk64s   &&&     r   r{   ÚCornerHarris.forward+  sß   € ð �F‰FˆØ—‘×"Ñ" ;Ó/ˆØÓ %§+¡+´·±Ô">À1×CVÑCV×CXÒCXä—L’L Ó(×+Ñ+°1·8±8À1Ç7Á7Ð+ÓKˆEä—L’L & ´·±ÀqÇxÁxÔPˆEØ—$‘$”u—}‘}Ó%ˆCä—’˜A™J¨°s·z±z³|Õ1CÕ(DÀcÓJ×RÑRÐST×SZÑSZÓ[ˆAÜ˜u¨¯©¸&ÓAÐAr   c                ó:   <€ V ^8„  d   Qh/ S[ P                  ;R&   # )r   r   rT   )r   re   s   "€r   r   r—     s   ø‡ ‚ ñ0 ‡|�|�Oò1 r   )r™   r   ©Úsobelrh   )rr   r~   r   r€   r�   rj   rt   r{   Ú__annotate_func__r‚   rƒ   r„   r…   s   @@r   r•   r•     s4   ù‡ € ñ÷2
*õ 
*÷Vð V÷Bò B÷S … r   r•   c                   ón   a a€ ] tR tRt oRtR
V3R lV 3R llltV3R lR ltRV3R lR lltR	tVt	V ;t
# )Ú
CornerGFTTiC  aÝ  Compute the Shi-Tomasi corner response; the module form of gftt_response.

``R = CornerGFTT()(img, sigmas)`` returns ``gftt_response(img, grads_mode, sigmas)``, the ``(B, C, H, W)``
smaller structure-tensor eigenvalue of ``(B, C, H, W)`` images, large at a corner. Pass it to
:class:`ScaleSpaceDetector` as ``resp_module`` to detect corners over scale, as :class:`GFTTAffNetHardNet` does;
for the signed Harris measure, use :class:`CornerHarris` instead.

.. image:: _static/img/gftt_response.png

Convention:
    Returns :func:`~kornia.feature.gftt_response` with the constructor's ``grads_mode``; see its Convention block.

See Also:
    - :func:`gftt_response`: the function form.
    - :class:`CornerHarris`: the Harris corner response of the same structure tensor, with a free ``k``.
    - :class:`BlobHessian`: the Hessian-determinant blob response.
    - :class:`GFTTAffNetHardNet`: a :class:`ScaleSpaceDetector` on this response, with AffNet shapes and HardNet
      descriptors.

c                ó$   <€ V ^8„  d   QhRS[ RR/# ©r   r   r   Nrp   )r   re   s   "€r   r   ÚCornerGFTT.__annotate__Y  ó   ø€ ÷ *ñ *¡3ð *°Tñ *r   c                ó0   <€ \         SV `  4        Wn        R # rh   ©ri   rj   r   ©rk   r   rl   s   &&€r   rj   ÚCornerGFTT.__init__Y  ó   ø€ Ü‰ÑÔØ)Žr   c                ó    <€ V ^8„  d   QhRS[ /# ro   rp   )r   re   s   "€r   r   r»   ]  ó   ø€ ÷ Jñ J™#ñ Jr   c                óN   € V P                   P                   R V P                   R2# ©z(grads_mode=rŽ   ©rl   rr   r   rs   s   &r   rt   ÚCornerGFTT.__repr__]  ó%   € Ø—.‘.×)Ñ)Ð*¨,°t·±Ð6GÀqÐIÐIr   c                óx   <€ V ^8„  d   QhRS[ P                  RS[S[ P                  ,          RS[ P                  /# rw   rx   )r   re   s   "€r   r   r»   `  s6   ø€ ÷ =ñ =™UŸ\™\ð =±8¹E¿L¹LÕ3Ið =ÑUZ×UaÑUañ =r   c                ó.   € \        WP                  V4      # )a1  Compute Shi-Tomasi (GFTT) corner response maps.

Args:
    input: Input tensor of shape ``(B, C, H, W)``.
    sigmas: Optional per-image scales forwarded to :func:`gftt_response`, which multiplies the
        response by ``sigmas ** 4``.

Returns:
    GFTT response map tensor from :func:`gftt_response`.
)rM   r   rz   s   &&&r   r{   ÚCornerGFTT.forward`  s   € ô ˜U§O¡O°VÓ<Ð<r   ©r   r´   rh   r}   r…   s   @@r   r¸   r¸   C  s/   ù‡ € ñ÷**õ *÷Jð J÷=÷ =ò =r   r¸   c                   ón   a a€ ] tR tRt oRtR
V3R lV 3R llltV3R lR ltRV3R lR lltR	tVt	V ;t
# )ÚBlobHessianin  a�  Compute the Hessian-determinant blob response; the module form of hessian_response.

``R = BlobHessian()(img, sigmas)`` returns ``hessian_response(img, grads_mode, sigmas)``, the ``(B, C, H, W)``
Hessian determinant of ``(B, C, H, W)`` images, positive at bright and dark blobs alike. It is the default
``resp_module`` of :class:`ScaleSpaceDetector`, which passes each level's sigma so that the levels compare. For a
DoG response over a scale stack, use :class:`BlobDoG`; for corners, :class:`CornerGFTT` or :class:`CornerHarris`.

.. image:: _static/img/hessian_response.png

Convention:
    Returns :func:`~kornia.feature.hessian_response` with the constructor's ``grads_mode``; see its Convention
    block.

See Also:
    - :func:`hessian_response`: the function form.
    - :class:`BlobDoG`: the DoG blob response of a scale stack, a minimum at a bright blob.
    - :class:`CornerGFTT`: a corner response, the smaller structure-tensor eigenvalue.
    - :class:`ScaleSpaceDetector`: detects LAFs at the scale-space maxima of this response, its default.
    - :class:`HesAffNetHardNet`: that detector on this response, with AffNet shapes and HardNet descriptors.

c                ó$   <€ V ^8„  d   QhRS[ RR/# rº   rp   )r   re   s   "€r   r   ÚBlobHessian.__annotate__…  r¼   r   c                ó0   <€ \         SV `  4        Wn        R # rh   r¾   r¿   s   &&€r   rj   ÚBlobHessian.__init__…  rÁ   r   c                ó    <€ V ^8„  d   QhRS[ /# ro   rp   )r   re   s   "€r   r   rÐ   ‰  rÃ   r   c                óN   € V P                   P                   R V P                   R2# rÅ   rÆ   rs   s   &r   rt   ÚBlobHessian.__repr__‰  rÈ   r   c                óx   <€ V ^8„  d   QhRS[ P                  RS[S[ P                  ,          RS[ P                  /# rw   rx   )r   re   s   "€r   r   rÐ   Œ  s;   ø€ ÷ @ñ @™UŸ\™\ð @±8¹E¿L¹LÕ3Ið @ÑUZ×UaÑUañ @r   c                ó.   € \        WP                  V4      # )a  Compute Hessian determinant-like blob responses.

Args:
    input: Input tensor of shape ``(B, C, H, W)``.
    sigmas: Optional per-image scales forwarded to :func:`hessian_response`, which multiplies the
        response by ``sigmas ** 4``.

Returns:
    Hessian response map tensor.
)rR   r   rz   s   &&&r   r{   ÚBlobHessian.forwardŒ  s   € ô   §¡¸Ó?Ð?r   rÌ   r´   rh   r}   r…   s   @@r   rÎ   rÎ   n  s2   ù‡ € ñ÷,*õ *÷Jð J÷@÷ @ò @r   rÎ   )g{®Gáz¤?rµ   N)rµ   Nr“   )rš   Útypingr   r   r   r   Úkornia.core.checkr   Úkornia.filtersr   r	   r   rB   rM   rR   rW   r`   ÚModulerb   r‡   r•   r¸   rÎ   rd   r   r   Ú<module>rÝ      s™   ðó$ ß "ã Ý å 0ß <õ	÷r÷jc÷L^õB.÷B&ôR&#ˆb�i‰iô &#ôR(D�B—I‘Iô (DôV>B�2—9‘9ô >BôB(=�—‘ô (=ôV)@�"—)‘)ö )@r   