I try to label certain points (obstacles) with text in my Point Cloud. Currently I have the following Point Cloud:
import open3d as o3d
import numpy as np
pcd = o3d.geometry.PointCloud() # make new frame a pointcloud
pcd.points = o3d.utility.Vector3dVector(img)
obstacles = find_cluster(potential_obstacles)
o3d.visualization.draw_geometries([ pcd, obstacles ],
zoom=0.41999999999999962,
front=[ -0.49481467211023333, 0.062416027669252132, -0.86675410570382283 ],
lookat= [ 0.20215540690279493, 0.25826321104010441, 2.5327259417027266 ],
up=[ 0.068492446325020648, 0.99711550943685279, 0.032702379682518497 ],
width=1920,
height=1080)#
the function find_cluster() is not necessary for further understanding. It returns both the obstacles as colored point clouds numbered with labels and their position [x, y, z] as a numpy array.
I would like to use this information to display the "number" of the obstacle at its position in the point cloud as text.
I came across open3d.visualization.gui.Label3D but do not know how to use it. Can anyone help me out?
Thanks in advance and best regards, AV
I tried the folowing but did not succeed:
o3d.visualization.gui.Label3D('sample Text', [0, 0, 0])
How can I address this command to use the open window?
open3d.visualization.draw_geometries
You can use
open3d.t.geometry.TriangleMesh.create_textto generate a 3D mesh of text and put it where you need it to be.open3d.visualization.gui.Application
The
o3d.visualization.gui.Label3Dis used withopen3d.visualization.gui.Application. See https://www.open3d.org/docs/release/python_api/open3d.visualization.gui.html and check its example here - https://www.open3d.org/docs/release/python_example/visualization/index.html.open3d.visualization.O3DVisualizer
When using
O3DVisualizer, it hasadd_3d_labelmethod which allows to do the same. See docs.