Chri
Chri

Reputation: 1

Open3D o3d.visualization.VisualizerWithEditing() get coordinates from picked point and not index from queue

http://www.open3d.org/docs/release/tutorial/visualization/interactive_visualization.html

def pick_points(pcd):
    print("")
    print(
        "1) Please pick at least three correspondences using [shift + left click]"
    )
    print("   Press [shift + right click] to undo point picking")
    print("2) After picking points, press 'Q' to close the window")
    vis = o3d.visualization.VisualizerWithEditing()
    vis.create_window()
    vis.add_geometry(pcd)
    vis.run()  # user picks points
    vis.destroy_window()
    print("")
    return vis.get_picked_points()

I got this function from Open3D. When I use this code, it only displays the coordinates in the terminal but returns only the index.

[Open3D INFO] Picked point #1375 (10., -0.45, -0.2) to add in queue.

With this index I do not know how I can get the coordinates. Any advice how to get the picked points from a pointcloud?

As a resolution, I want to get the x, y, z coordinate from a picked point (by clicking) from a pointcloud.

Upvotes: 0

Views: 1505

Answers (1)

ksturi
ksturi

Reputation: 1

You can use the returned index to extract the picked point from the point cloud:

 picked_points = np.asarray(pcd.points)[vis.get_picked_points()]

This returns a numpy array containing the clicked points.

Upvotes: 0

Related Questions