MATLAB如何在同一窗口中显示两幅图片

2023-05-16

该例子来源于matlab官网

This is an example of how to display multiple images in a subplot in MATLAB®.

有关同一图像窗口显示多幅图片的例子。

Read about the image function in the MATLAB documentation.

请阅读matlab参考文档中中相关的image函数

For more examples, go to MATLAB Plot Gallery

相应的阅读,请点击链接。

% Read the data for the original image------第一幅图像的输入和名字的定义及其来源(地址)
original = imread('ngc6543a.jpg');

% Create the first image display using the image command -----使用matlab命令行 显示该图像
figure
subplot(1, 2, 1)%详见https://cn.mathworks.com/help/matlab/ref/subplot.html#btw1t4b-2_1
image(original)
axis square

% Add title for first image----该图像的标题(注意是图像的标题)
title('Original image')

% Create the data for the second image----同理如上
heatmap = mean(original, 3);%对图像进行求值

% Create the second image display using the image command
subplot(1, 2, 2)
image(heatmap)
colormap(hot)
original = imread('ngc6543a.jpg');

% Create the first image display using the image command -----使用matlab命令行 显示该图像
figure
subplot(1, 2, 1)%详见https://cn.mathworks.com/help/matlab/ref/subplot.html#btw1t4b-2_1
image(original)
axis square

% Add title for first image----该图像的标题(注意是图像的标题)
title('Original image')

% Create the data for the second image----同理如上
heatmap = mean(original, 3);%对图像进行求值

% Create the second image display using the image command
subplot(1, 2, 2)
image(heatmap)
colormap(hot)
%详见色图函数https://baike.baidu.com/link?url=8lq7P6O17bSdgtx3YszRlYfWOVqffBEa21Hj-FlO31n0tUe8TehHEIWK69-oGygSB4vitgRDRNI9fW8f6jwhSw_NINfeDnNMp4Gv7nwNKse
axis square

% Add title for the second image
title('Intensity Heat Map')

axis square

% Add title for the second image
title('Intensity Heat Map')

Display_Image_3_01.png

 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

MATLAB如何在同一窗口中显示两幅图片 的相关文章

随机推荐