Reputation: 155
I have sliced an image using mat2cell()
function. And I'm able to display all the sliced images in subplot
's together. But I want to display the same in GUI using axes
. This is the image I wanted to show in axes
.
This is the code I used to slice the image:
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});
I don't know how to display these 4 images in a single axes
.
Any suggestions?
Thanks in advance!
Upvotes: 0
Views: 157
Reputation: 5190
It seems not possible to add more than one image on a single axes. I run your code and I've got the impression that your goal is to divide the original image into 4 pieces then to mix them and obtain a new image. If so, what about to take the 4 pieces (the 4 cellarrays) and generate a new matrix and then to display it on a single axes?
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)
Original image
Split image
New image
Hope this helps.
Upvotes: 1