-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcrop_geometry.py
More file actions
28 lines (24 loc) · 780 Bytes
/
Copy pathcrop_geometry.py
File metadata and controls
28 lines (24 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import argparse
import open3d as o3d
import pathlib
import os
if __name__ == "__main__":
dir_path = pathlib.Path().absolute()
root_path = str(dir_path).split("\\")
root_path = (root_path[:-1])
new_path = "\\"
new_path = new_path.join(root_path)
tmp = os.path.join(new_path, r"temp\tmp.pcd")
pcd = o3d.io.read_point_cloud(tmp)
vis = o3d.visualization.VisualizerWithEditing(-1.0, False, "")
vis.create_window("Lọc thủ công")
vis.add_geometry(pcd)
vis.run()
vis.destroy_window()
geo = vis.get_cropped_geometry()
if len(geo.points) == len(pcd.points):
print(False)
else:
w_path = os.path.join(new_path, r"temp\c_geo.pcd")
o3d.io.write_point_cloud( w_path, geo)
print(True)