(self, w=None, h=None, K=None)
| 56 | |
| 57 | @torch.no_grad() |
| 58 | def get_rays(self, w=None, h=None, K=None): |
| 59 | w = self.w if w == None else w |
| 60 | h = self.h if h == None else h |
| 61 | if K is None: |
| 62 | K = np.eye(3) |
| 63 | K[0, 0] = self.K[0, 0] * w / self.w |
| 64 | K[1, 1] = self.K[1, 1] * h / self.h |
| 65 | K[0, 2] = self.K[0, 2] * w / self.w |
| 66 | K[1, 2] = self.K[1, 2] * h / self.h |
| 67 | ix, iy = torch.meshgrid( |
| 68 | torch.arange(w), torch.arange(h), indexing='xy') |
| 69 | rays_d = torch.stack( |
| 70 | [(ix - K[0, 2]) / K[0, 0], |
| 71 | (iy - K[1, 2]) / K[1, 1], |
| 72 | torch.ones_like(ix)], -1).float() # camera coordinate |
| 73 | return rays_d |
| 74 | |
| 75 | @torch.no_grad() |
| 76 | def precompute(self): |
no outgoing calls
no test coverage detected