[英]Generate 3D Surface Map from Skimage Elevation Map (2D numpy.ndarray)
In the skimage Segmentation tutorial , a 3D surface plot of the elevation map generated from the sobel
function was plotted. 在skimage分割教程中 ,绘制了从sobel
函数生成的高程图的3D表面图。
>>> from skimage.filters import sobel
>>> elevation_map = sobel(coins)
Question: elevation_map
appears to be a 2D numpy.ndarray
. 问: elevation_map
似乎是一个2D numpy.ndarray
。 How do we generate the 3D map shown using this? 我们如何生成以此显示的3D地图?
This is likely produced using Paraview/VTK; 这很可能是使用Paraview / VTK产生的;
Try to play around the following: 尝试解决以下问题:
from skimage import data
from skimage.filters import sobel
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
from matplotlib import cm
from scipy.ndimage import zoom
coins = data.coins()
coins = zoom(coins, 10)
elevation_map = sobel(coins)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
m, n=elevation_map.shape
X, Y = np.meshgrid(np.arange(n), np.arange(m))
ax.plot_surface(X, Y, elevation_map, cmap=cm.viridis, antialiased=False)
ax.axis("off")
ax.set_facecolor('black')
plt.show()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.