在GUI中覆盖两个图像

42次浏览(过去30天)
Dimani4
Dimani4 2021年5月23日
编辑: Dimani42021年5月24日
你好,
我不能在gui中覆盖两张图片,但我成功地做到了这一点。当我在图中这样做时,看看我的代码:
函数link2axes (whole_matrix_sum topography_trace)
图;
ax₁=轴;
拉曼=显示亮度图像(whole_matrix_sum);
ax2 =轴;
topography_image =显示亮度图像(topography_trace);
linkaxes ([ax₁,ax2]);
ax2。可见=“关闭”
ax2。XTick = [];
ax2。YTick = [];
colormap (ax₁“喷气机”);%拉曼
colormap (ax2,“parula”);%地形
集(拉曼,“AlphaData”, double(whole_matrix_sum > 0));
集(topography_image,“AlphaData”, 0.6);
这里我有2张图像(2个40X40像素的矩阵)。当我创建一个图形时,我成功地做到了这一点,但在Gui中无法成功。
在Gui中,我试着写类似的东西,但不知为何它不做覆盖。
见附件图中2张图片叠加的结果(如下附件代码所示)。
我有句柄,在gui中指向axes1为handles.axes1。
我试着根据简单图上的代码编写代码,如下:
轴(handles.axes1);
ax₁= handles.axes1;
拉曼=显示亮度图像(whole_matrix_sum);
raman.Parent;
ax2 = raman.Parent;
topography_image =显示亮度图像(topography_trace);
topography_image =显示亮度图像(handles.topography_trace);
linkaxes ([ax₁,ax2]);
colormap (ax₁“喷气机”);%拉曼
colormap (ax2,“parula”);%地形
集(拉曼,“AlphaData”, double(whole_matrix_sum > 0));
错误使用matlab.graphics.primitive.Image /组
无效的或删除对象。
这是我从另一个函数中得到的地形矩阵这就是为什么它位于句柄中。
我也附加了两个矩阵。
如你所见,我想叠加两张图片,并控制其中一张图片的透明度。
我的错误在哪里?
非常感谢。

答案(0)

类别

了解更多图形对象帮助中心而且文件交换

社区寻宝

在MATLAB Central中找到宝藏,并发现社区如何帮助您!

开始狩猎!