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

该例子来源于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

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值