MCPcopy Create free account
hub / github.com/apple/ml-pointersect / cat

Method cat

pointersect/inference/structures.py:1662–1677  ·  view source on GitHub ↗
(cameras: T.List['Camera'], dim: int)

Source from the content-addressed store, hash-verified

1660
1661 @staticmethod
1662 def cat(cameras: T.List['Camera'], dim: int) -> 'Camera':
1663 out = dict()
1664 for name in ['H_c2w', 'intrinsic']:
1665 arr = [getattr(r, name, None) for r in cameras]
1666 if None in arr:
1667 out[name] = None
1668 else:
1669 out[name] = torch.cat(arr, dim=dim)
1670 width_pxs = [getattr(r, 'width_px', None) for r in cameras]
1671 height_pxs = [getattr(r, 'height_px', None) for r in cameras]
1672 assert len(np.unique(width_pxs)) == 1
1673 assert len(np.unique(height_pxs)) == 1
1674 out['width_px'] = width_pxs[0]
1675 out['height_px'] = height_pxs[0]
1676
1677 return Camera(**out)
1678
1679 def __getitem__(self, ib) -> 'Camera':
1680 """slice the camera in the b dimension. Always retain (b, q, 4, 4)

Callers

nothing calls this directly

Calls 2

CameraClass · 0.85
catMethod · 0.45

Tested by

no test coverage detected