注册 登录
编程论坛 Matlab

[求助]从GUI的“打开”菜单中如何将任意路径的图形显示出来?

lovenight 发布于 2007-07-03 23:36, 1305 次点击
file=uigetfile('*.gif')
if ~isequal(fie,0)
open(file);
end
这段代码只能找到指定的图象,但是不能将图象显示出来
3 回复
#2
leki2007-07-09 00:19
似乎不能直接显示gif格式的图象吧
#3
geoer2007-07-09 22:16
help imshow
#4
leki2007-07-11 20:04


[filename,filepath,filterindex]=uigetfile(...
{'*.jpg;*.gif;*.tif;*.bmp','All Image Files(*.jpg,*.gif,*.tif,*.bmp)';
'*.jpg','JPG-files(*.jpg)';...
'*.gif','GIF-files(*.gif)';...
'*.tif','TIF-files(*.tif)';...
'*.bmp','BMP-files(*.bmp)';...
'*.*','All Image Files(*.*)'},...
'选择图像文件','untitled.jpg',...
'multiselect','off');

if isequal(filename,0)||isequal(filepath,0)
return;
else
filefullpath=fullfile(filepath,filename);
fimg=imread(filefullpath);
imshow(fimg);
end
这样就可以了,但是显示的gif图象是 黑白的

1