
    3j                         S SK r S SKJs  Jr  S SKJrJrJrJ	r	  S\ R                  S\ R                  S\ R                  4S jr SS\ R                  S\ R                  S\ R                  S	\S\ R                  4
S
 jjrg)    N)convert_points_from_homogeneousconvert_points_to_homogeneous"denormalize_points_with_intrinsics normalize_points_with_intrinsicspoint_3dcamera_matrixreturnc                 .    [        U 5      n[        X!5      $ )a#  Project a 3d point onto the 2d camera plane.

Args:
    point_3d: tensor containing the 3d points to be projected
        to the camera plane. The shape of the tensor can be :math:`(*, 3)`.
    camera_matrix: tensor containing the intrinsics camera
        matrix. The tensor shape must be :math:`(*, 3, 3)`.

Returns:
    tensor of (u, v) cam coordinates with shape :math:`(*, 2)`.

Example:
    >>> _ = torch.manual_seed(0)
    >>> X = torch.rand(1, 3)
    >>> K = torch.eye(3)[None]
    >>> project_points(X, K)
    tensor([[5.6088, 8.6827]])

)r   r   )r   r   	xy_coordss      \/home/wildlama/miniconda3/lib/python3.13/site-packages/kornia/geometry/camera/perspective.pyproject_pointsr      s    0 >hGI-iGG    point_2ddepth	normalizec                 2   [        U[        R                  5      (       d  [        S[	        U5       35      eUR
                  S   S:X  d  [        SUR
                   35      e[        X5      n[        U5      nU(       a  [        R                  " USSS9nXQ-  $ )a  Unproject a 2d point in 3d.

Transform coordinates in the pixel frame to the camera frame.

Args:
    point_2d: tensor containing the 2d to be projected to
        world coordinates. The shape of the tensor can be :math:`(*, 2)`.
    depth: tensor containing the depth value of each 2d
        points. The tensor shape must be equal to point2d :math:`(*, 1)`.
    camera_matrix: tensor containing the intrinsics camera
        matrix. The tensor shape must be :math:`(*, 3, 3)`.
    normalize: whether to normalize the pointcloud. This
        must be set to `True` when the depth is represented as the Euclidean
        ray length from the camera position.

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

Example:
    >>> _ = torch.manual_seed(0)
    >>> x = torch.rand(1, 2)
    >>> depth = torch.ones(1, 1)
    >>> K = torch.eye(3)[None]
    >>> unproject_points(x, depth, K)
    tensor([[0.4963, 0.7682, 1.0000]])

z,Input depth type is not a torch.Tensor. Got    z0Input depth must be in the shape of (*, 1). Got g       @)dimp)
isinstancetorchTensor	TypeErrortypeshape
ValueErrorr   r   Fr   )r   r   r   r   xyxyzs         r   unproject_pointsr!   9   s    < eU\\**FtE{mTUU;;r?aKEKK=YZZ7PB5b9Ckk#2-;r   )F)r   torch.nn.functionalnn
functionalr   kornia.geometry.conversionsr   r   r   r   r   r   boolr!    r   r   <module>r(      s   $    HU\\ H%,, H5<< H: af)ll)#(<<)@E)Y])
\\)r   