Matlab-在同一窗口中显示两个具有原始尺寸的图像 [英] Matlab - Display two images with original dimensions in the same window

查看:456
本文介绍了Matlab-在同一窗口中显示两个具有原始尺寸的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have two grayscale images, I1 of size (w1,h1), and I2 of size (w2,h2). I would like Matlab to display them in the same figure, like this:

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

此代码可以调整图像的大小,以便以相同的宽度显示.

This code makes the images to be resized in order to be displayed with the same width.

我想保持图像的原始大小(每个图像的每个像素在屏幕上占一个像素).有什么我可以传递给子图或imshow的选项吗?

I would like to keep the images in their original sizes (each pixel of each image takes one pixel on the screen). Is there any option I can pass to subplot or imshow to do this ?

推荐答案

使用 truesize :

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

如果屏幕上不显示警告,则会收到警告.喜欢:

You will get a warning if it doesn't fit on the screen. Like:

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


它对我有用,因为我使用的两个图像的大小相同.显然一般情况下是行不通的.


It worked for me because the two images I used had the same size. Apparently the general case doesn't work.

这篇关于Matlab-在同一窗口中显示两个具有原始尺寸的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