Closed JuanIgnacioCG closed 1 year ago
Hey @JuanIgnacioCG,
the solution is to import napari_bbox
before using viewer.add_bounding_boxes
:
import napari_bbox
viewer = napari.Viewer()
viewer.add_points(np.asarray(o3d_pc.points),size=0.05) #loading pointcloud
demo_box = np.asarray(obb.get_box_points())
viewer.add_bounding_boxes(demo_box, edge_width=.3)
The reason is that in order to use this custom layer I had to do some very ugly hacking (I add the method add_bounding_boxes
to the Viewer
class manually). If you want a clearer code, you could do:
from napari_bbox import BoundingBoxLayer
viewer = napari.Viewer()
viewer.add_points(np.asarray(o3d_pc.points),size=0.05) #loading pointcloud
demo_box = np.asarray(obb.get_box_points())
bb_layer = BoundingBoxLayer(demo_box, edge_width=.3)
viewer.add_layer(bb_layer)
Cheers, David
Thanks a lot David, it was so simple :,) , I tried with several names in the napari.add_widget... etc. Thanks a lot for the plugin it is super useful!.
No problem! Glad you like it :)
Hi! great work with the plugin! It is super useful.
I am trying to use napari as a pointcloud visualizer, as part of this task I am doing a small trial on how to visualize bounding boxes. I figured out the way to add bounding boxes from script using:
this works great only if I have started manually the plugin in the viewer button, if I run the code without manually activating the plugin it would raise an error that viewer does not have attribute add_bounding_boxes. How can I add that to the start of the viewer? Also, even though I could understand a bit the class boundingboxes layer it would be great if you could provide some info about it, I would be open to do a small example.py to guide on its use.