简体   繁体   中英

how to plot 3D mesh to depth map

I have a 3d triangle mesh

from torch_geometric.data import Data

want to plot it as depth map from top view, so the pixel value of (x,y) equals depth value.

there is a piece of code to plot, but I don't know how to calculate z value for each pair of (x,y)

plt.subplot()
x = data.x[:,1]
y = data.x[:,0]
X, Y = np.meshgrid(x, y)
plt.pcolor(data.x[:,1], data.x[:,0], data.x[:,2] * 255, cmap='RdBu', vmin=0, vmax=255)

You probably want to use tripcolor .

Simply cut off the z -component from your data and use z as the value in your plot:

tpc = ax1.tripcolor(triang, z, shading='flat')

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM