I have plotted a point cloud using the following function:
def plot_pointcloud(points):
xyz = points[:, :3]
pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(xyz)
# pcd.colors = o3d.utility.Vector3dVector(points[:, -1])
o3d.visualization.draw_geometries([pcd]) # Uncomment this to see the plot
However, I have two questions:
Would appreciate your help.
Thank You.
To highlight your four points, you can create a second point cloud and give this a different colour to the first.
base_point_cloud = o3d.geometry.PointCloud()
picked_point_cloud = o3d.geometry.PointCloud()
base_point_cloud.points = o3d.utility.Vector3dVector(base_3d_pts)
picked_point_cloud.points = o3d.utility.Vector3dVector(picked_3d_pts)
picked_point_cloud.colors = o3d.utility.Vector3dVector(picked_3d_pts)
o3d.visualization.draw_geometries([picked_point_cloud, point_cloud, axis_mesh])
Where base_3d_pts and picked_3d_pts are your 3D points in a numpy array.
An example screenshot is shown below:
You can create a function like this and pass points to it.
def create_geometry_at_points(points):
geometries = o3d.geometry.TriangleMesh()
for point in points:
sphere = o3d.geometry.TriangleMesh.create_sphere(radius=0.005) #create a small sphere to represent point
sphere.translate(point) #translate this sphere to point
geometries += sphere
geometries.paint_uniform_color([1.0, 0.0, 0.0])
return geometries
Then call:
highlight_pnts = create_geometry_at_points(pcd.points)
o3d.visualization.draw_geometries([pcd, highlight_pnts])
To draw the cube with points :
box = o3d.geometry.TriangleMesh.create_box(width=1.0, height=1.0, depth=1.0, create_uv_map=False, map_texture_to_each_face=False)
box.translate(centre point for box)
o3d.visualization.draw_geometries([pcd, highlight_pnts, box])
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.