MCPcopy Create free account
hub / github.com/Ropedia/SpatialBench / apply_sim3_to_c2w

Function apply_sim3_to_c2w

benchmark/utils/sim3_align.py:191–214  ·  view source on GitHub ↗

Apply SIM(3) transform to cam2world 4x4 pose matrices. Args: c2w_44: (N, 4, 4) cam2world homogeneous matrices s: scale R: (3, 3) t: (3,) Returns: (N, 4, 4) transformed cam2world

(c2w_44, s, R, t)

Source from the content-addressed store, hash-verified

189
190
191def apply_sim3_to_c2w(c2w_44, s, R, t):
192 """Apply SIM(3) transform to cam2world 4x4 pose matrices.
193
194 Args:
195 c2w_44: (N, 4, 4) cam2world homogeneous matrices
196 s: scale
197 R: (3, 3)
198 t: (3,)
199
200 Returns:
201 (N, 4, 4) transformed cam2world
202 """
203 N = c2w_44.shape[0]
204 S = np.eye(4, dtype=np.float64)
205 S[:3, :3] = s * R
206 S[:3, 3] = t
207
208 result = np.zeros_like(c2w_44)
209 for i in range(N):
210 transformed = S @ c2w_44[i]
211 # Normalize the rotation part (remove scale)
212 transformed[:3, :3] /= s
213 result[i] = transformed
214 return result
215
216
217def depth_to_world_points(depth, intrinsics, extrinsics_w2c, device=None):

Callers 3

predictMethod · 0.90
predictMethod · 0.90
predictMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected