5

我有两个灰度图像,大小为 (w1,h1) 的 I1 和大小为 (w2,h2) 的 I2。我希望 Matlab 将它们显示在同一个图中,如下所示:

figure;
subplot(2,1,1), imshow(I1);
subplot(2,1,2), imshow(I2);

此代码使图像调整大小以便以相同的宽度显示。

我想保持图像的原始大小(每个图像的每个像素在屏幕上占用一个像素)。有什么选项我可以传递给 subplot 或 imshow 来做到这一点?

4

2 回答 2

2

使用truesize

figure
subplot(2,1,1), imshow(I1)
subplot(2,1,2), imshow(I2)
truesize

如果它不适合屏幕,您将收到警告。喜欢:

Warning: Image is too big to fit on screen; displaying at 66% scale.

编辑:它对我有用,因为我使用的两个图像大小相同。显然,一般情况下不起作用。

于 2012-10-09T17:45:00.007 回答
1

尝试这个:

figure;
subplot(2,1,1), imshow(I1); axis equal;
subplot(2,1,2), imshow(I2); axis equal;

您也可以尝试使用axis image.

http://www.mathworks.com/help/matlab/ref/axis.html

于 2012-10-09T17:27:36.707 回答