【问题标题】:Loading a stream of images in Matlab GUI在 Matlab GUI 中加载图像流
【发布时间】:2016-04-17 05:08:43
【问题描述】:

这是我的回调函数代码。

function Next_Callback(hObject, eventdata, handles)

display('Click Next');
handles.imgLNum = strcat('I1_',num2str(handles.imageNumber),'.png');
handles.imgRNum = strcat('I2_',num2str(handles.imageNumber),'.png');

handles.imageLeft = strcat(handles.directory,handles.imgLNum);
handles.imageRight = strcat(handles.directory,handles.imgRNum);

axes(handles.img1);
imshow(handles.imageLeft);
axes(handles.img2);
imshow(handles.imageRight);
handles.imageNumber = handles.imageNumber+1;

我的 GUI 上有一个名为“下一步”的按钮,我想在单击时将下一个图像加载到轴中。 handles.imageLefthandles.imageRight 有图像的路径。当第一次点击按钮时,轴会随图像更新。但随后单击按钮不会更新轴。但是控制台中会显示“单击下一步”文本,所以我知道正在调用回调函数。

【问题讨论】:

  • 您需要先读取图片,例如Img=imread(handles.imageRight),然后您可以调用imshow(Img)imshow 不能在路径上工作,只能在矩阵上工作。
  • 我也试过了。但即便如此,我也会被困在同一个地方。
  • 请编辑并显示您到底尝试了什么
  • Here 是我到目前为止所做的完整代码
  • 好的,我没有看到问题,但我不会为你调试它,对不起...设置一些断点并走每一行,检查问题出在哪里...

标签: matlab matlab-guide


【解决方案1】:

感谢@Adiel 的帮助。我根据您的建议发现了问题。我更新了handles.imageLefthandles.imageRight 并添加了代码guidata(hObject, handles); 我认为这个函数会更新句柄(这是我的第一个MATLAB GUI,所以我不太确定)。现在问题已解决。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-08-12
    • 2011-12-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-05
    • 1970-01-01
    相关资源
    最近更新 更多