MCPcopy Create free account
hub / github.com/city-super/Octree-GS / camera_to_JSON

Function camera_to_JSON

utils/camera_utils.py:64–84  ·  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 camera_entry = {
75 'id' : id,
76 'img_name' : camera.image_name,
77 'width' : camera.width,
78 'height' : camera.height,
79 'position': pos.tolist(),
80 'rotation': serializable_array_2d,
81 'fy' : fov2focal(camera.FovY, camera.height),
82 'fx' : fov2focal(camera.FovX, camera.width)
83 }
84 return camera_entry
85
86

Callers 1

__init__Method · 0.90

Calls 1

fov2focalFunction · 0.90

Tested by

no test coverage detected