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

Function camera_to_JSON

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

Source from the content-addressed store, hash-verified

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

Callers 1

__init__Method · 0.90

Calls 1

fov2focalFunction · 0.90

Tested by

no test coverage detected