MCPcopy Create free account
hub / github.com/NVlabs/InstantSplat / camera_to_JSON

Function camera_to_JSON

utils/camera_utils.py:66–86  ·  view source on GitHub ↗
(id, camera : Camera)

Source from the content-addressed store, hash-verified

64
65
66def camera_to_JSON(id, camera : Camera):
67 Rt = np.zeros((4, 4))
68 Rt[:3, :3] = camera.R.transpose()
69 Rt[:3, 3] = camera.T
70 Rt[3, 3] = 1.0
71
72 W2C = np.linalg.inv(Rt)
73 pos = W2C[:3, 3]
74 rot = W2C[:3, :3]
75 serializable_array_2d = [x.tolist() for x in rot]
76 camera_entry = {
77 'id' : id,
78 'img_name' : camera.image_name,
79 'width' : camera.width,
80 'height' : camera.height,
81 'position': pos.tolist(),
82 'rotation': serializable_array_2d,
83 'fy' : fov2focal(camera.FovY, camera.height),
84 'fx' : fov2focal(camera.FovX, camera.width)
85 }
86 return camera_entry
87
88
89def transform_poses_pca(poses):

Callers 1

__init__Method · 0.90

Calls 1

fov2focalFunction · 0.90

Tested by

no test coverage detected