如何在使用imshowpair函数后保存图像

时间:2016-05-20 12:05:15

标签: image matlab image-processing

您好我在imshowpair功能中使用后试图保存/显示图像。以下代码不起作用。有谁知道我怎么能达到我的目的?

final = imshowpair(img1, img2, 'montage');
imshow(final);              // -> not working
imwrite(final,'path.....'); // -> also not working

1 个答案:

答案 0 :(得分:0)

以下是您需要做的事情,能够以imshowpair显示图片的方式保存图片:

I = imread('peppers.png'); % Dummy image.
I2 = imfilter(I, ones(3,3)); % Dummy image 2.
imshowpair(I, I2, 'montage'); 
I3 = [I, I2]; % This line makes a montage out of the two images.
imshow(I3) % This is effectively what imshowpair displays.
imwrite(I3, 'myfile.png'); % Save I3 to a file.