Open3D icon indicating copy to clipboard operation
Open3D copied to clipboard

request text for display in visualization with python

Open yzl96 opened this issue 7 years ago • 13 comments

Hi, I want to display text in visualization. the solution I can get is two: 1.set position (x,y,z), and use a function to display the text in the position. 2. because I want to display text in bounding box, so just add a parameter(text) to open3d.geometry.LineSet().

yzl96 avatar Sep 04 '19 01:09 yzl96

Sorry, @yzl96. This request has not been addressed for a long time. We are considering large update on the visualization module to provide the requested feature.

syncle avatar Oct 05 '19 17:10 syncle

Definitely a wanted feature by many of us!

Duplicate of #2 ?

hcoohb avatar Jan 19 '20 12:01 hcoohb

Please check out this suggestion.

syncle avatar Feb 27 '20 13:02 syncle

We haven't forgotten about this. It will happen. In fact, part of this is already out as part of the new GUI module and the python API for the GUI module, but displaying text in the Render widget is still not possible.

germanros1987 avatar Aug 07 '20 03:08 germanros1987

Still working on this for 0.12

germanros1987 avatar Nov 02 '20 23:11 germanros1987

Hope can add display text function soon. Thanks for your extraordinary work!

Physu avatar Jan 14 '21 09:01 Physu

still waiting for the release of this USEFUL feature

JianqiangDing avatar Mar 10 '21 06:03 JianqiangDing

This feature would be super helpful! When is it likely to be released?

luke-sockhill avatar Mar 31 '21 12:03 luke-sockhill

The new GUI has this as of 0.12:

import numpy as np
import open3d as o3d
import open3d.visualization.gui as gui
import open3d.visualization.rendering as rendering

def make_point_cloud(npts, center, radius):
    pts = np.random.uniform(-radius, radius, size=[npts, 3]) + center
    cloud = o3d.geometry.PointCloud()
    cloud.points = o3d.utility.Vector3dVector(pts)
    colors = np.random.uniform(0.0, 1.0, size=[npts, 3])
    cloud.colors = o3d.utility.Vector3dVector(colors)

def main():
    app = gui.Application.instance
    app.initialize()

    points = make_point_cloud(100, (0, 0, 0), 1.0)

    w = app.create_window("Open3D - 3D Text", 1024, 768)
    widget3d = gui.SceneWidget()
    widget3d.scene = rendering.Open3DScene(w.renderer)
    mat = rendering.Material()
    mat.shader = "defaultUnlit"
    mat.point_size = 5 * w.scaling
    widget3d.scene.add_geometry("Points", points, mat)
    for idx in range(0, len(points.points)):
        widget3d.add_3d_label(points.points[idx], "{}".format(idx))
    bbox = widget3d.scene.bounding_box
    widget3d.setup_camera(60.0, bbox, bbox.get_center())
    w.add_child(widget3d)

    app.run()

if __name__ == "__main__:
    main()

#3233 also adds this to O3DVisualizer, and adds an example in examples/python/gui/text3d.py

prewettg avatar Mar 31 '21 18:03 prewettg

@prewettg When trying to run the code above I get this error: AttributeError: 'open3d.cpu.pybind.visualization.O3DVisualizer' object has no attribute 'add_3d_label'

EDIT: I realise this is because I haven't installed directly from Git, but I cannot find instructions on how to download and install directly from git, could you please point me in the right direction?

luke-sockhill avatar Apr 08 '21 13:04 luke-sockhill

@luke-sockhill I also had the same issue as yours when I was using o3d v1.12, and now I just pip install --upgrade open3d to v1.13, and problems solved. I am not sure how your o3d was installed, but it seems installation from source is not necessary now. I am using python=3.8.

Eralien avatar Jul 09 '21 07:07 Eralien

@luke-sockhill I also had the same issue as yours when I was using o3d v1.12, and now I just pip install --upgrade open3d to v1.13, and problems solved. I am not sure how your o3d was installed, but it seems installation from source is not necessary now. I am using python=3.8.

Thanks, problem solved.

tangyipeng100 avatar Aug 10 '21 08:08 tangyipeng100

For anyone having issues with the above code, here's the updated code: http://www.open3d.org/docs/release/python_example/visualization/index.html#text3d-py

satyajit-ink avatar Jun 29 '22 12:06 satyajit-ink