在X-Z平面上显示图像(而不是默认的X-Y)

时间:2016-08-23 15:11:43

标签: image matlab plot matlab-figure axes

我可以使用imagesc在X-Y平面上获得图像图,但现在我希望将它放在X-Z平面上以供进一步使用。有没有办法这样做?谢谢!

1 个答案:

答案 0 :(得分:3)

我使用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(:))]);

几点说明:

  1. 您可能需要在{<1>}或flipud 2 nd fliplr图中的一些输入(取决于您如何定义surface } transition)。
  2. 表示方式输出相同,,如果您尝试比较节点的值,则不会在Y -> Z和{{1}之间得到相同的结果输出。原因是表面是使用顶点定义的,Image对象是使用每个正方形中心的值定义的。
  3. <强>输出:

    Comparison of outputs