【发布时间】:2015-07-29 19:34:27
【问题描述】:
我正在编写图像注册代码,我想将固定图像 (handles.imgFixed) 和移动图像 (handles.imgMoving) 保存到 MATLAB 工作区中。这样,我计划使用 evalin 将这些变量带回 MATLAB GUI 以进行进一步分析。这是我的 GUI 代码:
function uploadFixed_Callback(hObject, ~ , handles)
% hObject handle to uploadFixed (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[filename, pathname] = uigetfile({'*.gif; *.png; *.jpg; *.tif', 'Image Files(*.gif,*.png,*.jpg,*.tif)';'*', 'All files'}, 'File Selector');
set(handles.output,'CurrentAxes',handles.imgFixed);
handles.fixPath = strcat(pathname,filename);
hold off;
imshow(handles.fixPath);
hold on;
set( get(handles.imgFixed,'Children'),'ButtonDownFcn', {@imgFixed_ButtonDownFcn,handles});
set( get(handles.imgMoving,'Children'), 'ButtonDownFcn', {@imgMoving_ButtonDownFcn,handles});
guidata(hObject,handles);
% --- Executes on button press in uploadMoved.
function uploadMoved_Callback(hObject, eventdata, handles)
% hObject handle to uploadMoved (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[filename,pathname] = uigetfile({'*.gif; *.png; *.jpg; *.tif', 'Image Files (*.gif,*.png,*.jpg,*.tif'; '*', 'All Files'}, 'File Selector');
set(handles.output, 'CurrentAxes', handles.imgMoving);
handles.movePath = strcat(pathname,filename);
hold off;
imshow(handles.movePath);
hold on;
set( get(handles.imgFixed,'Children'), 'ButtonDownFcn', {@imgFixed_ButtonDownFcn,handles});
set( get(handles.imgMoving,'Children'), 'ButtonDownFcn', {@imgMoving_ButtonDownFcn,handles});
guidata(hObject,handles);
% --- Executes on mouse press over axes background.
function imgFixed_ButtonDownFcn(hObject, eventdata, handles)
% hObject handle to imgFixed (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.output, 'CurrentAxes', handles.imgFixed);
imshow(handles.imgFixed);
% --- Executes on mouse press over axes background.
function imgMoving_ButtonDownFcn(hObject, eventdata, handles)
% hObject handle to imgMoving (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.output, 'CurrentAxes', handles.imgMoving);
imshow(handles.imgMoving);
谢谢-感谢您的宝贵时间和建议
【问题讨论】:
标签: matlab matlab-guide