如何在 matlab gui 中的轴中显示切片图像?

How to display the sliced image in an axes in matlab gui?

我使用 mat2cell() 函数对图像进行了切片。而且我能够一起显示 subplot 中的所有切片图像。但我想使用 axes 在 GUI 中显示相同内容。这是我想在 axes 中显示的图像。

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

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});

我不知道如何在一张中显示这 4 张图片 axes

有什么建议吗?

提前致谢!

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

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)

原图

拆分图像

新图片

希望对您有所帮助。