pypose.pixel2point¶
- pypose.pixel2point(pixels, depth, intrinsics)[source]¶
Convert batch of pixels with depth into points (in camera coordinate)
- Parameters:
pixels – (
torch.Tensor
) The 2d coordinates of pixels in the camera pixel coordinate. Shape has to be (…, N, 2)depth – (
torch.Tensor
) The depths of pixels with respect to the sensor plane. Shape has to be (…, N)intrinsics – (
torch.Tensor
): The intrinsic parameters of cameras. The shape has to be (…, 3, 3).
- Returns:
torch.Tensor
The associated 3D-points with shape (…, N, 3)
Example
>>> import torch, pypose as pp >>> f, (H, W) = 2, (9, 9) # focal length and image height, width >>> intrinsics = torch.tensor([[f, 0, H / 2], ... [0, f, W / 2], ... [0, 0, 1 ]]) >>> pixels = torch.tensor([[0.5, 0.0], ... [1.0, 0.0], ... [0.0, 1.3], ... [1.0, 0.0], ... [0.5, 1.5], ... [5.0, 1.5]]) >>> depths = torch.tensor([5.0, 3.0, 6.5, 2.0, 0.5, 0.7]) >>> points = pp.pixel2point(pixels, depths, intrinsics) tensor([[-10.0000, -11.2500, 5.0000], [ -5.2500, -6.7500, 3.0000], [-14.6250, -10.4000, 6.5000], [ -3.5000, -4.5000, 2.0000], [ -1.0000, -0.7500, 0.5000], [ 0.1750, -1.0500, 0.7000]])