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

📄 results.m

📁 sfrmat is a Matlab function that provides a spatial frequency response* (SFR) from a digital image f
💻 M
字号:
function status = results(dat, datfile, roi, oename, memo, filename)% results: Matlab function saves results computed by sfrmat2.m.%  Data stored is in a form similar to that generated by the ISO%  Image Analyser PhotoShop Plug-in, in an Excel compatible format.%%  Usage: status =  results(dat, datfile, roi, memo, filename)%  dat =      spatial frequency, (srf array) in either a 2 column or%             4 column (frq, r, g, b) form%  datfile =  image file used for input data%  roi =      pixel coordinates that define the Region of Interest in%             datfile%  oename =    name of OECF file applied (or 'none'). %  memo =     optional comment string%  filename = optional name of file where results are to be saved. If%             this is not supplied, the user is prompted by a dialog%             window.  % % Peter D. Burns 17 Feb. 1999%                5  Aug. 2002% Copyright (c) Photographic & Imaging Manufacturers Associationpfilename = filename;com = char(computer);if com(1:3) == 'PCW';   nn =length(pfilename);   jj=0;   for i=1:nn;      if pfilename(i+jj)=='\';         pfilename = [pfilename(1:i+jj),'\',pfilename(i+jj+1:nn)];            nn=nn+1;            jj=jj+1;      end;    end; end; pdatfile=datfile; if com(1:3) == 'PCW';       nn =length(pdatfile);   jj=0;   for i=1:nn;      if pdatfile(i+jj)=='\';         pdatfile = [pdatfile(1:i+jj),'\',pdatfile(i+jj+1:nn)];            nn=nn+1;            jj=jj+1;      end;    end; end; if nargin<5;   filename = '';end;if nargin<4;   memo = ' ';end;if nargin<3;   disp(['* Error in results function, at least 3 arguments needed *']);   return;end;if filename(length(filename))=='*';   def = filename;   [filename,pathname]=uiputfile(def,'File name to save results');   filename=[pathname,filename];   if size(filename)==[1,2],      if filename==[0,0],         disp('Saving results: Cancelled');         status=-1;         return;      end;   end;end;if isempty(filename);   [filename,pathname]=uiputfile('','File name to save results',100,100);  filename=[pathname,filename];  if size(filename)==[1,2],   if filename==[0,0],    disp('Saving results: Cancelled');    status=-1;    return;   end; end;end;if nargin<6;   pfilename = filename;end;%disp(sprintf(['* Writing data to file: ', filename, '\n']));disp(['* Writing results to file: ',filename])%disp(sprintf(['* Writing data to file: ', pfilename, '\n']));[rows, cols] = size(dat);line1 = ['%% Output from Matlab function sfrmat2.m', '\n'];line2 = [' ', '\n'];line3 = ['%% Analysis:  Spatial Frequency Response', '\n'];line4 = ['%% ', datestr(now,0), '\n'];% line4(12) =',';                  % allows Excell to read date easilyline5 = ['%% Image/data evaluated:  ', pdatfile, '\n'];line6 = ['%% This output file: ', pfilename, '\n'];line7 = ['%% Selected region: (',num2str(roi(1)),', 'num2str(roi(2)),'), to ('num2str(roi(3)),', 'num2str(roi(4)),')', '\n'];line8 = ['%% OECF applied: ', oename, '\n'];% line10 = ['%% Frequency  SFR', '\n'];fid = fopen(filename,'w'); fprintf(fid,line1); fprintf(fid,line2); fprintf(fid,line3); fprintf(fid,line4); fprintf(fid,line5); fprintf(fid,line6); fprintf(fid,line7); fprintf(fid,line8);%fprintf(fid, ['%% ',memo{1},'\n'], '%g');fprintf(fid, ['%% ',memo{1},'\n']);for i=2:length(memo);  fprintf(fid,  '%% %8.3f\t %8.3f\t %8.3f\n', memo{i});end;% Write the dataif cols<4; line10 = ['\n','%% Frequency', '\t','   SFR', '\n']; fprintf(fid,line10); fprintf(fid, '%8.3f\t %8.4f\n', dat'); else; line10 = ['%% Frequency','\t','    SFR-r','\t','    SFR-g','\t','    SFR-b','\t','    Lum','\n']; fprintf(fid,line10); fprintf(fid, '%8.3f\t %8.4f\t %8.4f\t %8.4f\t %8.4f\n', dat');end;status=fclose(fid);return;

⌨️ 快捷键说明

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