【发布时间】:2016-08-23 15:11:42
【问题描述】:
我可以使用imagesc 在 X-Y 平面上获得图像图,但现在我想将它放在 X-Z 平面上以供进一步使用。有什么办法吗?谢谢!
【问题讨论】:
标签: image matlab plot matlab-figure axes
我可以使用imagesc 在 X-Y 平面上获得图像图,但现在我想将它放在 X-Z 平面上以供进一步使用。有什么办法吗?谢谢!
【问题讨论】:
标签: image matlab plot matlab-figure axes
我会使用surface 而不是imagesc:
INPUT = [3,4,5
4,5,6];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure();
ZZ = padarray(INPUT,[1 1],0,'post'); % See note #2
[XX,YY] = meshgrid((1:size(INPUT,2)+1)-0.5,(1:size(INPUT,1)+1)-0.5);
% imagesc
subplot(3,1,1); imagesc(INPUT); xlim([0 4]); ylim([0.5 2.5]);
view([-50 50]); xlabel('x'); ylabel('y'); zlabel('z'); grid on;
title('imagesc');
% Normal (X-Y):
subplot(3,1,2); surface(XX,YY,0*XX,ZZ,'EdgeColor','none','FaceColor','flat');
view([-50 50]); xlabel('x'); ylabel('y'); zlabel('z'); axis ij; box on; grid on;
title('X-Y surface'); caxis([min(INPUT(:)),max(INPUT(:))]);
% Rotated (X-Z):
subplot(3,1,3); surface(XX,0*ZZ,YY,ZZ,'EdgeColor','none','FaceColor','flat');
view([-50 50]); xlabel('x'); ylabel('y'); zlabel('z'); axis ij; box on; grid on;
title('X-Z surface'); caxis([min(INPUT(:)),max(INPUT(:))]);
flipud 或fliplr 2ndsurface 图中的某些输入(取决于您如何定义Y -> Z 转换)。X-Y 和 imagesc 输出之间得到相同的结果。原因是表面是使用顶点定义的,而 Image 对象是使用每个正方形中心的值定义的。输出:
【讨论】:
XX,YY,0*ZZ => YY,0*ZZ,XX => 0*ZZ,XX,YY :)