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

📄 saving_calib.m

📁 这是一个很好的标定工具箱
💻 M
字号:

if ~exist('n_ima')|~exist('fc'),
   fprintf(1,'No calibration data available.\n');
   return;
end;

if exist('est_dist'),
   if length(est_dist) == 4,
      est_dist = [est_dist ; 1];
   end;
end;

if exist('kc'),
   if length(kc) ==4;
      kc = [kc;0];
   end;
end;

if ~exist('fc_error'),
   fc_error = NaN*ones(2,1);
end;

if ~exist('kc_error'),
   kc_error = NaN*ones(5,1);
end;

if ~exist('cc_error'),
   cc_error = NaN*ones(2,1);
end;

if ~exist('alpha_c_error'),
   alpha_c_error = NaN;
end;

check_active_images;

if ~exist('solution_init'), solution_init = []; end;

for kk = 1:n_ima,
   if ~exist(['dX_' num2str(kk)]), eval(['dX_' num2str(kk) '= dX;']); end;
   if ~exist(['dY_' num2str(kk)]), eval(['dY_' num2str(kk) '= dY;']); end;
end;

if ~exist('param_list'),
   param_list = solution;
end;

if ~exist('wintx'),
   wintx = [];
   winty = [];
end;

if ~exist('dX_default'),
   dX_default = [];
   dY_default = [];
end;

if ~exist('alpha_c'),
   alpha_c = 0;
end;

for kk = 1:n_ima,
   if ~exist(['y_' num2str(kk)]),
   	eval(['y_' num2str(kk) ' = NaN*ones(2,1);']);
   end;
   if ~exist(['n_sq_x_' num2str(kk)]),
   	eval(['n_sq_x_' num2str(kk) ' = NaN;']);
   	eval(['n_sq_y_' num2str(kk) ' = NaN;']);
   end; 
   if ~exist(['wintx_' num2str(kk)]),
   	eval(['wintx_' num2str(kk) ' = NaN;']);
   	eval(['winty_' num2str(kk) ' = NaN;']);
   end;
   if ~exist(['omc_error_' num2str(kk)]),
      eval(['omc_error_' num2str(kk) ' = NaN*ones(3,1);']);
   end;
   if ~exist(['Tc_error_' num2str(kk)]),
      eval(['Tc_error_' num2str(kk) ' = NaN*ones(3,1);']);
   end;
   
end;

save_name = 'Calib_Results';

if exist([ save_name '.mat'])==2,
   disp('WARNING: File Calib_Results.mat already exists');
   pfn = -1;
   cont = 1;
   while cont,
      pfn = pfn + 1;
   	postfix = ['_old'num2str(pfn)];
      save_name = [ 'Calib_Results' postfix];
      cont = (exist([ save_name '.mat'])==2);
   end;
   copyfile('Calib_Results.mat',[save_name '.mat']);
	disp(['Copying the current Calib_Results.mat file to ' save_name '.mat']);
end;


save_name = 'Calib_Results';

if exist('calib_name'),
   
   fprintf(1,['\nSaving calibration results under ' save_name '.mat\n']);

   string_save = ['save ' save_name ' center_optim param_list active_images ind_active center_optim est_alpha est_dist fc kc cc alpha_c fc_error kc_error cc_error alpha_c_error  ex x y solution solution_init wintx winty n_ima type_numbering N_slots small_calib_image first_num image_numbers format_image calib_name Hcal Wcal nx ny map dX_default dY_default KK inv_KK dX dY'];
   
   for kk = 1:n_ima,
   	string_save = [string_save ' X_' num2str(kk) ' x_' num2str(kk) ' y_' num2str(kk) ' ex_' num2str(kk) ' omc_' num2str(kk) ' Rc_' num2str(kk) ' Tc_' num2str(kk) ' omc_error_' num2str(kk) ' Tc_error_' num2str(kk) ' H_' num2str(kk) ' n_sq_x_' num2str(kk) ' n_sq_y_' num2str(kk) ' wintx_' num2str(kk) ' winty_' num2str(kk) ' dX_' num2str(kk) ' dY_' num2str(kk)];
   end;
   
else
   
   fprintf(1,['\nSaving calibration results under ' save_name '.mat (no image version)\n']);

   string_save = ['save ' save_name ' center_optim param_list active_images ind_active center_optim est_alpha est_dist fc kc cc alpha_c fc_error kc_error cc_error alpha_c_error ex x y solution solution_init wintx winty n_ima nx ny dX_default dY_default KK inv_KK dX dY'];
   
   for kk = 1:n_ima,
   	string_save = [string_save ' X_' num2str(kk) ' x_' num2str(kk) ' y_' num2str(kk) ' ex_' num2str(kk) ' omc_' num2str(kk) ' Rc_' num2str(kk) ' Tc_' num2str(kk) ' omc_error_' num2str(kk) ' Tc_error_' num2str(kk) ' H_' num2str(kk) ' n_sq_x_' num2str(kk) ' n_sq_y_' num2str(kk) ' wintx_' num2str(kk) ' winty_' num2str(kk) ' dX_' num2str(kk) ' dY_' num2str(kk)];
   end;
   
end;

   

%fprintf(1,'To load later click on Load\n');

eval(string_save);

fprintf(1,'done\n');

⌨️ 快捷键说明

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