Implement interactive point cloud selection (with open3d python code)
Published in
May 13, 2024
Here, the selection of individual points for displaying point clouds is achieved
Hold down shift and left click to select a single point.
After closing the display interface, the serial number of the selected point will be displayed
code is below:
# coding:utf-8
import numpy as np
import open3d as o3d
# wechat:394467238
print("->正在加载点云... ")
point_cloud = o3d.io.read_point_cloud("kitti_p.pcd")
print(point_cloud)
point_cloud2 = point_cloud.voxel_down_sample(voxel_size=0.5) # voxel_down_sample 把点云分配在三维的网格中取平均值
print(" 按住 [shift + right click] 选择点")
vis = o3d.visualization.VisualizerWithEditing()
vis.create_window()
vis.add_geometry(point_cloud2)
vis.run() # user picks points
vis.destroy_window()
print("")
pick_p = vis.get_picked_points()
print(pick_p) # 会打印出选择的点的序号
If you have any questions or customized development requirements, you can contact me Email : lonlonago@foxmail.com or WhatsApp : +8617873123809