MCPcopy Create free account
hub / github.com/TeleHuman/PBHC / initialize_camera_params

Method initialize_camera_params

smpl_vis/utils/renderer.py:146–165  ·  view source on GitHub ↗
(self, focal_length, K)

Source from the content-addressed store, hash-verified

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)

Callers 1

__init__Method · 0.95

Calls 2

create_cameraMethod · 0.95

Tested by

no test coverage detected