您的位置:首页 > 编程语言 > MATLAB

matlab怎么同时显示imshow 两幅图片

2015-03-18 14:45 585 查看
matlab怎么同时显示imshow 两幅图片


方法一:subplot()函数

subplot(2,1,1);
subplot(2,1,2);
分上下或者左右显示两张图片...

例如:

原始图片分两个窗口显示:

hehe=uint8(hehe);
figure(1)
imshow(he), title('原始图像');%显示原始图像
figure(2)
imshow(hehe), title('SLIC分割k=400,m=40');%显示超像素分割图像
两张图片在一个窗口中显示:
hehe=uint8(hehe);
figure(1)
subplot(2,1,1);imshow(he),title('原始图像'); %显示原始图像
%figure(2)
subplot(2,1,2);imshow(hehe),title('SLIC分割k=400,m=40');
%显示超像素分割图像



方法二:montage()函数

使用montage()函数就可,不过要求两幅图像大小必须一样的.cat是个好办法,把2个数据连接在一起。具体使用请help
montage.图示中的例子的代码如下:

gray01=rgb2gray(imread('img01.jpg'));

gray02=rgb2gray(imread('img12.jpg'));

pic=cat(2,gray01,gray02);

figure;

montage(pic)

水平排列:

pic=cat(2,gray01,gray02);

figure, imshow(pic);

垂直排列:

pic=cat(1,gray01,gray02);

figure, imshow(pic);



街上上述例子程序如下:

imshow(he), title('原始图像'); %显示原始图像
imshow(hehe), title('SLIC分割k=400,m=40');
pic=cat(2,he,hehe);
figure, imshow(pic);
水平排列:



垂直排列:



更多,请关注:http://blog.csdn.net/tiandijun/,欢迎交流!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: