Matlab中图像的三维绘图

3
基于Image Analyst在“3d plot of an image”问题的回答中给出的代码(http://www.mathworks.com/matlabcentral/answers/48532-3d-plot-of-an-image),我有一个后续问题:
我简化了代码,并想知道是否可以根据灰度强度(Z轴)将其应用于jet色图,并使其适合图像尺寸(x,y)(例如,在此图像示例中,尺寸为628x600,因此max x = 628和max y = 600)。
谢谢。
代码:
I = imread('E:\Temp\Canadian_maple_leaf_2.jpg'); % http://en.wikipedia.org/wiki/File:Canadian_maple_leaf_2.jpg
I=rgb2gray(I);
I = imcomplement(I);
[rows columns numberOfColorBands] = size(I);
surf(double(I));
1个回答

3

如果我理解这个问题正确的话,您想要的是更改色图并关闭边缘颜色

surf(double(I),'EdgeColor','none');
colormap jet

如果您想缩小故事情节的范围,可以使用
axis([0 columns 0 rows min(double(I(:))) max(double(I(:)))])

非常感谢。第一部分效果非常好。轴线以2D视角(俯视图)显示图像,并确实将绘图修剪到图像尺寸。是否有办法也修剪3D图形(surfplot)? - hs100

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接