[filename,pathname]=uigetfile({'*.jpg';'*.bmp';'*.gif';'tif'},'±°')
这一段是用来读入图片的
附件里是整个代码和生成fig文件,及效果图
代码如下
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global I
[filename,pathname]=uigetfile({'*.jpg';'*.bmp';'*.gif';'tif'},'±°')
if filename~=0
I=imread(strcat(pathname,filename));
axes(handles.axes1);
imshow(I);
end
set(handles.edit1,'string',[pathname filename]);
1