| 45 | self.cameras, self.images, self.points3D = read_model(path, ext) |
| 46 | |
| 47 | def add_points(self, min_track_len=3, remove_statistical_outlier=True): |
| 48 | pcd = open3d.geometry.PointCloud() |
| 49 | |
| 50 | xyz = [] |
| 51 | rgb = [] |
| 52 | for point3D in self.points3D.values(): |
| 53 | track_len = len(point3D.point2D_idxs) |
| 54 | if track_len < min_track_len: |
| 55 | continue |
| 56 | xyz.append(point3D.xyz) |
| 57 | rgb.append(point3D.rgb / 255) |
| 58 | |
| 59 | pcd.points = open3d.utility.Vector3dVector(xyz) |
| 60 | pcd.colors = open3d.utility.Vector3dVector(rgb) |
| 61 | |
| 62 | # remove obvious outliers |
| 63 | if remove_statistical_outlier: |
| 64 | [pcd, _] = pcd.remove_statistical_outlier(nb_neighbors=20, |
| 65 | std_ratio=2.0) |
| 66 | |
| 67 | # open3d.visualization.draw_geometries([pcd]) |
| 68 | self.__vis.add_geometry(pcd) |
| 69 | self.__vis.poll_events() |
| 70 | self.__vis.update_renderer() |
| 71 | |
| 72 | def add_cameras(self, scale=1): |
| 73 | frames = [] |