Exception: Unsupported object type '<class 'open3d.cuda.pybind.geometry.LineSet'>'
- Dominant language
- C++
- Stars
- 14k
- Forks
- 2.6k
- Avg merge
- 5d 18h
- Merged PRs (30d)
- 6
Description
### Checklist
- [X] I have searched for [similar issues](https://github.com/isl-org/Open3D/issues).
- [X] For Python issues, I have tested with the [latest development wheel](http://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [X] I have checked the [release documentation](http://www.open3d.org/docs/release/) and the [latest documentation](http://www.open3d.org/docs/latest/) (for `master` branch).
### Describe the issue
i want to use o3d.visualization.EV.draw to show visualization in localhost, but it can only show point clound(Type=PointCloud: 1),but can not show lineset(Type=LineSet: 4)
### Steps to reproduce the bug
```python
"""
Open3d External visualization
Written by LiuHao
"""
import open3d as o3d
import numpy as np
import matplotlib
def get_coor_colors():
"""
Returns:
rgb: [N, 3]. color list
"""
colors = matplotlib.colors.XKCD_COLORS.values()
color_list = list(colors)
colors_rgba = [matplotlib.colors.to_rgba_array(color) for color in color_list]
label_rgba = np.array(colors_rgba)
label_rgba = label_rgba.squeeze()[:, :3]
return label_rgba
COLORS = get_coor_colors()
NUM_COLOR = COLORS.shape[0]
def translate_boxes_to_open3d_instance(gt_boxes):
"""
4-------- 6
/| /|
5 -------- 3 .
| | | |
. 7 -------- 1
|/ |/
2 -------- 0
"""
center = gt_boxes[0:3]
lwh = gt_boxes[3:6]
axis_angles = np.array([0, 0, gt_boxes[6] + 1e-10])
rot = o3d.geometry.get_rotation_matrix_from_axis_angle(axis_angles)
box3d = o3d.geometry.OrientedBoundingBox(center, rot, lwh)
line_set = o3d.geometry.LineSet.create_from_oriented_bounding_box(box3d)
# import ipdb; ipdb.set_trace(context=20)
lines = np.asarray(line_set.lines)
lines = np.concatenate([lines, np.array([[1, 4], [7, 6]])], axis=0)
line_set.lines = o3d.utility.Vector2iVector(lines)
return line_set, box3d
def get_3d_box_lines(gt_boxes, defualt_color=(0, 1, 0), labels_or_ids=None, score=None):
"""
args:
labels_or_ids : detection category label or track id
"""
for i in range(gt_boxes.shape[0]):
line_set, box3d = translate_boxes_to_open3d_instance(gt_boxes[i])
if labels_or_ids is None:
line_set.paint_uniform_color(defualt_color)
else:
color = COLORS[labels_or_ids[i]%NUM_COLOR]
line_set.paint_uniform_color(color)
return line_set
def draw_scene(pcd_path: str,boxes: np.ndarray, labels_or_ids: np.ndarray ,):
"""
args:
boxes: shape = (N,7)
labels_or_ids: shape = (N,)
"""
pcd = o3d.io.read_point_cloud(pcd_path)
pcd.colors = o3d.utility.Vector3dVector(np.ones((np.asarray(pcd.points).shape[0], 3)))
boxes_lines = get_3d_box_lines(boxes,labels_or_ids=labels_or_ids)
draw = o3d.visualization.EV.draw
draw([{'geometry':pcd,'name':'point clound'},{'geometry':boxes_lines,'name': '3D boxes'}])
if __name__ == "__main__":
bboxes = np.array([[15,0,2,10,5,5,0],[35,5,2,8,6,5,1.7]])
draw_scene("/home/liuhao/ssd/PCDet3d/data/twdto/training/data/2022-11-13_13-37-55_599_1_seg_1_clip_0_sample/sensor_aligned/lidar_top/1668318298.023292707.pcd",boxes=bboxes,labels_or_ids=np.array([1,2]))
```
### Error message
[Open3D INFO] Connection::send() recv failed with: Resource temporarily unavailable
Traceback (most recent call last):
File "/home/liuhao/ssd/PCDet3d/tools/visual_utils/open3d_external_vis.py", line 97, in
draw_scene("/home/liuhao/ssd/PCDet3d/data/twdto/training/data/2022-11-13_13-37-55_599_1_seg_1_clip_0_sample/sensor_aligned/lidar_top/1668318298.023292707.pcd",boxes=bboxes,labels_or_ids=np.array([1,2]))
File "/home/liuhao/ssd/PCDet3d/tools/visual_utils/open3d_external_vis.py", line 91, in draw_scene
draw([{'geometry':pcd,'name':'point clound'},{'geometry':boxes_lines,'name': '3D boxes'}])
File "/home/liuhao/miniconda3/envs/py37/lib/python3.7/site-packages/open3d/visualization/_external_visualizer.py", line 187, in draw
add(g)
File "/home/liuhao/miniconda3/envs/py37/lib/python3.7/site-packages/open3d/visualization/_external_visualizer.py", line 181, in add
self.set(obj=obj, path=path, time=time)
File "/home/liuhao/miniconda3/envs/py37/lib/python3.7/site-packages/open3d/visualization/_external_visualizer.py", line 110, in set
type(obj))))
Exception: Unsupported object type ''
### Expected behavior
_No response_
### Open3D, Python and System information
```markdown
- Operating system: Ubuntu 20.04 / macOS 10.15
- Python version: Python 3.7
- Open3D version: 0.17.0
- System architecture: x86 / arm64
- Is this a remote workstation?: yes
- How did you install Open3D?: pip
```
### Additional information
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.