matlab怎么同时显示imshow 两幅图片 | 您所在的位置:网站首页 › matlab多个图像画在一起 › 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); 水平排列: 垂直排列: |
CopyRight 2018-2019 实验室设备网 版权所有 |