| 45 | self.reconstruction = pycolmap.Reconstruction(path) |
| 46 | |
| 47 | def add_points( |
| 48 | self, min_track_len: int = 3, remove_statistical_outlier: bool = True |
| 49 | ) -> None: |
| 50 | pcd = open3d.geometry.PointCloud() |
| 51 | |
| 52 | xyz = [] |
| 53 | rgb = [] |
| 54 | for point in self.reconstruction.points3D.values(): |
| 55 | if point.track.length() < min_track_len: |
| 56 | continue |
| 57 | xyz.append(point.xyz) |
| 58 | rgb.append(point.color / 255) |
| 59 | |
| 60 | pcd.points = open3d.utility.Vector3dVector(xyz) |
| 61 | pcd.colors = open3d.utility.Vector3dVector(rgb) |
| 62 | |
| 63 | # remove obvious outliers |
| 64 | if remove_statistical_outlier: |
| 65 | [pcd, _] = pcd.remove_statistical_outlier( |
| 66 | nb_neighbors=20, std_ratio=2.0 |
| 67 | ) |
| 68 | |
| 69 | # open3d.visualization.draw_geometries([pcd]) |
| 70 | self.visualizer.add_geometry(pcd) |
| 71 | self.visualizer.poll_events() |
| 72 | self.visualizer.update_renderer() |
| 73 | |
| 74 | def add_cameras(self, scale: float = 1) -> None: |
| 75 | frustums = [] |