MCPcopy Create free account
hub / github.com/Robotics-STAR-Lab/H2-Mapping / get_rays

Method get_rays

mapping/src/utils/mesh_util.py:28–43  ·  view source on GitHub ↗
(self, w=None, h=None, K=None)

Source from the content-addressed store, hash-verified

26
27 @torch.no_grad()
28 def get_rays(self, w=None, h=None, K=None):
29 w = self.w if w == None else w
30 h = self.h if h == None else h
31 if K is None:
32 K = np.eye(3)
33 K[0, 0] = self.K[0, 0] * w / self.w
34 K[1, 1] = self.K[1, 1] * h / self.h
35 K[0, 2] = self.K[0, 2] * w / self.w
36 K[1, 2] = self.K[1, 2] * h / self.h
37 ix, iy = torch.meshgrid(
38 torch.arange(w), torch.arange(h), indexing='xy')
39 rays_d = torch.stack(
40 [(ix - K[0, 2]) / K[0, 0],
41 (iy - K[1, 2]) / K[1, 1],
42 torch.ones_like(ix)], -1).float()
43 return rays_d
44
45 @torch.no_grad()
46 def get_valid_points(self, frame_poses, depth_maps):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected