|
@@ -89,6 +89,21 @@ def read_points3D_text(path):
|
|
|
xyzs = None
|
|
xyzs = None
|
|
|
rgbs = None
|
|
rgbs = None
|
|
|
errors = None
|
|
errors = None
|
|
|
|
|
+ num_points = 0
|
|
|
|
|
+ with open(path, "r") as fid:
|
|
|
|
|
+ while True:
|
|
|
|
|
+ line = fid.readline()
|
|
|
|
|
+ if not line:
|
|
|
|
|
+ break
|
|
|
|
|
+ line = line.strip()
|
|
|
|
|
+ if len(line) > 0 and line[0] != "#":
|
|
|
|
|
+ num_points += 1
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ xyzs = np.empty((num_points, 3))
|
|
|
|
|
+ rgbs = np.empty((num_points, 3))
|
|
|
|
|
+ errors = np.empty((num_points, 1))
|
|
|
|
|
+ count = 0
|
|
|
with open(path, "r") as fid:
|
|
with open(path, "r") as fid:
|
|
|
while True:
|
|
while True:
|
|
|
line = fid.readline()
|
|
line = fid.readline()
|
|
@@ -100,14 +115,11 @@ def read_points3D_text(path):
|
|
|
xyz = np.array(tuple(map(float, elems[1:4])))
|
|
xyz = np.array(tuple(map(float, elems[1:4])))
|
|
|
rgb = np.array(tuple(map(int, elems[4:7])))
|
|
rgb = np.array(tuple(map(int, elems[4:7])))
|
|
|
error = np.array(float(elems[7]))
|
|
error = np.array(float(elems[7]))
|
|
|
- if xyzs is None:
|
|
|
|
|
- xyzs = xyz[None, ...]
|
|
|
|
|
- rgbs = rgb[None, ...]
|
|
|
|
|
- errors = error[None, ...]
|
|
|
|
|
- else:
|
|
|
|
|
- xyzs = np.append(xyzs, xyz[None, ...], axis=0)
|
|
|
|
|
- rgbs = np.append(rgbs, rgb[None, ...], axis=0)
|
|
|
|
|
- errors = np.append(errors, error[None, ...], axis=0)
|
|
|
|
|
|
|
+ xyzs[count] = xyz
|
|
|
|
|
+ rgbs[count] = rgb
|
|
|
|
|
+ errors[count] = error
|
|
|
|
|
+ count += 1
|
|
|
|
|
+
|
|
|
return xyzs, rgbs, errors
|
|
return xyzs, rgbs, errors
|
|
|
|
|
|
|
|
def read_points3D_binary(path_to_model_file):
|
|
def read_points3D_binary(path_to_model_file):
|