Index: trunk/src/toolbox_calib/go_calib_optim_iter.m
===================================================================
--- trunk/src/toolbox_calib/go_calib_optim_iter.m	(revision 924)
+++ trunk/src/toolbox_calib/go_calib_optim_iter.m	(revision 926)
@@ -1,20 +1,2 @@
-%=======================================================================
-% Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
-%   http://www.legi.grenoble-inp.fr
-%   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
-%
-%     This file is part of the toolbox UVMAT.
-%
-%     UVMAT is free software; you can redistribute it and/or modify
-%     it under the terms of the GNU General Public License as published
-%     by the Free Software Foundation; either version 2 of the license,
-%     or (at your option) any later version.
-%
-%     UVMAT is distributed in the hope that it will be useful,
-%     but WITHOUT ANY WARRANTY; without even the implied warranty of
-%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-%     GNU General Public License (see LICENSE.txt) for more details.
-%=======================================================================
-
 %go_calib_optim_iter
 %
@@ -114,4 +96,5 @@
 check_active_images;
 
+
 quick_init = 0; % Set to 1 for using a quick init (necessary when using 3D rigs)
 
@@ -169,5 +152,5 @@
         if isequal(est_fc,[0;1]),
             fprintf(1,'The second component of focal (fc(1)) is estimated, but not the first one (est_fc=[0;1])\n');
-        else 
+        else
             fprintf(1,'The focal vector fc is not optimized (est_fc=[0;0])\n');
         end;
@@ -236,9 +219,8 @@
 
 alpha_smooth = 0.1; % set alpha_smooth = 1; for steepest gradient descent
-% alpha_smooth = 0.01; % modified L. Gostiaux
 
 
 % Conditioning threshold for view rejection
-thresh_cond = 1e5;
+thresh_cond = 1e6;
 
 
@@ -260,6 +242,4 @@
 end;
 
-
-
 if ~exist('alpha_c'),
     fprintf(1,'Initialization of the image skew to zero.\n');
@@ -268,5 +248,5 @@
 end;
 
-if ~exist('fc')& quick_init,
+if ~exist('fc') && quick_init,
     FOV_angle = 35; % Initial camera field of view in degrees
     fprintf(1,['Initialization of the focal length to a FOV of ' num2str(FOV_angle) ' degrees.\n']);
@@ -340,5 +320,5 @@
 
 
-while (change > 1e-2)&(iter < MaxIter),
+while (change > 1e-9) && (iter < MaxIter),
     
     fprintf(1,'%d...',iter+1);
@@ -602,5 +582,5 @@
 solution_error = param_error;
 
-if ~est_aspect_ratio & isequal(est_fc,[1;1]),
+if ~est_aspect_ratio && isequal(est_fc,[1;1]),
     solution_error(2) = solution_error(1);
 end;
@@ -615,8 +595,8 @@
 
 fprintf(1,'\n\nCalibration results after optimization (with uncertainties):\n\n');
-fprintf(1,'Focal Length:          fc = [ %3.5f   %3.5f ] ? [ %3.5f   %3.5f ]\n',[fc;fc_error]);
-fprintf(1,'Principal point:       cc = [ %3.5f   %3.5f ] ? [ %3.5f   %3.5f ]\n',[cc;cc_error]);
-fprintf(1,'Skew:             alpha_c = [ %3.5f ] ? [ %3.5f  ]   => angle of pixel axes = %3.5f ? %3.5f degrees\n',[alpha_c;alpha_c_error],90 - atan(alpha_c)*180/pi,atan(alpha_c_error)*180/pi);
-fprintf(1,'Distortion:            kc = [ %3.5f   %3.5f   %3.5f   %3.5f  %5.5f ] ? [ %3.5f   %3.5f   %3.5f   %3.5f  %5.5f ]\n',[kc;kc_error]);   
+fprintf(1,'Focal Length:          fc = [ %3.5f   %3.5f ] +/- [ %3.5f   %3.5f ]\n',[fc;fc_error]);
+fprintf(1,'Principal point:       cc = [ %3.5f   %3.5f ] +/- [ %3.5f   %3.5f ]\n',[cc;cc_error]);
+fprintf(1,'Skew:             alpha_c = [ %3.5f ] +/- [ %3.5f  ]   => angle of pixel axes = %3.5f +/- %3.5f degrees\n',[alpha_c;alpha_c_error],90 - atan(alpha_c)*180/pi,atan(alpha_c_error)*180/pi);
+fprintf(1,'Distortion:            kc = [ %3.5f   %3.5f   %3.5f   %3.5f  %5.5f ] +/- [ %3.5f   %3.5f   %3.5f   %3.5f  %5.5f ]\n',[kc;kc_error]);   
 fprintf(1,'Pixel error:          err = [ %3.5f   %3.5f ]\n\n',err_std); 
 fprintf(1,'Note: The numerical errors are approximately three times the standard deviations (for reference).\n\n\n')
@@ -630,5 +610,5 @@
 alpha_c_max = alpha_c + alpha_c_error/2;
 
-if (alpha_c_min < 0) & (alpha_c_max > 0),
+if (alpha_c_min < 0) && (alpha_c_max > 0),
     fprintf(1,'Recommendation: The skew coefficient alpha_c is found to be equal to zero (within its uncertainty).\n');
     fprintf(1,'                You may want to reject it from the optimization by setting est_alpha=0 and run Calibration\n\n');
@@ -640,5 +620,5 @@
 prob_kc = (kc_min < 0) & (kc_max > 0);
 
-if ~(prob_kc(3) & prob_kc(4))
+if ~(prob_kc(3) && prob_kc(4))
     prob_kc(3:4) = [0;0];
 end;
