(self, focal_length, K)
| 144 | ) |
| 145 | |
| 146 | def initialize_camera_params(self, focal_length, K): |
| 147 | # Extrinsics |
| 148 | self.R = torch.diag(torch.tensor([1, 1, 1])).float().to(self.device).unsqueeze(0) |
| 149 | |
| 150 | self.T = torch.tensor([0, 0, 0]).unsqueeze(0).float().to(self.device) |
| 151 | |
| 152 | # Intrinsics |
| 153 | if K is not None: |
| 154 | self.K = K.float().reshape(1, 3, 3).to(self.device) |
| 155 | else: |
| 156 | assert focal_length is not None, "focal_length or K should be provided" |
| 157 | self.K = ( |
| 158 | torch.tensor([[focal_length, 0, self.width / 2], [0, focal_length, self.height / 2], [0, 0, 1]]) |
| 159 | .float() |
| 160 | .reshape(1, 3, 3) |
| 161 | .to(self.device) |
| 162 | ) |
| 163 | self.bboxes = torch.tensor([[0, 0, self.width, self.height]]).float() |
| 164 | self.K_full, self.image_sizes = update_intrinsics_from_bbox(self.K, self.bboxes) |
| 165 | self.cameras = self.create_camera() |
| 166 | |
| 167 | def set_intrinsic(self, K): |
| 168 | self.K = K.reshape(1, 3, 3) |
no test coverage detected