2015-05-14 161 views
0

我已使用mat2cell()函数切片图像。我可以一起显示subplot的所有切片图像。但我想在GUI中使用axes显示相同的内容。这是我想在axes中展示的图像。如何在matlab GUI中的坐标轴中显示切片图像?

enter image description here

这是我用切片图像的代码:

K = imresize(J,[128 128]); 
C = mat2cell(K,[64,64],[64,64]); 

%plotting 

figure; 
subplot(2,2,1),imshow(C{1}); 
subplot(2,2,2),imshow(C{2}); 
subplot(2,2,3),imshow(C{3}); 
subplot(2,2,4),imshow(C{4}); 

我不知道如何在单个axes显示这些4个图像。

有什么建议吗?

在此先感谢!

+0

像在任何脚本中一样使用'imshow'。请参阅Mathworks的简单演示(http://www.mathworks.com/help/matlab/creating_guis/about-the-simple-programmatic-gui-example.html)。您可以使用相同的想法,显示图像而不是曲面图。如果您需要更多细节,请提供更多关于您想要/尝试的细节,因为您的问题与现在一样非常广泛。谢谢! –

+0

您可以使用命令'axes'。这里有一个例子和说明 - http://www.mathworks.com/help/matlab/creating_guis/axes-menus-and-toolbars-in-programmatic-guis.html – Adiel

回答

1

似乎不可能在单个轴上添加多个图像。 我运行你的代码,我有一个印象,你的目标是将原始图像分成4块,然后混合它们并获得一个新的图像。 如果是这样,怎么样取4件(4个cellarrays)并生成一个新的矩阵,然后将其显示在单个轴上?

a=imread('Jupiter_New_Horizons.jpg'); 

f=figure('unit','normalized','name','ORIGINAL IMAGE'); 
% My image is not BW 
a(:,:,2:3)=[]; 
imshow(a) 

K = imresize(a,[128 128]); 

C = mat2cell(K,[64,64],[64,64]); 

f=figure('unit','normalized','name','SPLIT IMAGE'); 
fp=get(gcf,'position') 

subplot(2,2,1),imshow(C{1}); 
subplot(2,2,2),imshow(C{2}); 
subplot(2,2,3),imshow(C{3}); 
subplot(2,2,4),imshow(C{4}); 

tmp1=C{1,1}; 
tmp2=C{1,2}; 
tmp3=C{2,1}; 
tmp4=C{2,2}; 

TMP=[tmp1 tmp3;tmp2 tmp4]; 

f=figure('unit','normalized','name','NEW IMAGE'); 

ax=axes 

imshow(TMP,'parent',ax) 
set(gcf,'position',fp) 

原图

enter image description here

分割图像

enter image description here

新形象

enter image description here

希望这会有所帮助。

+0

非常感谢。有效 :) – user3483746

相关问题