我有一个.pcd文件,需要对其进行可视化并从文件中选取点。
我正在使用:
import numpy as np
from open3d import *
def main():
pcd = read_point_cloud("C:/Users/rsr5le/Desktop/m_data_2018_11_19__15_58_08.pcd") # Read the point cloud
draw_geometries([pcd]) # Visualize the point cloud
if __name__ == "__main__":
main()
xyz是我需要在文件中选择的点。
答案 0 :(得分:0)
您可以将点放入numpy数组中,并在它们中进行搜索以找到其在点数组中的索引,
point_to_find = np.array([2, 3, 4]) # this is your xyz
point_cloud_array = np.asarray(pcd.points)
try:
print(np.where(np.all(point_cloud_array==point_to_find, axis=1))[0][0])
except:
print("not in array")
答案 1 :(得分:0)
请使用open3d.VisualizerWithEditing
和以下代码。在运行可视化工具时,请记住按Shift +左键单击。如果正确按下,应该可以看到在可视化器中添加了一个球体
import open3d
a = open3d.read_point_cloud("a.pcd")
# Visualize cloud and edit
vis = open3d.VisualizerWithEditing()
vis.create_window()
vis.add_geometry(a)
vis.run()
# Picked point #84 (-0.00, 0.01, 0.01) to add in queue.
# Picked point #119 (0.00, 0.00, -0.00) to add in queue.
# Picked point #69 (-0.01, 0.02, 0.01) to add in queue.
vis.destroy_window()
print(vis.get_picked_points()) #[84, 119, 69]