MCPcopy Create free account
hub / github.com/XiaoBaiiiiii/colmap-pcd / read_cameras_text

Function read_cameras_text

scripts/python/read_write_model.py:101–124  ·  view source on GitHub ↗

see: src/base/reconstruction.cc void Reconstruction::WriteCamerasText(const std::string& path) void Reconstruction::ReadCamerasText(const std::string& path)

(path)

Source from the content-addressed store, hash-verified

99
100
101def read_cameras_text(path):
102 """
103 see: src/base/reconstruction.cc
104 void Reconstruction::WriteCamerasText(const std::string& path)
105 void Reconstruction::ReadCamerasText(const std::string& path)
106 """
107 cameras = {}
108 with open(path, "r") as fid:
109 while True:
110 line = fid.readline()
111 if not line:
112 break
113 line = line.strip()
114 if len(line) > 0 and line[0] != "#":
115 elems = line.split()
116 camera_id = int(elems[0])
117 model = elems[1]
118 width = int(elems[2])
119 height = int(elems[3])
120 params = np.array(tuple(map(float, elems[4:])))
121 cameras[camera_id] = Camera(id=camera_id, model=model,
122 width=width, height=height,
123 params=params)
124 return cameras
125
126
127def read_cameras_binary(path_to_model_file):

Callers 1

read_modelFunction · 0.85

Calls 1

CameraClass · 0.50

Tested by

no test coverage detected