Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can one set the line thickness of geometry.OrientedBoundingBox? #5637

Closed
3 tasks done
gc625 opened this issue Nov 1, 2022 · 4 comments
Closed
3 tasks done

How can one set the line thickness of geometry.OrientedBoundingBox? #5637

gc625 opened this issue Nov 1, 2022 · 4 comments
Labels

Comments

@gc625
Copy link

gc625 commented Nov 1, 2022

Checklist

My Question

I'm using open3d to visualize bounding box predictions of an point-based object detection model. The issue is that I have no matter what I try, seems like I cannot change the line thickness of the boxes I draw with geometry.OrientedBoundingBox. Attempting to directly modify the LineSet attribute yields the error

AttributeError: 'open3d.cpu.pybind.geometry.OrientedBoundingBox' object attribute 'LineSet' is read-only

trying to change the line width property of the render options via

    opt = vis.get_render_option()
    opt.line_width = 5

also does not work. So how can I adjust the line width of bounding box objects?

@gc625 gc625 added the question label Nov 1, 2022
@ZoangX
Copy link

ZoangX commented Oct 11, 2023

Recently, I met the same problem as you. Have you solved it? @gc625

@saurabheights
Copy link
Contributor

saurabheights commented Oct 11, 2023

@ZoangX See https://stackoverflow.com/a/77055132/1874627. Install open3d from http://www.open3d.org/docs/latest/getting_started.html#development-version-pip to make it work.

@benjaminum This issue should be closed. The related bug has been fixed in #6116.

@Mingrui-Yu
Copy link

Hi, I met the same problem. But when I try to download the latest open3d from http://www.open3d.org/docs/latest/getting_started.html#development-version-pip ,
it reports:
No such object: open3d-releases/python-wheels/open3d-0.18.0+0cf605f-cp38-cp38-manylinux_2_27_x86_64.whl.

When I try to install by pip, it reports:
ERROR: HTTP error 404 while getting https://storage.googleapis.com/open3d-releases/python-wheels/open3d-0.18.0%2B0cf605f-cp38-cp38-manylinux_2_27_x86_64.whl (from https://www.open3d.org/docs/latest/getting_started.html) ERROR: Could not install requirement open3d from https://storage.googleapis.com/open3d-releases/python-wheels/open3d-0.18.0%2B0cf605f-cp38-cp38-manylinux_2_27_x86_64.whl because of HTTP error 404 Client Error: Not Found for url: https://storage.googleapis.com/open3d-releases/python-wheels/open3d-0.18.0%2B0cf605f-cp38-cp38-manylinux_2_27_x86_64.whl for URL https://storage.googleapis.com/open3d-releases/python-wheels/open3d-0.18.0%2B0cf605f-cp38-cp38-manylinux_2_27_x86_64.whl (from https://www.open3d.org/docs/latest/getting_started.html)

@YuYuCodeNoob
Copy link

Use the O3DVisualizer

import numpy as np
import open3d as o3d
import open3d.visualization.gui as gui
print("Let's draw a box using o3d.geometry.LineSet.")
points = [
[0, 0, 0],
[1, 0, 0],
[0, 1, 0],
[1, 1, 0],
[0, 0, 1],
[1, 0, 1],
[0, 1, 1],
[1, 1, 1],
]
lines = [
[0, 1],
[0, 2],
[1, 3],
[2, 3],
[4, 5],
[4, 6],
[5, 7],
[6, 7],
[0, 4],
[1, 5],
[2, 6],
[3, 7],
]
colors = [[1, 0, 0] for i in range(len(lines))]
line_set = o3d.geometry.LineSet(
points=o3d.utility.Vector3dVector(points),
lines=o3d.utility.Vector2iVector(lines),
)
line_set.colors = o3d.utility.Vector3dVector(colors)
point_cloud2 = o3d.geometry.PointCloud()
point_cloud2.points = o3d.utility.Vector3dVector(points)
point_cloud2.paint_uniform_color([0, 1, 0])
geometries = [line_set, point_cloud2]
gui.Application.instance.initialize()
vis = o3d.visualization.O3DVisualizer("03DVisualizer",1920,1080)
vis.line_width = 5 # set line width
# set the background color
bg_color = np.array([0.0, 0.0, 0.0, 1.0], dtype=np.float32)
vis.set_background(bg_color=bg_color, bg_image = None)
for i,geom in enumerate(geometries):
    vis.add_geometry(f"geom{i}",geom)
vis.show_skybox(False)
gui.Application.instance.add_window(vis)
gui.Application.instance.run()
vis.destroy()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants