MCPcopy Index your code
hub / github.com/DNA-Rendering/DNA-Rendering / camera_to_JSON

Function camera_to_JSON

scripts/3DGS/utils/camera_utils.py:64–85  ·  view source on GitHub ↗
(id, camera : Camera)

Source from the content-addressed store, hash-verified

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

Callers 1

__init__Method · 0.90

Calls 1

fov2focalFunction · 0.90

Tested by

no test coverage detected