+
    åûj—�  ã                   óÀ   € R t ^ RIt^ RIHtHtHt ^ RIt^ RIHt ^ RI	H
t
HtHtHt ^ RIHtHt ^ RIHt R R lt ! R	 R
4      t ! R R]4      tR R ltRR R lltR# )znPinhole cameras with extrinsics: project world points to pixels and back, and the dense helpers that use them.N)ÚIterableÚListÚUnion©ÚKORNIA_CHECK_SAME_DEVICE)Ú_autocast_disabledÚ_reconcile_under_autocastÚ_torch_inverse_castÚis_compiling)Úconvert_points_from_homogeneousÚconvert_points_to_homogeneous)Útransform_pointsc                óX   € V ^8„  d   QhR\         P                  R\         P                  /# )é   Úcamera_matrixÚreturn©ÚtorchÚTensor)Úformats   "ÚZC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\kornia\geometry\camera\pinhole.pyÚ__annotate__r      s"   € ÷ ñ ¤U§\¡\ð ´e·l±lñ ó    c                ó`   € V P                   ! . V P                  RR O^N^N5!  pWR&   RVR&   V# )z:Embed a (..., 3, 3) camera matrix in homogeneous 4x4 form.Nç      ð?éþÿÿÿ©.ºNé   Nr   ©.r   r   )Ú	new_zerosÚshape)r   Ú
intrinsicss   & r   Ú_embed_intrinsicsr#      sD   € à×(Ò(ÐI¨-×*=Ñ*=¸c¸rÐ*BÐIÀAÐIÀqÓI€JØ+ˆ{ÑØ€JˆyÑØÐr   c                   ój  a € ] tR t^'t o RtV 3R lR lt]V 3R lR l4       t]V 3R lR l4       t]V 3R lR	 l4       t	]V 3R
 lR l4       t
V 3R lR lt]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]P*                  V 3R lR l4       t]V 3R  lR! l4       t]P*                  V 3R" lR# l4       t]V 3R$ lR% l4       t]P*                  V 3R& lR' l4       t]V 3R( lR) l4       t]V 3R* lR+ l4       t]V 3R, lR- l4       t]V 3R. lR/ l4       tV 3R0 lR1 ltV 3R2 lR3 ltV 3R4 lR5 ltV 3R6 lR7 ltV 3R8 lR9 lt V 3R: lR; lt!V 3R< lR= lt"]#V 3R> lR? l4       t$R@t%V t&RA# )BÚPinholeCameraaa  Model a batch of pinhole cameras with extrinsics: world points to pixels and back.

``cam = PinholeCamera(intrinsics, extrinsics, height, width)`` stores ``B`` cameras: ``(B, 4, 4)`` intrinsics,
``(B, 4, 4)`` world-to-camera extrinsics and the ``(B,)`` image height and width. ``uv = cam.project(points)``
takes world points ``(B, N, 3)``, camera ``b`` projecting ``points[b]``, and returns their pixels
``(B, N, 2)``; ``points = cam.unproject(uv, depth)`` takes pixels ``(B, N, 2)`` and their camera-frame depths
``(B, N, 1)`` and returns world points ``(B, N, 3)``. For camera-frame points and a ``3x3`` ``K`` without
extrinsics, use :func:`~kornia.geometry.camera.perspective.project_points` and
:func:`~kornia.geometry.camera.perspective.unproject_points` instead.

Convention:
    - ``intrinsics`` is the ``(B, 4, 4)`` calibration matrix whose top-left :math:`3 \times 3` block is
      ``[[fx, 0, cx], [0, fy, cy], [0, 0, 1]]``, and ``extrinsics`` the ``(B, 4, 4)`` **world-to-camera**
      transform ``[R | t]`` (OpenCV / COLMAP semantics): :meth:`project` computes ``K (R X + t)`` of
      **world** points, and :meth:`unproject` returns **world** points. The functional API takes a ``3x3``
      ``K`` and no extrinsics, so it works in the **camera** frame.
    - a caller's autocast region does not change :meth:`project` and :meth:`unproject`; in it, intrinsics and
      extrinsics that mix float32 and half dtypes run in float32. Under ``torch.compile`` on MPS it still does
      (torch ignores the nested guard there).
    - with ``B > 1`` cameras the points of :meth:`project`, ``(B, N, 3)`` or ``(B, H, W, 3)``, and the pixels
      of :meth:`unproject`, ``(B, N, 2)`` or ``(B, H, W, 2)``, need a leading axis of size ``B`` and at least
      three dimensions: ``(N, 3)`` and ``(1, N, 3)`` points, or ``(N, 2)`` and ``(1, N, 2)`` pixels, raise
      :class:`ValueError`. A single camera (``B = 1``) takes any ``(*, N, 3)`` points or ``(*, N, 2)`` pixels
      with at least two dimensions.
    - pixel coordinates are ``(u, v)`` = (column, row) with **integer pixel centres**: pixel ``(0, 0)`` is
      centred at ``(0, 0)``, as :func:`~kornia.geometry.grid.create_meshgrid` enumerates, so a centred image
      has ``cx = (W - 1) / 2``, ``cy = (H - 1) / 2``. COLMAP's half-pixel convention reports the same
      principal point half a pixel larger. ``kornia.geometry.camera``, ``kornia.geometry.depth`` and
      ``kornia.geometry.calibration`` all use this convention; see :doc:`/get-started/camera-conventions`.
    - ``depth`` is the camera-frame ``z``, except where a ``normalize`` / ``normalize_points`` flag reads it
      as the Euclidean ray length.
    - the class owns copies of the tensors it is constructed from: :meth:`scale_` and the ``tx`` / ``ty`` /
      ``tz`` setters update only the camera, and :meth:`scale` and :meth:`clone` return independent cameras.

.. warning::
    :meth:`scale` and :meth:`scale_` rescale the principal point as ``cx' = s * cx`` (the half-pixel rule),
    which disagrees with the integer pixel centres above:
    `#4263 <https://github.com/kornia/kornia/issues/4263>`_. ``(B, N, 4, 4)`` storage is
    deprecated and will be rejected in a future release:
    `#4266 <https://github.com/kornia/kornia/issues/4266>`_. The ``intrinsics`` form is not validated, but
    :meth:`project`, :meth:`unproject`, :meth:`intrinsics_inverse` and
    :class:`~kornia.geometry.depth.DepthWarper` read only the top-left :math:`3 \times 3` block, so a
    zero-padded ``K`` behaves like its homogeneous embedding.

Args:
    intrinsics: torch.Tensor with shape ``(B, 4, 4)``
      containing the full 4x4 camera calibration matrix. Pass ``(B, 4, 4)``:
      ``(B, N, 4, 4)`` is deprecated, and :meth:`project` and :meth:`unproject` never supported it.
      ``PinholeCamerasList`` still stores that layout internally.
    extrinsics: torch.Tensor with shape ``(B, 4, 4)``
      containing the full 4x4 rotation-translation matrix, checked by the same predicate.
    height: torch.Tensor with shape ``(B)`` containing the image height.
    width: torch.Tensor with shape ``(B)`` containing the image width.

.. note::
    We assume that the class attributes are in batch form in order to take
    advantage of PyTorch parallelism to boost computing performance.

