Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
初级会员
注册日期: 2009-04-13
年龄: 38
帖子: 5
声望力: 0 ![]() |
![]()
用了一个显示图像的界面,按下按钮后应该显示图像,运行后显示
Error using ==> imread Unable to determine the file format 该如何改imread函数? 以下是该函数: function varargout = LoadPush_Callback(h, eventdata, handles, varargin)%回调函数 global im_original im_noised im_filtered %global:定义全局变量 [filename, pathname] = uigetfile('*.bmp;*.pgm;*.tif;*.jpg;*.*', 'Load input image');%读取文件 if isequal(filename,0) | isequal(pathname,0) disp('User pressed cancel')%disp:显示 else disp(['User selected ', fullfile(pathname, filename)]) end im_original=imread(filename); set(handles.Or_image,'HandleVisibility','OFF');%handles:句柄 set(handles.Out_image,'HandleVisibility','OFF'); %set(handles.Denoised_image,'HandleVisibility','OFF'); set(handles.Or_image,'HandleVisibility','ON'); axes(handles.Or_image); imshow(im_original); colormap(gray(256)); axis equal;%让图像的大小与框架吻合 axis tight;%同上 axis off;%把数轴关掉 set(handles.Or_image,'HandleVisibility','OFF'); set(handles.Or_image,'XTickLabel',' ','YTickLabel',' '); |
![]() |
![]() |
![]() |
#2 |
高级会员
注册日期: 2008-05-13
年龄: 44
帖子: 232
声望力: 21 ![]() |
![]()
好好看看help中对imread函数的讲解,你这个程序中,读写的图像文件格式可能是pgm,jpg,bmp,比如你读取的图像是个bmp图像,应该imread(filename,'bmp'),你这个函数的改造要在读取文件时同时用一个变量保存当前图像文件的后缀,如extent, 之后用imread(filename,extent)就可以了
__________________
工科'985'博士,(图像处理、分析及理解;模式识别;运动估计;数据分析等)定做程序、算法实现--qq:752105755 |
![]() |
![]() |