(self, fid, rgb, depth, K, offset, ref_pose=None)
| 9 | |
| 10 | class RGBDFrame(nn.Module): |
| 11 | def __init__(self, fid, rgb, depth, K, offset, ref_pose=None) -> None: |
| 12 | super().__init__() |
| 13 | self.stamp = fid |
| 14 | self.h, self.w = depth.shape |
| 15 | if type(rgb) != torch.Tensor: |
| 16 | rgb = torch.FloatTensor(rgb).cuda() |
| 17 | if type(depth) != torch.Tensor: |
| 18 | depth = torch.FloatTensor(depth).cuda() # / 2 |
| 19 | self.rgb = rgb.cuda() |
| 20 | self.depth = depth.cuda() |
| 21 | self.K = K |
| 22 | |
| 23 | if ref_pose is not None: |
| 24 | if len(ref_pose.shape) != 2: |
| 25 | ref_pose = ref_pose.reshape(4, 4) |
| 26 | if type(ref_pose) != torch.Tensor: # from gt data |
| 27 | self.ref_pose = torch.tensor(ref_pose, requires_grad=False, dtype=torch.float32) |
| 28 | self.ref_pose[:3, 3] += offset # Offset ensures voxel coordinates>0 |
| 29 | else: # from tracked data |
| 30 | self.ref_pose = ref_pose.clone().requires_grad_(False) |
| 31 | self.d_pose = OptimizablePose.from_matrix(torch.eye(4, requires_grad=False, dtype=torch.float32)) |
| 32 | else: |
| 33 | self.ref_pose = None |
| 34 | self.precompute() |
| 35 | |
| 36 | def get_d_pose(self): |
| 37 | return self.d_pose.matrix() |
nothing calls this directly
no test coverage detected