See Also:
    - :func:`~kornia.geometry.camera.perspective.project_points`: camera-frame points and a ``(*, 3, 3)`` ``K``,
      with no extrinsics.
    - :func:`~kornia.geometry.camera.perspective.unproject_points`: pixels at given depths to camera-frame
      points with a ``(*, 3, 3)`` ``K``.
    - :func:`pixel2cam`, :func:`cam2pixel`: the two halves of a dense reprojection, a depth map to camera-frame
      points and those to another camera's pixels, with this class's ``(B, 4, 4)`` matrices.
    - :class:`~kornia.geometry.depth.DepthWarper`: warps an image between two of these cameras by depth.
    - :class:`~kornia.geometry.camera.stereo.StereoCamera`: a rectified stereo pair, from its two ``(B, 3, 4)``
      projection matrices.
    - :class:`~kornia.sensors.camera.CameraModel`: the experimental camera-model API, with lens distortion and
      flat parameter vectors but no extrinsics.

c          
      ó†   <€ V ^8„  d   QhRS[ P                  RS[ P                  RS[ P                  RS[ P                  RR/# )r   r"   Ú
extrinsicsÚheightÚwidthr   Nr   )r   Ú__classdict__s   "€r   r   ÚPinholeCamera.__annotate__q   sG   ø€ ÷ <ñ <ÙŸ,™,ð<Ù49·L±Lð<ÙJOÏ,É,ð<Ù_d×_kÑ_kð<à	ñ<r   c                óà  € V P                  WW4.4       V P                  VR 4       V P                  VR4       VP                  4       ^8H  ;'       g    VP                  4       ^8H  pV'       dv   \        P                  P                  4       '       gR   \        P                  P                  4       '       g.   \        4       '       g   \        P                  ! R\        ^R7       V P                  VR4       V P                  VR4       V P                  WW4.4       VP                  4       V n        VP                  4       V n        VP                  4       V n        VP                  4       V n        R# )r"   r'   a�  Passing (B, N, 4, 4) `intrinsics` or `extrinsics` to `PinholeCamera` is deprecated since kornia 0.9.1 and will raise a ValueError in a future release: `project` and `unproject` support only (B, 4, 4). Flatten the cameras into the batch dimension, for example `intrinsics.reshape(-1, 4, 4)` and `extrinsics.reshape(-1, 4, 4)` (expanding a (B, 4, 4) matrix across N first), and repeat `height` and `width` to match.)Ú
stacklevelr(   r)   N)Ú_check_validÚ_check_valid_paramsÚdimr   ÚjitÚis_scriptingÚ
is_tracingr
   ÚwarningsÚwarnÚDeprecationWarningÚ_check_valid_shapeÚ_check_consistent_deviceÚcloner(   r)   Ú_intrinsicsÚ_extrinsics)Úselfr"   r'   r(   r)   Úis_rank4s   &&&&& r   Ú__init__ÚPinholeCamera.__init__q   s  € ð 	×Ñ˜:°6ÐAÔBØ× Ñ  ¨\Ô:Ø× Ñ  ¨\Ô:Ø—>‘>Ó# qÑ(×AÐA¨J¯N©NÓ,<ÀÑ,AˆßœEŸI™I×2Ñ2×4Ò4¼U¿Y¹Y×=QÑ=Q×=SÒ=SÔ\h×\jÒ\jÜ�MŠMðTô
 #Øõð 	×Ñ ¨Ô1Ø×Ñ  wÔ/Ø×%Ñ% z¸vÐ&MÔNà$*§L¡L£NˆŒØ#(§;¡;£=ˆŒ
Ø)3×)9Ñ)9Ó);ˆÔØ)3×)9Ñ)9Ó);ˆÖr   c                óJ   <€ V ^8„  d   QhRS[ S[P                  ,          RS[/# )r   Ú	data_iterr   )r   r   r   Úbool)r   r*   s   "€r   r   r+   �   s$   ø€ ÷ ñ ¡©¯©Õ 6ð ¹4ñ r   c                óì   a€ V  Uu. uF  qP                   ^ ,          NK  	  upo\        ;QJ d    V3R lS 4       F  '       d   K   RM	  RM! V3R lS 4       4      '       g   \        R4      hR# u upi )é    c              3   ó:   <"  € T F  qS^ ,          8H  x € K  	  R# 5i©rD   N© )Ú.0Ú
batch_sizeÚbatch_sizess   & €r   Ú	<genexpr>Ú-PinholeCamera._check_valid.<locals>.<genexpr>�   s   øé € ÐNÁ+°J ¨Q¥Ö/Ã+ùs   ƒFTzArguments shapes must match)r!   ÚallÚ
ValueError)rA   ÚdatarJ   s   & @r   r.   ÚPinholeCamera._check_validŒ   sT   ø€ á1:Ó;±¨—z‘z !—}�}±Ñ;ˆß‹sÔNÁ+ÓN�s�sŠsÔNÁ+ÓN×NÒNÜÐ:Ó;Ð;Ùùò <s   †A1c                ó@   <€ V ^8„  d   QhRS[ P                  RS[RS[/# ©r   rO   Ú	data_namer   ©r   r   ÚstrrB   )r   r*   s   "€r   r   r+   ”   ó&   ø€ ÷ ñ ¡%§,¡,ð ¹3ð Á4ñ r   c                ó˜   € \        V P                  4      R9  g   V P                  RR R8w  d   \        RV RV P                   24      hR# )r   Nú	Argument z% shape must be Bx4x4 or BxNx4x4. Got T)r   é   r   ©rY   rY   ©Úlenr!   rN   ©rO   rS   s   &&r   r/   Ú!PinholeCamera._check_valid_params“   sG   € äˆt�z‰z‹? &Ô(¨D¯J©J°r°s¨O¸vÔ,EÜ˜y¨¨Ð3XÐY]×YcÑYcÐXdÐeÓfÐfÙr   c                ó@   <€ V ^8„  d   QhRS[ P                  RS[RS[/# rR   rT   )r   r*   s   "€r   r   r+   š   s&   ø€ ÷ ñ ¡§¡ð ¹#ð Á$ñ r   c                óp   € \        V P                  4      ^8X  g   \        RV RV P                   24      hR# )é   rX   z- shape must be in the following shape B. Got Tr[   r]   s   &&r   r7   Ú PinholeCamera._check_valid_shape™   s6   € ä�4—:‘:‹ !Ô#Ü˜y¨¨Ð3`Ðae×akÑakÐ`lÐmÓnÐnÙr   c                óH   <€ V ^8„  d   QhRS[ S[P                  ,          RR/# )r   rA   r   N)r   r   r   )r   r*   s   "€r   r   r+       s$   ø€ ÷ 2ñ 2©D±·±Õ,>ð 2À4ñ 2r   c                ó@   € V ^ ,          pV  F  p\        W!4       K  	  R# rF   r   )rA   ÚfirstrO   s   &  r   r8   Ú&PinholeCamera._check_consistent_deviceŸ   s   € à˜!•ˆÛˆDÜ$ TÖ1ó r   c                ó4   <€ V ^8„  d   QhRS[ P                  /# ©r   r   )r   Údevice)r   r*   s   "€r   r   r+   ¥   s   ø€ ÷ 'ñ '™Ÿ™ñ 'r   c                ó.   € V P                   P                  # )zdReturn the device for camera buffers.

Returns:
    the ``torch.device`` of the stored intrinsics.

)r:   ri   ©r<   s   &r   ri   ÚPinholeCamera.device¥   s   € ð ×Ñ×&Ñ&Ð&r   c                ó4   <€ V ^8„  d   QhRS[ P                  /# rh   r   )r   r*   s   "€r   r   r+   ¯   ó   ø€ ÷ 	 ñ 	 ™EŸL™Lñ 	 r   c                ój   € V P                  V P                  R4      '       g   \        hV P                  # )zTThe full 4x4 intrinsics matrix.

Returns:
    torch.Tensor of shape ``(B, 4, 4)``.

r"   )r/   r:   ÚAssertionErrorrk   s   &r   r"   ÚPinholeCamera.intrinsics®   ó/   € ð ×'Ñ'¨×(8Ñ(8¸,×GÒGÜ Ð Ø×ÑÐr   c                ó4   <€ V ^8„  d   QhRS[ P                  /# rh   r   )r   r*   s   "€r   r   r+   »   rn   r   c                ój   € V P                  V P                  R4      '       g   \        hV P                  # )zTThe full 4x4 extrinsics matrix.

Returns:
    torch.Tensor of shape ``(B, 4, 4)``.

r'   )r/   r;   rp   rk   s   &r   r'   ÚPinholeCamera.extrinsicsº   rr   r   c                ó    <€ V ^8„  d   QhRS[ /# rh   ©Úint)r   r*   s   "€r   r   r+   Ç   s   ø€ ÷ (ñ (™Cñ (r   c                ó<   € V P                   P                  ^ ,          # )zQReturn the batch size of the storage.

Returns:
    scalar with the batch size.

)r"   r!   rk   s   &r   rI   ÚPinholeCamera.batch_sizeÆ   s   € ð �‰×$Ñ$ QÕ'Ð'r   c                ó4   <€ V ^8„  d   QhRS[ P                  /# rh   r   )r   r*   s   "€r   r   r+   Ñ   ó   ø€ ÷ *ñ *‘E—L‘Lñ *r   c                ó(   € V P                   R,          # )zZReturn the focal length in the x-direction.

Returns:
    torch.Tensor of shape ``(B)``.

©.rD   rD   ©r"   rk   s   &r   ÚfxÚPinholeCamera.fxÐ   ó   € ð �‰˜yÕ)Ð)r   c                ó4   <€ V ^8„  d   QhRS[ P                  /# rh   r   )r   r*   s   "€r   r   r+   Û   r|   r   c                ó(   € V P                   R,          # )zZReturn the focal length in the y-direction.

Returns:
    torch.Tensor of shape ``(B)``.

©.ra   ra   r   rk   s   &r   ÚfyÚPinholeCamera.fyÚ   r‚   r   c                ó4   <€ V ^8„  d   QhRS[ P                  /# rh   r   )r   r*   s   "€r   r   r+   å   r|   r   c                ó(   € V P                   R,          # )z^Return the x-coordinate of the principal point.

Returns:
    torch.Tensor of shape ``(B)``.

©.rD   r   r   rk   s   &r   ÚcxÚPinholeCamera.cxä   r‚   r   c                ó4   <€ V ^8„  d   QhRS[ P                  /# rh   r   )r   r*   s   "€r   r   r+   ï   r|   r   c                ó(   € V P                   R,          # )z^Return the y-coordinate of the principal point.

Returns:
    torch.Tensor of shape ``(B)``.

©.ra   r   r   rk   s   &r   ÚcyÚPinholeCamera.cyî   r‚   r   c                ó4   <€ V ^8„  d   QhRS[ P                  /# rh   r   )r   r*   s   "€r   r   r+   ù   ó   ø€ ÷ +ñ +‘E—L‘Lñ +r   c                ó(   € V P                   R,          # )zaReturn the x-coordinate of the translation vector.

Returns:
    torch.Tensor of shape ``(B)``.

©.rD   éÿÿÿÿ©r'   rk   s   &r   ÚtxÚPinholeCamera.txø   ó   € ð �‰˜zÕ*Ð*r   c                óN   <€ V ^8„  d   QhRS[ S[P                  S[3,          RR/# ©r   Úvaluer   N©r   r   r   Úfloat)r   r*   s   "€r   r   r+     ó)   ø€ ÷ ,ñ ,™™eŸl™l©EÐ1Õ2ð ,°tñ ,r   c                ó"   € WP                   R&   R# )zDSet the x-coordinate of the translation vector with the given value.Nr•   r—   ©r<   r�   s   &&r   r˜   r™     ó   € ð ',�‰˜
Ó#r   c                ó4   <€ V ^8„  d   QhRS[ P                  /# rh   r   )r   r*   s   "€r   r   r+     r“   r   c                ó(   € V P                   R,          # )zaReturn the y-coordinate of the translation vector.

Returns:
    torch.Tensor of shape ``(B)``.

©.ra   r–   r—   rk   s   &r   ÚtyÚPinholeCamera.ty  rš   r   c                óN   <€ V ^8„  d   QhRS[ S[P                  S[3,          RR/# rœ   rž   )r   r*   s   "€r   r   r+     r    r   c                ó"   € WP                   R&   R# )zDSet the y-coordinate of the translation vector with the given value.Nr¦   r—   r¢   s   &&r   r§   r¨     r£   r   c                ó4   <€ V ^8„  d   QhRS[ P                  /# rh   r   )r   r*   s   "€r   r   r+     r“   r   c                ó(   € V P                   R,          # )zbReturns the z-coordinate of the translation vector.

Returns:
    torch.Tensor of shape ``(B)``.

©.r   r–   r—   rk   s   &r   ÚtzÚPinholeCamera.tz  rš   r   c                óN   <€ V ^8„  d   QhRS[ S[P                  S[3,          RR/# rœ   rž   )r   r*   s   "€r   r   r+   !  r    r   c                ó"   € WP                   R&   R# )zDSet the z-coordinate of the translation vector with the given value.Nr­   r—   r¢   s   &&r   r®   r¯      r£   r   c                ó4   <€ V ^8„  d   QhRS[ P                  /# rh   r   )r   r*   s   "€r   r   r+   &  s   ø€ ÷ ,ñ ,™5Ÿ<™<ñ ,r   c                ó(   € V P                   R,          # )z`Return the 3x4 rotation-translation matrix.

Returns:
    torch.Tensor of shape ``(B, 3, 4)``.

).r   :NrY   Nr—   rk   s   &r   Ú	rt_matrixÚPinholeCamera.rt_matrix%  ó   € ð �‰˜{Õ+Ð+r   c                ó4   <€ V ^8„  d   QhRS[ P                  /# rh   r   )r   r*   s   "€r   r   r+   0  s   ø€ ÷ ,ñ ,™uŸ|™|ñ ,r   c                ó(   € V P                   R,          # )zlReturn the 3x3 camera matrix containing the intrinsics.

Returns:
    torch.Tensor of shape ``(B, 3, 3)``.

r   r   rk   s   &r   r   ÚPinholeCamera.camera_matrix/  r¶   r   c                ó4   <€ V ^8„  d   QhRS[ P                  /# rh   r   )r   r*   s   "€r   r   r+   :  s   ø€ ÷ ,ñ ,¡§¡ñ ,r   c                ó(   € V P                   R,          # )zhReturn the 3x3 rotation matrix from the extrinsics.

Returns:
    torch.Tensor of shape ``(B, 3, 3)``.

r   r—   rk   s   &r   Úrotation_matrixÚPinholeCamera.rotation_matrix9  r¶   r   c                ó4   <€ V ^8„  d   QhRS[ P                  /# rh   r   )r   r*   s   "€r   r   r+   D  s   ø€ ÷ -ñ -¡E§L¡Lñ -r   c                ó2   € V P                   RRRR13,          # )zgReturn the translation vector from the extrinsics.

Returns:
    torch.Tensor of shape ``(B, 3, 1)``.

.r   Nr–   r—   rk   s   &r   Útranslation_vectorÚ PinholeCamera.translation_vectorC  s   € ð �‰˜s B¨©˜|Õ,Ð,r   c                ó   <€ V ^8„  d   QhRR/# )r   r   r%   rG   )r   r*   s   "€r   r   r+   M  s   ø€ ÷ Xñ X�ñ Xr   c                ón   € \        V P                  V P                  V P                  V P                  4      # )zˆReturn a deep copy of the current object instance.

See the Convention block on :class:`~kornia.geometry.camera.pinhole.PinholeCamera`.
)r%   r"   r'   r(   r)   rk   s   &r   r9   ÚPinholeCamera.cloneM  s%   € ô
 ˜TŸ_™_¨d¯o©o¸t¿{¹{ÈDÏJÉJÓWÐWr   c                ó4   <€ V ^8„  d   QhRS[ P                  /# rh   r   )r   r*   s   "€r   r   r+   T  s   ø€ ÷ Jñ J¡E§L¡Lñ Jr   c                ó>   € \        \        V P                  4      4      # )aÄ  Return the homogeneous 4x4 embedding of the inverse camera matrix.

Only the top-left 3x3 block of ``intrinsics`` is inverted. The remaining entries
are ignored, so zero-padded intrinsics are supported. The result has a zero
last row and column except for the homogeneous component at ``[..., 3, 3]``,
which is one. See the Convention block on :class:`~kornia.geometry.camera.pinhole.PinholeCamera`.

Returns:
    torch.Tensor of shape ``(B, 4, 4)``.

)r#   r	   r   rk   s   &r   Úintrinsics_inverseÚ PinholeCamera.intrinsics_inverseT  s   € ô !Ô!4°T×5GÑ5GÓ!HÓIÐIr   c                ó8   <€ V ^8„  d   QhRS[ P                  RR/# ©r   Úscale_factorr   r%   r   )r   r*   s   "€r   r   r+   b  s#   ø€ ÷ Iñ I¡%§,¡,ð I°?ñ Ir   c                óŠ  € V P                   P                  4       pVR;;,          V,          uu&   VR;;,          V,          uu&   VR;;,          V,          uu&   VR;;,          V,          uu&   WP                  P                  4       ,          pWP                  P                  4       ,          p\	        W P
                  W44      # )a‘  Scale the pinhole model.

Convention:
    - returns a **new** camera whose focal lengths, principal point and image size are multiplied by
      ``scale_factor``: ``fx' = s * fx`` and ``cx' = s * cx``.
    - ``height`` / ``width`` take the promoted dtype of ``scale_factor * height``.

.. warning::
    The ``cx' = s * cx`` rule disagrees with kornia's integer pixel centres:
    `#4263 <https://github.com/kornia/kornia/issues/4263>`_.

Args:
    scale_factor: a torch.Tensor with the scale factor. It has
      to be broadcastable with class members. The expected shape is
      ``(B)`` or ``(1)``.

Returns:
    the camera model with scaled parameters.

r~   r…   rŠ   r�   )r"   r9   r(   r)   r%   r'   )r<   rË   r"   r(   r)   s   &&   r   ÚscaleÚPinholeCamera.scaleb  s‘   € ð, $(§?¡?×#8Ñ#8Ó#:ˆ
Ø�9× Õ-ÓØ�9× Õ-ÓØ�9× Õ-ÓØ�9× Õ-Óà+¯k©k×.?Ñ.?Ó.AÕAˆØ*¯Z©Z×-=Ñ-=Ó-?Õ?ˆÜ˜Z¯©¸&ÓHÐHr   c                óN   <€ V ^8„  d   QhRS[ S[S[P                  3,          RR/# rÊ   ©r   rŸ   r   r   )r   r*   s   "€r   r   r+   ‚  s)   ø€ ÷ ñ ¡5©±·±Ð)<Õ#=ð À/ñ r   c                ó^  € V P                   R;;,          V,          uu&   V P                   R;;,          V,          uu&   V P                   R;;,          V,          uu&   V P                   R;;,          V,          uu&   V P                  V,          V n        V P                  V,          V n        V # )a  Scale the pinhole model in-place.

Convention:
    - applies the rescaling of :meth:`scale` in place and returns ``self``; the tensors passed to the
      constructor are not modified.

.. warning::
    The principal-point rule shared with :meth:`scale` is
    `#4263 <https://github.com/kornia/kornia/issues/4263>`_.

Args:
    scale_factor: a torch.Tensor with the scale factor. It has
      to be broadcastable with class members. The expected shape is
      ``(B)`` or ``(1)``.

Returns:
    the camera model with scaled parameters.

r~   r…   rŠ   r�   )r"   r(   r)   ©r<   rË   s   &&r   Úscale_ÚPinholeCamera.scale_‚  sy   € ð* 	�‰˜	×" lÕ2Ó"Ø�‰˜	×" lÕ2Ó"Ø�‰˜	×" lÕ2Ó"Ø�‰˜	×" lÕ2Ó"à—k‘k LÕ0ˆŒØ—Z‘Z ,Õ.ˆŒ
Øˆr   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# )r   Úpoint_3dr   r   )r   r*   s   "€r   r   r+      s'   ø€ ÷ &Nñ &N¡§¡ð &N±·±ñ &Nr   c                ó®   € \        VP                  4      ^8  d   \        RVP                   24      hV P                  4       p\	        \        W!4      4      # )af  Project a 3d point in world coordinates onto the 2d camera plane.

See the Convention block on :class:`~kornia.geometry.camera.pinhole.PinholeCamera`.

Convention:
    - ``point_3d`` must be at least rank 2. An unbatched ``(3,)`` point raises :class:`ValueError`.
      An empty point set returns an empty result.
    - a point whose **camera-frame** ``z`` is 0 does not raise: ``K`` is applied first and the
      perspective divide is then skipped, so the result is the undivided ``K (R X + t)``.

.. warning::
    This ``z = 0`` answer differs from :func:`~kornia.geometry.camera.perspective.project_points`, which
    applies ``K`` after the skipped divide: `#4267 <https://github.com/kornia/kornia/issues/4267>`_.

Args:
    point_3d: torch.Tensor containing the 3d points to be projected
        to the camera plane. The shape of the torch.Tensor can be ``(*, 3)`` with at least two
        dimensions; with ``B > 1`` cameras, ``(B, *, N, 3)``, camera ``b`` projecting ``point_3d[b]``.

Returns:
    torch.Tensor of (u, v) pixel coordinates with shape ``(*, 2)``.

Example:
    >>> _ = torch.manual_seed(0)
    >>> X = torch.rand(1, 3)
    >>> K = torch.eye(4)[None]
    >>> E = torch.eye(4)[None]
    >>> h = torch.ones(1)
    >>> w = torch.ones(1)
    >>> pinhole = kornia.geometry.camera.PinholeCamera(K, E, h, w)
    >>> pinhole.project(X)
    tensor([[5.6088, 8.6827]])

z(Input must be at least a 2D tensor. Got )r\   r!   rN   Ú_projection_matrixr   r   )r<   rÖ   ÚPs   && r   ÚprojectÚPinholeCamera.project   sM   € ôF ˆx�~‰~Ó Ô"ÜÐGÈÏÉÐGWÐXÓYÐYØ×#Ñ#Ó%ˆÜ.Ô/?ÀÓ/LÓMÐMr   c                óh   <€ V ^8„  d   QhRS[ P                  RS[ P                  RS[ P                  /# )r   Úpoint_2dÚdepthr   r   )r   r*   s   "€r   r   r+   È  s3   ø€ ÷ Xñ X¡%§,¡,ð X±u·|±|ð XÉÏÉñ Xr   c                ól   € \        V P                  4       4      p\        V\        V4      V,          4      # )a  Unproject a 2d point in 3d.

Transform coordinates in the pixel frame to the world frame.

See the Convention block on :class:`~kornia.geometry.camera.pinhole.PinholeCamera`.

Args:
    point_2d: torch.Tensor containing the 2d to be projected to
        world coordinates. The shape of the torch.Tensor can be ``(*, 2)`` with at least two
        dimensions; with ``B > 1`` cameras, ``(B, *, N, 2)``, camera ``b`` unprojecting ``point_2d[b]``.
    depth: torch.Tensor containing the depth value of each 2d
        points. The torch.Tensor shape must be equal to point2d ``(*, 1)``.

Returns:
    torch.Tensor of (x, y, z) world coordinates with shape ``(*, 3)``.

Example:
    >>> _ = torch.manual_seed(0)
    >>> x = torch.rand(1, 2)
    >>> depth = torch.ones(1, 1)
    >>> K = torch.eye(4)[None]
    >>> E = torch.eye(4)[None]
    >>> h = torch.ones(1)
    >>> w = torch.ones(1)
    >>> pinhole = kornia.geometry.camera.PinholeCamera(K, E, h, w)
    >>> pinhole.unproject(x, depth)
    tensor([[0.4963, 0.7682, 1.0000]])

)r	   rØ   r   r   )r<   rÝ   rÞ   ÚP_invs   &&& r   Ú	unprojectÚPinholeCamera.unprojectÈ  s0   € ô< $ D×$;Ñ$;Ó$=Ó>ˆÜ Ô'DÀXÓ'NÐQVÕ'VÓWÐWr   c                ó4   <€ V ^8„  d   QhRS[ P                  /# rh   r   )r   r*   s   "€r   r   r+   é  s   ø€ ÷ ñ ¡E§L¡Lñ r   c                ó°  € \        V P                  R,          V P                  4      w  r\        P                  ! . VP
                  RR O^N^N5RVP                  RVP                  / p\        VP                  P                  4      ;_uu_ 4        WR,          ,          VR&   WR,          ,          VR&   RRR4       RVR&   V#   + '       g   i     L; i)	aß  Return the 4x4 projection built from the intrinsics' top-left 3x3 block.

Both :meth:`project` and :meth:`unproject` go through this matrix, so they agree on
which intrinsics are usable: a 3x3 ``K`` zero-padded to 4x4 round-trips exactly like its
homogeneous embedding, instead of projecting while ``unproject`` raises on the singular
4x4 product. For a homogeneous embedding the result matches ``intrinsics @ extrinsics``
bit for bit on CPU, and to the dtype's rounding on MPS.
Nri   Údtyper   r   r   ).r   :r   NNr   )
r   r:   r;   r   Úzerosr!   ri   rå   r   Útype)r<   ÚKÚErÙ   s   &   r   rØ   Ú PinholeCamera._projection_matrixé  s­   € ô )¨×)9Ñ)9¸+Õ)FÈ×HXÑHXÓY‰ˆÜ�KŠKÐL˜Ÿ™  "˜ÐL qÐL¨!ÒL°A·H±HÐLÀAÇGÁGÑLˆô   §¡§¡×.Õ.Ø ;¥Õ/ˆAˆk‰NØ ;¥Õ/ˆAˆk‰N÷ /ð ˆˆ)‰Øˆ÷	 /×.ús   Â%CÃC	c                ó2  <€ V ^8„  d   QhRS[ P                  RS[ P                  RS[ P                  RS[ P                  RS[RS[RS[ P                  RS[ P                  R	S[ P                  R
S[RS[S[S[ P
                  R3,          RS[ P                  RR/# )r   r€   r†   r‹   r�   r(   r)   r˜   r§   r®   rI   ri   Nrå   r   r%   )r   r   rx   r   rU   ri   rå   )r   r*   s   "€r   r   r+   þ  sÌ   ø€ ÷ >Cñ >Cá�L‰Lð>Cñ �L‰Lð>Cñ �L‰Lð	>Cñ
 �L‰Lð>Cñ ð>Cñ ð>Cñ �L‰Lð>Cñ �L‰Lð>Cñ �L‰Lð>Cñ ð>Cñ ‘c™5Ÿ<™<¨Ð-Õ.ð>Cñ �{‰{ð>Cð 
ñ>Cr   c                ó~  € \         P                  ! V
^^W¼R7      pVR;;,          V,          uu&   VR;;,          V,          uu&   VR;;,          V,          uu&   VR;;,          V,          uu&   VR;;,          R,          uu&   VR;;,          R,          uu&   \         P                  ! ^W¼R7      P                  V
^^4      pVR	;;,          V,          uu&   VR
;;,          V,          uu&   VR;;,          V	,          uu&   \         P                  ! V
3W[VR7      p\         P                  ! V
3WkVR7      pV ! WÞVV4      # )a-  Construct a batched pinhole camera from scalar parameter tensors.

See the Convention block on :class:`~kornia.geometry.camera.pinhole.PinholeCamera`.

This helper allocates batched :math:`4 \times 4` intrinsic and
extrinsic matrices, fills focal lengths/principal point/translation,
and wraps them into a :class:`PinholeCamera` instance.

Convention:
    - every parameter, including ``height`` and ``width``, is broadcast over ``batch_size``.
    - ``height`` and ``width`` are stored as floating-point tensors of the requested ``dtype``, so the
      camera it builds can be scaled in place.

Args:
    fx: Horizontal focal length per batch element.
    fy: Vertical focal length per batch element.
    cx: Principal point x-coordinate per batch element.
    cy: Principal point y-coordinate per batch element.
    height: Image height in pixels.
    width: Image width in pixels.
    tx: Camera translation along x per batch element.
    ty: Camera translation along y per batch element.
    tz: Camera translation along z per batch element.
    batch_size: Number of cameras in the batch.
    device: Target device for the created tensors.
    dtype: Target floating-point dtype for the created tensors.

Returns:
    Batched :class:`PinholeCamera` configured from the provided
    intrinsic and translation parameters.
)ri   rå   r   r~   r…   rŠ   r�   ).r   r   r   r•   r¦   r­   )r   ræ   ÚeyeÚrepeatÚfull)r<   r€   r†   r‹   r�   r(   r)   r˜   r§   r®   rI   ri   rå   r"   r'   Ú
height_tmpÚ	width_tmps   &&&&&&&&&&&&&    r   Úfrom_parametersÚPinholeCamera.from_parametersý  s  € ô` —[’[ ¨Q°¸&ÔNˆ
Ø�9× Õ#ÓØ�9× Õ#ÓØ�9× Õ#ÓØ�9× Õ#ÓØ�9× Õ$ÓØ�9× Õ$Óä—Y’Y˜q¨Ô=×DÑDÀZÐQRÐTUÓVˆ
Ø�:× "Õ$ÓØ�:× "Õ$ÓØ�:× "Õ$Óä—Z’Z  ¨vÈEÔRˆ
Ü—J’J 
˜}¨eÈ%ÔPˆ	Ù�J¨J¸	ÓBÐBr   ©r;   r:   r(   r)   N)'Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r>   Ústaticmethodr.   r/   r7   r8   ri   Úpropertyr"   r'   rI   r€   r†   r‹   r�   r˜   Úsetterr§   r®   r´   r   r¼   rÀ   r9   rÇ   rÍ   rÓ   rÚ   rá   rØ   Úclassmethodrò   Ú__static_attributes__Ú__classdictcell__©r*   s   @r   r%   r%   '   s9  ø‡ € ñG÷R<ð <ð6 ÷ó ðð ÷ó ðð
 ÷ó ðð
 ÷2ó ð2÷
'ð 'ð ÷	 ó ð	 ð ÷	 ó ð	 ð ÷(ó ð(ð ÷*ó ð*ð ÷*ó ð*ð ÷*ó ð*ð ÷*ó ð*ð ÷+ó ð+ð ‡Y�Y÷,ó ð,ð ÷+ó ð+ð ‡Y�Y÷,ó ð,ð ÷+ó ð+ð ‡Y�Y÷,ó ð,ð ÷,ó ð,ð ÷,ó ð,ð ÷,ó ð,ð ÷-ó ð-÷Xð X÷Jð J÷Ið I÷@ð ÷<&Nð &N÷PXð X÷Bð ð( ÷>Có ö>Cr   r%   c                   óÈ   a € ] tR tRt o RtV 3R lR lt]V 3R lR l4       tV 3R lR ltV 3R	 lR
 lt	V 3R lR lt
V 3R lR lt]V 3R lR l4       tV 3R lR ltRtV tR# )ÚPinholeCamerasListi?  aM  Class that represents a list of pinhole cameras.

The class inherits from :class:`~kornia.PinholeCamera` meaning that
it will keep the same class properties but with an extra dimension.

.. note::
    The underlying data torch.Tensor will be stacked in the first dimension.
    That's it, given a list of two camera instances, the intrinsics torch.Tensor
    will have a shape ``(B, N, 4, 4)`` where :math:`B` is the batch
    size and :math:`N` is the numbers of cameras (in this case two).

Args:
    pinholes_list: a python tuple or list containing a set of `PinholeCamera` instances.

c                ó4   <€ V ^8„  d   QhRS[ S[,          RR/# )r   Úpinholes_listr   N©r   r%   )r   r*   s   "€r   r   ÚPinholeCamerasList.__annotate__P  s    ø€ ÷ 3ñ 3¡h©}Õ&=ð 3À$ñ 3r   c                ó(   € V P                  V4       R # )N)Ú_initialize_parameters)r<   r  s   &&r   r>   ÚPinholeCamerasList.__init__P  s   € Ø×#Ñ# MÖ2r   c                ó@   <€ V ^8„  d   QhRS[ P                  RS[RS[/# rR   rT   )r   r*   s   "€r   r   r  T  rV   r   c                ó˜   € \        V P                  4      ^8w  g   V P                  RR R8w  d   \        RV RV P                   24      hR# )rY   NrX   z3 shape must be in the following shape BxNx4x4. Got Tr   rZ   r[   r]   s   &&r   r/   Ú&PinholeCamerasList._check_valid_paramsS  sG   € äˆt�z‰z‹?˜aÔ 4§:¡:¨b¨c ?°fÔ#<Ü˜y¨¨Ð3fÐgk×gqÑgqÐfrÐsÓtÐtÙr   c                ó4   <€ V ^8„  d   QhRS[ S[,          RR/# )r   Úpinholesr   r  r  )r   r*   s   "€r   r   r  Y  s!   ø€ ÷ ñ ©x¹Õ/Fð ÐK_ñ r   c                ó¤  € \        V\        \        34      '       g   \        R\	        V4       24      h. . r2. . rTV Fœ  p\        V\
        4      '       g   \        R\	        V4       24      hVP                  VP                  4       VP                  VP                  4       VP                  VP                  4       VP                  VP                  4       Kž  	  \        P                  ! V^R7      V n        \        P                  ! V^R7      V n        \        P                  ! V^R7      V n        \        P                  ! V^R7      V n        V # )z5Initialise the class attributes given a cameras list.z(pinhole must of type list or tuple. Got z6Argument pinhole must be from type PinholeCamera. Got ©r0   )Ú
isinstanceÚlistÚtupleÚ	TypeErrorrç   r%   Úappendr(   r)   r"   r'   r   Ústackr:   r;   )r<   r  r(   r)   r"   r'   Úpinholes   &&     r   r  Ú)PinholeCamerasList._initialize_parametersY  s  € ä˜(¤T¬5 M×2Ò2ÜÐFÄtÈHÃ~ÐFVÐWÓXÐXØ˜B�Ø!# R�JÛˆGÜ˜g¤}×5Ò5ÜÐ"XÔY]Ð^eÓYfÐXgÐ hÓiÐiØ�M‰M˜'Ÿ.™.Ô)Ø�L‰L˜Ÿ™Ô'Ø×Ñ˜g×0Ñ0Ô1Ø×Ñ˜g×0Ñ0Ö1ñ  ô %*§K¢K°¸AÔ$>ˆŒÜ#(§;¢;¨u¸!Ô#<ˆŒ
Ü).¯ª°ZÀQÔ)GˆÔÜ).¯ª°ZÀQÔ)GˆÔØˆr   c                ó   <€ V ^8„  d   QhRR/# )r   r   r  rG   )r   r*   s   "€r   r   r  m  s   ø€ ÷ jñ jÐ+ñ jr   c                ó    € \        \        V P                  4       Uu. uF!  qP                  V4      P	                  4       NK#  	  up4      # u upi )z3Return a copy of the list, with each camera cloned.)r  ÚrangeÚnum_camerasÚget_pinholer9   )r<   Úindexs   & r   r9   ÚPinholeCamerasList.clonem  s@   € ä!ÔPUÐVZ×VfÑVfÔPgÓ"hÑPgÀu×#3Ñ#3°EÓ#:×#@Ñ#@Ö#BÑPgÑ"hÓiÐiùÒ"hs   �'Ac                ó8   <€ V ^8„  d   QhRS[ P                  RR/# ©r   rË   r   r  r   )r   r*   s   "€r   r   r  q  s    ø€ ÷ 1ñ 1¡%§,¡,ð 1Ð3Gñ 1r   c                ó@   € V P                  4       P                  V4      # )zUScale the cameras by a vector factor along the batch dimension, returning a new list.)r9   rÓ   rÒ   s   &&r   rÍ   ÚPinholeCamerasList.scaleq  s   € à�z‰z‹|×"Ñ" <Ó0Ð0r   c                óN   <€ V ^8„  d   QhRS[ S[S[P                  3,          RR/# r!  rÐ   )r   r*   s   "€r   r   r  u  s*   ø€ ÷ 
ñ 
¡5©±·±Ð)<Õ#=ð 
ÐBVñ 
r   c                óÒ  € \        V\        P                  4      '       d   VP                  ^8X  d
   VR,          pV P                  R;;,          V,          uu&   V P                  R;;,          V,          uu&   V P                  R;;,          V,          uu&   V P                  R;;,          V,          uu&   V P
                  V,          V n        V P                  V,          V n        V # )zOScale the cameras in place, applying a vector factor along the batch dimension.).Nr~   r…   rŠ   r�   )r  r   r   Úndimr"   r(   r)   rÒ   s   &&r   rÓ   ÚPinholeCamerasList.scale_u  sŸ   € ä�l¤E§L¡L×1Ò1°l×6GÑ6GÈ1Ô6LØ'¨	Õ2ˆLØ�‰˜	×" lÕ2Ó"Ø�‰˜	×" lÕ2Ó"Ø�‰˜	×" lÕ2Ó"Ø�‰˜	×" lÕ2Ó"Ø—k‘k LÕ0ˆŒØ—Z‘Z ,Õ.ˆŒ
Øˆr   c                ó    <€ V ^8„  d   QhRS[ /# rh   rw   )r   r*   s   "€r   r   r  ‚  s   ø€ ÷ ñ ™Sñ r   c                ór   € RpV P                   e'   \        V P                   P                  ^,          4      pV# )z0Return the number of pinholes cameras per batch.r–   )r"   rx   r!   )r<   r  s   & r   r  ÚPinholeCamerasList.num_cameras�  s2   € ð ˆØ�?‰?Ò&Ü˜dŸo™o×3Ñ3°AÕ6Ó7ˆKØÐr   c                ó&   <€ V ^8„  d   QhRS[ RS[/# )r   Úidxr   )rx   r%   )r   r*   s   "€r   r   r  ‰  s   ø€ ÷ Dñ D™sð D¡}ñ Dr   c                óÂ   € V P                   RV3,          pV P                  RV3,          pV P                  RV3,          pV P                  RV3,          p\	        WEW#4      # )z<Return a PinholeCamera object with parameters such as Bx4x4..ºNNN)r(   r)   r"   r'   r%   )r<   r,  r(   r)   r"   r'   s   &&    r   r  ÚPinholeCamerasList.get_pinhole‰  sW   € à#Ÿ{™{¨3°¨8Õ4ˆØ"Ÿj™j¨¨c¨Õ2ˆØ#'§?¡?°1°c°6Õ#:ˆ
Ø#'§?¡?°1°c°6Õ#:ˆ
Ü˜Z°VÓCÐCr   rô   N)rõ   rö   r÷   rø   rù   r>   rú   r/   r  r9   rÍ   rÓ   rû   r  r  rþ   rÿ   r   s   @r   r  r  ?  sr   ø‡ € ñ÷ 3ð 3ð ÷ó ð÷
ð ÷(jð j÷1ð 1÷
ð 
ð ÷ó ð÷Dö Dr   r  c                ó˜   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\         P                  /# )r   rÞ   Úintrinsics_invÚpixel_coordsr   r   )r   s   "r   r   r   –  s;   € ÷ .2ñ .2”U—\‘\ð .2´5·<±<ð .2ÌuÏ|É|ð .2Ô`e×`lÑ`lñ .2r   c                ó  € \        V P                  4      ^8X  d   V P                  ^,          ^8X  g   \        RV P                   24      h\        VP                  4      ^8X  d   VP                  RR R8X  g   \        RVP                   24      h\        VP                  4      ^8X  d   VP                  ^,          ^8X  g   \        RVP                   24      h\        VR,          V4      pW0P	                  ^ ^^^4      ,          # )ah	  Unproject a depth map to camera-frame points through a 4x4 inverse intrinsics matrix.

``points = pixel2cam(depth, intrinsics_inv, pixel_coords)`` takes a ``(B, 1, H, W)`` depth map, the
``(B, 4, 4)`` inverse intrinsics that :meth:`PinholeCamera.intrinsics_inverse` returns and the homogeneous
pixel grid ``(B, H, W, 3)`` of ``(u, v, 1)``, and returns the camera-frame point ``depth * K^-1 (u, v, 1)`` of
every pixel as ``(B, H, W, 3)``. It is the first half of the dense warp of
:class:`~kornia.geometry.depth.DepthWarper`; :func:`cam2pixel` is the second. For a ``3x3`` ``K``, use
:func:`~kornia.geometry.depth.depth_to_3d_v2`, which builds the pixel grid itself.

Convention:
    - ``intrinsics_inv`` is a ``(B, 4, 4)`` inverse calibration matrix (the
      :class:`~kornia.geometry.camera.pinhole.PinholeCamera` layout, not a ``3x3`` ``K``), and ``depth`` is
      the camera-frame ``z`` at each pixel of the ``(u, v, 1)`` grid. Pixel centres are integers; see the
      Convention block on :class:`~kornia.geometry.camera.pinhole.PinholeCamera`.
    - a ``depth`` that is not ``(B, 1, H, W)``, an ``intrinsics_inv`` that is not ``(B, 4, 4)`` or a
      ``pixel_coords`` that is not ``(B, H, W, 3)`` raises :class:`ValueError`. That ``pixel_coords`` matches
      the ``H`` and ``W`` of ``depth`` is not checked up front: the two broadcast, so a mismatch raises a
      broadcasting ``RuntimeError`` unless one of the sizes is 1.
    - the batch of ``intrinsics_inv`` is that of ``pixel_coords`` or 1, and ``depth`` broadcasts against the
      result: one camera and one grid serve a batch of depth maps.

Args:
    depth: the source depth maps. Shape must be ``(B, 1, H, W)``.
    intrinsics_inv: the inverse intrinsics camera matrix. Shape must be ``(B, 4, 4)``.
    pixel_coords: the grid with (u, v, 1) pixel coordinates. Shape must be ``(B, H, W, 3)``.

Returns:
    torch.Tensor of shape ``(B, H, W, 3)`` with (x, y, z) cam coordinates.

See Also:
    - :func:`cam2pixel`: the second half of the warp, camera-frame points to the pixels of a camera.
    - :class:`PinholeCamera`: the camera model whose ``(B, 4, 4)`` matrices this function takes.
    - :func:`~kornia.geometry.depth.depth_to_3d_v2`: the same points from a ``3x3`` ``K``, without a grid
      to pass.
    - :func:`~kornia.geometry.camera.perspective.unproject_points`: selected pixels at given depths, with a
      ``3x3`` ``K``.

z3Input depth has to be in the shape of Bx1xHxW. Got Nz:Input intrinsics_inv has to be in the shape of Bx4x4. Got z:Input pixel_coords has to be in the shape of BxHxWx3. Got r   rZ   ©r.  N)r\   r!   rN   r   Úpermute)rÞ   r1  r2  Ú
cam_coordss   &&& r   Ú	pixel2camr7  –  sç   € ôN �—‘Ó Ô! e§k¡k°!¥n¸Ô&9ÜÐNÈuÏ{É{ÈmÐ\Ó]Ð]Ü�×$Ñ$Ó%¨Ô*¨~×/CÑ/CÀBÀCÐ/HÈFÔ/RÜÐUÐVd×VjÑVjÐUkÐlÓmÐmÜ�×"Ñ"Ó# qÔ(¨\×-?Ñ-?ÀÕ-BÀaÔ-GÜÐUÐVb×VhÑVhÐUiÐjÓkÐkÜ/°¸wÕ0GÈÓV€JØŸ™ a¨¨A¨qÓ1Õ1Ð1r   c                ó„   € V ^8„  d   QhR\         P                  R\         P                  R\        R\         P                  /# )r   Úcam_coords_srcÚdst_proj_srcÚepsr   )r   r   rŸ   )r   s   "r   r   r   Ë  s=   € ÷ Gñ GœeŸl™lð G¼%¿,¹,ð GÌUð GÔ_d×_kÑ_kñ Gr   c                ó\  € \        V P                  4      ^8X  d   V P                  ^,          ^8X  g   \        RV P                   24      h\        VP                  4      ^8X  d   VP                  RR R8X  g   \        RVP                   24      hV P                  pV\        P
                  \        P                  39   d   V P                  4       p VP                  \        P
                  \        P                  39   d   VP                  4       p\        VR,          V 4      pVR,          pVR	,          pVR
,          pWWV,           ,          pWgV,           ,          p	\        P                  ! W‰.RR7      p
V\        P
                  \        P                  39   d   V
P                  V4      p
V
# )aö	  Project a map of camera-frame points to pixels through a 4x4 projection matrix.

``uv = cam2pixel(cam_coords_src, dst_proj_src)`` takes a ``(B, H, W, 3)`` map of points in the source camera
frame and the ``(B, 4, 4)`` projection ``dst_proj_src``, which moves a source-frame point into the destination
camera frame and applies the destination intrinsics, and returns their ``(u, v)`` pixel coordinates in the
destination camera, ``(B, H, W, 2)``. It is the second half of the dense warp of
:class:`~kornia.geometry.depth.DepthWarper`, after :func:`pixel2cam`. For points already in a camera's frame
and a ``3x3`` ``K``, use :func:`~kornia.geometry.camera.perspective.project_points`.

Convention:
    - ``dst_proj_src`` is a ``(B, 4, 4)`` projection matrix (the
      :class:`~kornia.geometry.camera.pinhole.PinholeCamera` layout, not a ``3x3`` ``K``), and the result is
      ``(u, v)`` pixel coordinates in the destination frame, with integer pixel centres; see the Convention
      block on :class:`~kornia.geometry.camera.pinhole.PinholeCamera`.
    - the batch of ``dst_proj_src`` is that of ``cam_coords_src`` or 1. A point behind the camera is divided
      like any other and is not flagged.
    - ``float16`` and ``bfloat16`` points return their dtype. Half-precision points and matrices are
      projected and divided in ``float32`` and the pixels rounded once, so a numerator ``fx * x + cx * z``
      beyond the ``float16`` range does not overflow.

.. warning::
    The perspective division is ``x / (z + eps)`` rather than a guarded divide, so ``z = 0`` gives
    ``x / eps``, huge for a nonzero ``x`` (``inf`` where ``eps`` underflows), and ``eps`` biases every small
    depth:
    `#4267 <https://github.com/kornia/kornia/issues/4267>`_.

Args:
    cam_coords_src: (x, y, z) coordinates defined in the first camera coordinates system. Shape must be
        ``(B, H, W, 3)``.
    dst_proj_src: the projection matrix between the
      reference and the non reference camera frame. Shape must be ``(B, 4, 4)``.
    eps: small value to avoid division by zero error.

Returns:
    torch.Tensor of shape ``(B, H, W, 2)`` with (u, v) pixel coordinates.

See Also:
    - :func:`pixel2cam`: the first half of the warp, a depth map to camera-frame points.
    - :class:`PinholeCamera`: the camera model whose ``(B, 4, 4)`` matrices compose ``dst_proj_src``.
    - :func:`~kornia.geometry.camera.perspective.project_points`: camera-frame points to pixels with a
      ``3x3`` ``K``, skipping the divide at ``z = 0`` instead of adding ``eps``.

z<Input cam_coords_src has to be in the shape of BxHxWx3. Got Nz8Input dst_proj_src has to be in the shape of Bx4x4. Got r  r   rZ   r4  ).rD   ).ra   ).r   r–   )r\   r!   rN   rå   r   Úfloat16Úbfloat16rŸ   r   r  Úto)r9  r:  r;  Ú	out_dtypeÚpoint_coordsÚx_coordÚy_coordÚz_coordÚu_coordÚv_coordÚpixel_coords_dsts   &&&        r   Ú	cam2pixelrH  Ë  sk  € ôX �×$Ñ$Ó%¨Ô*¨~×/CÑ/CÀAÕ/FÈ!Ô/KÜÐWÐXf×XlÑXlÐWmÐnÓoÐoÜ�×"Ñ"Ó# qÔ(¨\×-?Ñ-?ÀÀÐ-DÈÔ-NÜÐSÐT`×TfÑTfÐSgÐhÓiÐið ×$Ñ$€IØ”U—]‘]¤E§N¡NÐ3Ô3Ø'×-Ñ-Ó/ˆØ×ÑœeŸm™m¬U¯^©^Ð<Ô<Ø#×)Ñ)Ó+ˆä!1°,¸wÕ2GÈÓ!X€LØ(¨Õ0€GØ(¨Õ0€GØ(¨Õ0€Gð $°¥}Õ5€GØ#°¥}Õ5€Gô &+§[¢[°'Ð1CÈÔ%LÐà”U—]‘]¤E§N¡NÐ3Ô3Ø+×.Ñ.¨yÓ9ÐØÐr   )gê-�™—q=)rù   r4   Útypingr   r   r   r   Úkornia.core.checkr   Úkornia.core.utilsr   r   r	   r
   Úkornia.geometry.conversionsr   r   Úkornia.geometry.linalgr   r#   r%   r  r7  rH  rG   r   r   Ú<module>rN     s]   ðñ$ uã ß (Ñ (ã å 6ß nÓ nß fÝ 3õ÷UCñ UCôpPD˜ô PDõn.2÷jGñ Gr   