在Matlab中的3D图像

时间:2013-10-24 15:29:38

标签: image matlab 3d

基于Image Analyst在回答“图像的3d图”问题(http://www.mathworks.com/matlabcentral/answers/48532-3d-plot-of-an-image)时给出的代码,我有一个后续问题:

我简化了代码,我想知道是否可以根据灰度强度(Z轴)对其应用喷射色图,并使其适合图像尺寸(x,y)(例如,在此图像示例中,尺寸为628x600,因此最大x = 628,最大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 个答案:

答案 0 :(得分:3)

如果我正确理解了这个问题,那么改变色彩图并关闭边缘色就是你要找的了

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

如果您想收紧图的边界,可以使用

axis([0 columns 0 rows min(double(I(:))) max(double(I(:)))])