2015-05-14 56 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

相關問題