Image Matlab-创建不同大小子地块的图形

Image Matlab-创建不同大小子地块的图形,image,matlab,image-processing,plot,charts,Image,Matlab,Image Processing,Plot,Charts,我有一个图像阵列,我需要并排地绘制它们,每个图像都有不同的大小。虽然实际的图像大小相当大,但我想做一些类似imresize的事情来绘制我想要的大小 我尝试过这样的子地块策略 subplot(1, 4, 1); imshow(...); subplot(1, 4, 2); imshow(...); subplot(1, 4, 3); imshow(...); subplot(1, 4, 4); imshow(...); 但是所有的图像都显示为相同的大小。我想要这样的东西 出于某种原因,这似乎不

我有一个图像阵列,我需要并排地绘制它们,每个图像都有不同的大小。虽然实际的图像大小相当大,但我想做一些类似imresize的事情来绘制我想要的大小

我尝试过这样的子地块策略

subplot(1, 4, 1);
imshow(...);
subplot(1, 4, 2);
imshow(...);
subplot(1, 4, 3);
imshow(...);
subplot(1, 4, 4);
imshow(...);
但是所有的图像都显示为相同的大小。我想要这样的东西

出于某种原因,这似乎不是小事。非常感谢您的帮助。

可以通过在语法subplot m,n,p中为网格位置参数p指定多元素向量来实现

您的示例可以由以下内容构成:

subplot(4,10,[1:4 11:14 21:24 31:34]);
subplot(4,10,[5:7 15:17 25:27]);
subplot(4,10,[8:9 18:19]);
subplot(4,10,[10]);
可以通过在语法subplot m,n,p中为grid position参数p指定多元素向量来实现

您的示例可以由以下内容构成:

subplot(4,10,[1:4 11:14 21:24 31:34]);
subplot(4,10,[5:7 15:17 25:27]);
subplot(4,10,[8:9 18:19]);
subplot(4,10,[10]);

您可以向图形中添加4个轴,并设置每个轴的位置:

I = imread('cameraman.tif');

scrsz = get(groot, 'ScreenSize'); %Get screen size
f = figure('Position', [scrsz(3)/10, scrsz(4)/5, scrsz(4)/2*2.4, scrsz(4)/2]); %Set figure position by screen size.
positionVector1 = [-0.25, 0.95-0.9, 0.9, 0.9]; %position vector for largest image.
positionVector2 = [0.23, 0.95-0.6, 0.6, 0.6];
positionVector3 = [0.555, 0.95-0.4, 0.4, 0.4];
positionVector4 = [0.775, 0.95-0.267, 0.267, 0.267]; %position vector for smallest image.
axes(f, 'Position', positionVector1);
imshow(I, 'border', 'tight');
axes(f, 'Position', positionVector2);
imshow(I, 'border', 'tight');
axes(f, 'Position', positionVector3);
imshow(I, 'border', 'tight');
axes(f, 'Position', positionVector4);
imshow(I, 'border', 'tight');
手动设置位置不是最佳解决方案。 必须有一种方法来计算每个轴的位置

结果:

您可以在图形中添加4个轴,并设置每个轴的位置:

I = imread('cameraman.tif');

scrsz = get(groot, 'ScreenSize'); %Get screen size
f = figure('Position', [scrsz(3)/10, scrsz(4)/5, scrsz(4)/2*2.4, scrsz(4)/2]); %Set figure position by screen size.
positionVector1 = [-0.25, 0.95-0.9, 0.9, 0.9]; %position vector for largest image.
positionVector2 = [0.23, 0.95-0.6, 0.6, 0.6];
positionVector3 = [0.555, 0.95-0.4, 0.4, 0.4];
positionVector4 = [0.775, 0.95-0.267, 0.267, 0.267]; %position vector for smallest image.
axes(f, 'Position', positionVector1);
imshow(I, 'border', 'tight');
axes(f, 'Position', positionVector2);
imshow(I, 'border', 'tight');
axes(f, 'Position', positionVector3);
imshow(I, 'border', 'tight');
axes(f, 'Position', positionVector4);
imshow(I, 'border', 'tight');
手动设置位置不是最佳解决方案。 必须有一种方法来计算每个轴的位置

结果:

您可以手动设置每个轴的位置和大小,请参见其“位置”属性。您可以手动设置每个轴的位置和大小,请参见其“位置”属性。