Created
July 5, 2021 11:08
-
-
Save sergeyprokudin/30b41f2020622586e7349fb64ee8cae8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def load_colmap_sparse_points(points3d_path): | |
'''Load COLMAP points3D.txt as numpy array | |
''' | |
with open(points3d_path, 'r') as f: | |
points_txt = f.readlines()[3:] | |
n_points = len(points_txt) | |
points_np = np.zeros([n_points, 6]) | |
for pid, point in enumerate(points_txt): | |
xyz = np.asarray(point.split(' ')[1:4], dtype='float') | |
rgb = np.asarray(point.split(' ')[4:7], dtype='int') / 255 | |
points_np[pid, 0:3] = xyz | |
points_np[pid, 3:6] = rgb | |
return points_np |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment