Shortcuts

pypose.reprojerr

class pypose.reprojerr(points, pixels, intrinsics, extrinsics=None)[source]

Calculates batched per-pixel reprojection error (pixel distance) for points either in the camera or world frame given camera intrinsics or extrinsics, respectively.

Parameters:
  • points (torch.Tensor) – The 3D coordinate of points. Assumed to be in the camera frame if extrinsics is None, otherwiwse in the world frame. 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, optional) – The camera extrinsics. The shape has to be (…, 7). Default: None.

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)
tensor([0., 0., 0., 0., 0., 0.])

Docs

Access documentation for PyPose

View Docs

Tutorials

Get started with tutorials and examples

View Tutorials

Get Started

Find resources and how to start using pypose

View Resources