matlab - 用两个不同的句柄叠加两个图像,以便以后可以单独设置“CData”
问题描述
我必须处理需要重叠的图像处理,并且它需要能够在set(h1, 'CData' data)
以后处理循环内的性能问题。但是,此要求使其难以相互重叠。
data1 = rand(100, 100);
data1 = rand(100, 100);
figure;
h1 = imagesc(data1);
colormap('hot')
h1.AlphaData = 0.5;
figure;
h2 = imagesc(data2);
colormap('cool')
h2.AlphaData = 0.5;
for 1=1:200
data1 = rand(100, 100);
set(h1, 'CData', data1);
data2 = rand(100, 100);
set(h2, 'CData', data2);
% How do I overlap these two images here? If possible the most efficient way possible since the data will be a large matrix in real-life.
drawnow;
end
知道如何实现这一目标吗?提前致谢。
编辑:预期的输出将与此类似,其中两个图像以半透明度相互叠加(或不降低透明度也可以,只要两个地图/图像在叠加图像中易于区分):
(取自数学论坛)
每次如果要放入循环中,链接引用都会创建一个新的图像对象,我试图避免这种情况。这就是为什么我决定CData
接近。
解决方案
推荐阅读
- python - 将 JSON 对象转换为 Python 字典
- fpga - Diamond/ModelSim 布线后时序仿真问题
- javascript - Ckeditor5 在我的反应应用程序中无法正常工作
- c# - 使用 C#/.net 的加密服务提供程序
- vba - 如何在不使用 VBA 名称的情况下引用对象?
- apache-spark - 当该行的一列值为 NULL 时,Spark Dataframe 为整行返回 NULL
- android - Firebase OTP 在收到 OTP 号码后将 Flutter 应用上传到 Play 商店后未验证 SMS 代码
- python - 将熊猫数据框中的列表转换为列表变量
- php - 未经身份验证的用户的 Laravel 测试 assertRedirect
- python - 有没有办法在二维数组上使用 setdiff1d?