wkentaro / octomap-python

Python binding of the OctoMap library.
81 stars 28 forks source link

how to display octomap in numpy image or cv2 #7

Open DomL2018 opened 2 years ago

DomL2018 commented 2 years ago

Hi @wkentaro

Thanks for your genius work, and very much indeed, I am just wondering if you can guide me on how to display the mapping results using numpy image , or Cv2 image , instead your build in visualisation.

many thanks, Dom

wkentaro commented 2 years ago

You have to somehow render the voxel grids to get 2D image. A naive way of this is projecting voxel centers to image (the inverse function of https://github.com/wkentaro/octomap-python/blob/c948ec8e25c24824f2b0c9be8dcb0821a858ec02/examples/insertPointCloud.py#L14-L25).

DomL2018 commented 2 years ago

thanks, @wkentaro for kind reply , is it possible to extract 3d image from (hbox) or 'scene' object or 'gui' objects, and display using matplotlib?

DomL2018 commented 2 years ago

actually, @wkentaro, I just minimum expectation is to draw some line or text on the visualisation window (pyglet) surrounding the particular objects which are consistent with RGB color image

thanks again D

wkentaro commented 2 years ago

I'm not exactly sure what you want to do, but that should be possible with using trimesh as done here https://github.com/wkentaro/octomap-python/blob/c948ec8e25c24824f2b0c9be8dcb0821a858ec02/examples/insertPointCloud.py#L67-L71 but text is not supported in trimesh at the moment.