Showing RGBD images using graph_objects.Surface?
See original GitHub issueNot an issue exactly, but I am trying to show RGBD images (with Depth) using surface and the ‘hack’ I found to do it now was to convert the image into 8-bit GIF, use the 8-bit index as the value, color the image by value and use the gif 8-bit palette as the colorscale. Is there an easier way, or should I make a tutorial in case someone else wants to do the same thing?
from PIL import Image
img_as_8bit = lambda x: np.array(Image.fromarray(x).convert('P', palette='WEB', dither=None))
dum_img = Image.fromarray(np.ones((3,3,3), dtype='uint8')).convert('P', palette='WEB')
idx_to_color = np.array(dum_img.getpalette()).reshape((-1, 3))
colorscale=[[i/255.0, "rgb({}, {}, {})".format(*rgb)] for i, rgb in enumerate(idx_to_color)]
trace=go.Surface(
z=depth_image,
surfacecolor=img_as_8bit(rgb_image),
cmin=0,
cmax=255,
colorscale=colorscale
)
fig = go.Figure(
data=[trace],
layout_title_text="3D Face Mesh"
)
fig
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Show RGB-D image in 3D Plotly
RGB Surface Code¶. Here is the code using PIL and the web palette to convert our images into nice plotly plots. In [ ......
Read more >RGBD images — Open3D 0.12.0 documentation
The following tutorials show how to read and use RGBD images from a number of well known RGBD datasets. Redwood dataset¶. In this...
Read more >plotly.graph_objects.Surface — 5.11.0 documentation
showlegend – Determines whether or not an item corresponding to this trace is shown in the legend. showscale – Determines whether or not...
Read more >3D rendering of colored surfaces
http://newtec.univ-lille1.fr/Movies/3d/Bodele2-rgbd.html. Here the image, we are using in input, with an elevation model.
Read more >Object Discovery with Metadata. (Top) Robotic agent ...
(Top) Robotic agent navigates through office environment storing an RGBD video ... (b) Images in the sequence are segmented to generate object candidates....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here is a self-contained notebook using public data https://www.kaggle.com/kmader/show-rgb-d-image-in-3d-plotly
@nicolaskruchten So can we have 2D RGB in a 3D plot say, alongside a scatter plot like in the picture below? I couldn’t find a way to do so, I have tried the approach by kmader but looking for a better res image. Thanks