pypose.reprojerr¶
- class pypose.reprojerr(points, pixels, intrinsics, extrinsics)[source]¶
Calculates batched per-pixel reprojection error (pixel distance) for points in the world coordinate, given camera intrinsic and extrinsic parameters.
- Parameters:
points (
torch.Tensor) – The object points in world coordinate. The shape has to be (…, N, 3).pixels (
torch.Tensor) – The image points. The associated pixel. The shape has to be (…, N, 2).intrinsics (
torch.Tensor) – intrinsic matrices. The shape has to be (…, 3, 3).extrinsics (
LieTensor) – The camera extrinsics. The shape has to be (…, 7).
- Returns:
Per-pixel reprojection error. The shape is (…, N).
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 ]]) >>> object = torch.randn(6, 3) >>> pose = pp.randn_SE3() >>> pixels = pp.point2pixel(object, intrinsics, pose) >>> err = pp.reprojerr(object, pixels, intrinsics, pose) >>> err tensor([0., 0., 0., 0., 0., 0.])