⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ldimgff.m

📁 等高线拟合源代码(matlab源码)
💻 M
字号:
function [img] = ldmimgff(name);% LDIMGFF: Load image from file (Part of GUI)% All the software included in this package is presented as is.% It may be distributed freely. The author can, however, not be% held responsible for any problems whatever.% % Designed by Johan Baeten.% Last updated: 22-03-2000% Johan.baeten@mech.kuleuven.ac.beglobal XSIZE;global YSIZE;global IMAGENAMEglobal MAINFIGglobal NEWIMAGENAMEglobal MAP%nargs= nargin;if nargin == 0,  [filename, PATHNAME]= uigetfile('*.pgm','Select Image');else   filename = name;endlen = length(filename);if (len < 4),      % probally cancel in uigetfile  seterror([' ... cancelled']);  return;endfilename = lower(filename);ext = filename(len-3:len);if ~((strcmp(ext,'.gry'))|(strcmp(ext,'.pgm'))),   seterror(' ... Only ''.gry'' and ''.pgm'' supported.');         return;endfid = fopen(filename);if (fid == -1),   seterror(' ... Can''t load file. File doesn''t exist');   % this can/should never happenelse   if strcmp(filename(len-2:len),'gry'),      seterror([' ... Opening ',filename,' with set image sizes.']);      watchon;      drawnow;      [a]=fscanf(fid,'%c',[XSIZE YSIZE]);      fclose(fid);   else      seterror([' ... Opening ',filename]);      watchon;      drawnow;            format = fscanf(fid,'%s',1);      XSIZE = fscanf(fid,'%d',1);      YSIZE = fscanf(fid,'%d',1);      grayvalues = fscanf(fid,'%d',1);      dummy = fscanf(fid,'%c',1);      [a]=fscanf(fid,'%c',[XSIZE YSIZE]);      fclose(fid);      MAP = gray(255);   end   IMAGENAME = filename;   if (XSIZE <= 64) & (YSIZE <= 64),      setting('imagesize64');   elseif (XSIZE <= 128) & (YSIZE <= 128),      setting('imagesize128');   elseif (XSIZE <= 256) & (YSIZE <= 256),      setting('imagesize256');   elseif (XSIZE <= 512) & (YSIZE <= 512),      setting('imagesize512');   else      setting('imagesizenn');   end   set(MAINFIG,'userdata',(abs(a)'));	if nargout == 0,   	set(findobj(gca,'type','image'),'cdata',(abs(a)'));        setting ('showimage');      setting('drawaxes');   	setting('saveimageenableon');	   drawnow;	else	   img = (abs(a)') ;	end   watchoff;end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -