From f0fa0f709c7db4d7a9384ddb725c942553881979 Mon Sep 17 00:00:00 2001 From: Shaohui Liu Date: Tue, 11 Nov 2025 16:24:14 +0100 Subject: [PATCH 1/2] Upgrade open3d dependency to 0.19.0 and fix colmap visualizer. --- requirements.txt | 4 ++-- visualize_colmap_model.py | 28 +++++++++++++++++++++------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/requirements.txt b/requirements.txt index 482e0edb..b1e73784 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,8 +20,8 @@ einops ninja yacs pytest -numpy<=1.26.4 # Tag numpy 1.26.4 for Open3D issue (https://github.com/numpy/numpy/issues/26853) -open3d==0.18.0 +numpy +open3d==0.19.0 pycolmap==3.13.0 ruff==0.6.7 clang-format==19.1.0 diff --git a/visualize_colmap_model.py b/visualize_colmap_model.py index dcff7dc5..37cff8bf 100644 --- a/visualize_colmap_model.py +++ b/visualize_colmap_model.py @@ -21,10 +21,10 @@ def parse_args(): help="whether to use computed robust ranges", ) arg_parser.add_argument( - "--scale", + "--point_size", type=float, - default=1.0, - help="scaling both the lines and the camera geometry", + default=2.0, + help="Point size", ) arg_parser.add_argument( "--cam_scale", @@ -32,6 +32,12 @@ def parse_args(): default=1.0, help="scale of the camera geometry", ) + arg_parser.add_argument( + "--reproj_error_thresh", + type=float, + default=2.0, + help="reprojection error threshold", + ) args = arg_parser.parse_args() return args @@ -39,17 +45,25 @@ def parse_args(): def vis_colmap_reconstruction(recon: pycolmap.Reconstruction, ranges=None): vis = o3d.visualization.Visualizer() vis.create_window(height=1080, width=1920) - points = np.array([point.xyz for _, point in recon.points3D.items()]) - pcd = limapvis.open3d_get_points(points, ranges=ranges) + pts = np.array([p.xyz for p in recon.points3D.values()], dtype=np.float32) + if args.reproj_error_thresh > 0.0: + errs = np.array([p.error for p in recon.points3D.values()], dtype=np.float32) + mask = (errs <= args.reproj_error_thresh) # e.g. keep colored, low-error + pts = pts[mask] + print(f"Number of valid points for visualization: {pts.shape[0]}") + pcd = limapvis.open3d_get_points(pts, ranges=ranges) vis.add_geometry(pcd) imagecols = pointsfm.convert_colmap_to_imagecols(recon) camera_set = limapvis.open3d_get_cameras( imagecols, ranges=ranges, - scale_cam_geometry=args.scale * args.cam_scale, - scale=args.scale, + scale_cam_geometry=args.cam_scale, ) vis.add_geometry(camera_set) + + opt = vis.get_render_option() + opt.point_size = args.point_size + vis.run() vis.destroy_window() From 3f4bc0e6d3b087f8d374c78bd2bf45ca710420b2 Mon Sep 17 00:00:00 2001 From: Shaohui Liu Date: Tue, 11 Nov 2025 16:45:38 +0100 Subject: [PATCH 2/2] format --- visualize_colmap_model.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/visualize_colmap_model.py b/visualize_colmap_model.py index 37cff8bf..dff4c8d1 100644 --- a/visualize_colmap_model.py +++ b/visualize_colmap_model.py @@ -42,13 +42,17 @@ def parse_args(): return args -def vis_colmap_reconstruction(recon: pycolmap.Reconstruction, ranges=None): +def vis_colmap_reconstruction( + args, recon: pycolmap.Reconstruction, ranges=None +): vis = o3d.visualization.Visualizer() vis.create_window(height=1080, width=1920) pts = np.array([p.xyz for p in recon.points3D.values()], dtype=np.float32) if args.reproj_error_thresh > 0.0: - errs = np.array([p.error for p in recon.points3D.values()], dtype=np.float32) - mask = (errs <= args.reproj_error_thresh) # e.g. keep colored, low-error + errs = np.array( + [p.error for p in recon.points3D.values()], dtype=np.float32 + ) + mask = errs <= args.reproj_error_thresh # e.g. keep colored, low-error pts = pts[mask] print(f"Number of valid points for visualization: {pts.shape[0]}") pcd = limapvis.open3d_get_points(pts, ranges=ranges) @@ -74,7 +78,7 @@ def main(args): if args.use_robust_ranges: points = np.array([point.xyz for _, point in recon.points3D.items()]) ranges = limapvis.compute_robust_range_points(points) - vis_colmap_reconstruction(recon, ranges=ranges) + vis_colmap_reconstruction(args, recon, ranges=ranges) if __name__ == "__main__":