Index: trunk/src/toolbox_calib/check_active_images.m
===================================================================
--- trunk/src/toolbox_calib/check_active_images.m	(revision 924)
+++ trunk/src/toolbox_calib/check_active_images.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.
-%=======================================================================
-
 if n_ima ~= 0,
     
@@ -35,5 +17,5 @@
     if prod(double(active_images == 0)),
         disp('Error: There is no active image. Run Add/Suppress images to add images');
-        break
+        return;
     end;
     
Index: trunk/src/toolbox_calib/check_directory.m
===================================================================
--- trunk/src/toolbox_calib/check_directory.m	(revision 924)
+++ trunk/src/toolbox_calib/check_directory.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.
-%=======================================================================
-
 % This small script looks in the direcory and checks if the images are there.
 %
Index: trunk/src/toolbox_calib/check_extracted_images.m
===================================================================
--- trunk/src/toolbox_calib/check_extracted_images.m	(revision 924)
+++ trunk/src/toolbox_calib/check_extracted_images.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.
-%=======================================================================
-
 check_active_images;
 
Index: trunk/src/toolbox_calib/click_calib.m
===================================================================
--- trunk/src/toolbox_calib/click_calib.m	(revision 924)
+++ trunk/src/toolbox_calib/click_calib.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.
-%=======================================================================
-
 %if exist('images_read');
 %   active_images = active_images & images_read;
Index: trunk/src/toolbox_calib/comp_distortion_oulu.m
===================================================================
--- trunk/src/toolbox_calib/comp_distortion_oulu.m	(revision 924)
+++ trunk/src/toolbox_calib/comp_distortion_oulu.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.
-%=======================================================================
-
 function [x] = comp_distortion_oulu(xd,k);
 
Index: trunk/src/toolbox_calib/comp_error_calib.m
===================================================================
--- trunk/src/toolbox_calib/comp_error_calib.m	(revision 924)
+++ trunk/src/toolbox_calib/comp_error_calib.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.
-%=======================================================================
-
 %%%%%%%%%%%%%%%%%%%% RECOMPUTES THE REPROJECTION ERROR %%%%%%%%%%%%%%%%%%%%%%%%
 
Index: trunk/src/toolbox_calib/comp_ext_calib.m
===================================================================
--- trunk/src/toolbox_calib/comp_ext_calib.m	(revision 924)
+++ trunk/src/toolbox_calib/comp_ext_calib.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.
-%=======================================================================
-
 %%% Computes the extrinsic parameters for all the active calibration images 
 
Index: trunk/src/toolbox_calib/compute_extrinsic.m
===================================================================
--- trunk/src/toolbox_calib/compute_extrinsic.m	(revision 924)
+++ trunk/src/toolbox_calib/compute_extrinsic.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.
-%=======================================================================
-
 function [omckk,Tckk,Rckk,H,x,ex,JJ] = compute_extrinsic(x_kk,X_kk,fc,cc,kc,alpha_c,MaxIter,thresh_cond),
 
Index: trunk/src/toolbox_calib/compute_extrinsic_init.m
===================================================================
--- trunk/src/toolbox_calib/compute_extrinsic_init.m	(revision 924)
+++ trunk/src/toolbox_calib/compute_extrinsic_init.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.
-%=======================================================================
-
 function [omckk,Tckk,Rckk] = compute_extrinsic_init(x_kk,X_kk,fc,cc,kc,alpha_c),
 
Index: trunk/src/toolbox_calib/compute_extrinsic_refine.m
===================================================================
--- trunk/src/toolbox_calib/compute_extrinsic_refine.m	(revision 924)
+++ trunk/src/toolbox_calib/compute_extrinsic_refine.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.
-%=======================================================================
-
 function [omckk,Tckk,Rckk,JJ] = compute_extrinsic_refine(omc_init,Tc_init,x_kk,X_kk,fc,cc,kc,alpha_c,MaxIter,thresh_cond),
 
Index: trunk/src/toolbox_calib/compute_homography.m
===================================================================
--- trunk/src/toolbox_calib/compute_homography.m	(revision 924)
+++ trunk/src/toolbox_calib/compute_homography.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.
-%=======================================================================
-
 function [H,Hnorm,inv_Hnorm] = compute_homography(m,M);
 
Index: trunk/src/toolbox_calib/data_calib.m
===================================================================
--- trunk/src/toolbox_calib/data_calib.m	(revision 924)
+++ trunk/src/toolbox_calib/data_calib.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.
-%=======================================================================
-
 %%% This script alets the user enter the name of the images (base name, numbering scheme,...
 
@@ -41,5 +23,5 @@
 if s_tot < 1,
    fprintf(1,'No image in this directory in either ras, bmp, tif, pgm, ppm or jpg format. Change directory and try again.\n');
-   break;
+   return;
 end;
 
Index: trunk/src/toolbox_calib/extract_parameters.m
===================================================================
--- trunk/src/toolbox_calib/extract_parameters.m	(revision 924)
+++ trunk/src/toolbox_calib/extract_parameters.m	(revision 926)
@@ -1,19 +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.
-%=======================================================================
 
 %%% Extraction of the final intrinsic and extrinsic paramaters:
Index: trunk/src/toolbox_calib/go_calib_optim.m
===================================================================
--- trunk/src/toolbox_calib/go_calib_optim.m	(revision 924)
+++ trunk/src/toolbox_calib/go_calib_optim.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
 %
@@ -48,7 +30,4 @@
 %For now, if using a 3D calibration rig, set quick_init to 1 for an easy initialization of the focal length
 
-if ~exist('rosette_calibration','var')
-    rosette_calibration = 0;
-end;
 
 if ~exist('n_ima'),
@@ -59,44 +38,22 @@
 
 check_active_images;
-
 check_extracted_images;
-
 check_active_images;
-
 desactivated_images = [];
 
 recompute_extrinsic = (length(ind_active) < 100); % if there are too many images, do not spend time recomputing the extrinsic parameters twice..
 
-if (rosette_calibration) 
-  %%% Special Setting for the Rosette:
-  est_dist = ones(5,1);
-end;
-
-
 %%% MAIN OPTIMIZATION CALL!!!!! (look into this function for the details of implementation)
 go_calib_optim_iter;
 
-
 if ~isempty(desactivated_images),
-   
    param_list_save = param_list;
-   
    fprintf(1,'\nNew optimization including the images that have been deactivated during the previous optimization.\n');
    active_images(desactivated_images) = ones(1,length(desactivated_images));
    desactivated_images = [];
-   
    go_calib_optim_iter;
-   
    if ~isempty(desactivated_images),
       fprintf(1,['List of images left desactivated: ' num2str(desactivated_images) '\n' ] );
    end;
-   
    param_list = [param_list_save(:,1:end-1) param_list];
-   
 end;
-
-
-%%%%%%%%%%%%%%%%%%%% GRAPHICAL OUTPUT %%%%%%%%%%%%%%%%%%%%%%%%
-
-%graphout_calib;
-
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;
Index: trunk/src/toolbox_calib/ima_read_calib.m
===================================================================
--- trunk/src/toolbox_calib/ima_read_calib.m	(revision 924)
+++ trunk/src/toolbox_calib/ima_read_calib.m	(revision 926)
@@ -1,19 +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.
-%=======================================================================
 
 if ~exist('calib_name')|~exist('format_image'),
Index: trunk/src/toolbox_calib/init_intrinsic_param.m
===================================================================
--- trunk/src/toolbox_calib/init_intrinsic_param.m	(revision 924)
+++ trunk/src/toolbox_calib/init_intrinsic_param.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.
-%=======================================================================
-
 %init_intrinsic_param
 %
Index: trunk/src/toolbox_calib/is3D.m
===================================================================
--- trunk/src/toolbox_calib/is3D.m	(revision 924)
+++ trunk/src/toolbox_calib/is3D.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.
-%=======================================================================
-
 function test = is3D(X),
 
Index: trunk/src/toolbox_calib/mosaic.m
===================================================================
--- trunk/src/toolbox_calib/mosaic.m	(revision 924)
+++ trunk/src/toolbox_calib/mosaic.m	(revision 926)
@@ -1,19 +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.
-%=======================================================================
 
 if ~exist('I_1'),
Index: trunk/src/toolbox_calib/normalize_pixel.m
===================================================================
--- trunk/src/toolbox_calib/normalize_pixel.m	(revision 924)
+++ trunk/src/toolbox_calib/normalize_pixel.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.
-%=======================================================================
-
 function [xn] = normalize_pixel(x_kk,fc,cc,kc,alpha_c)
 
Index: trunk/src/toolbox_calib/project_points2.m
===================================================================
--- trunk/src/toolbox_calib/project_points2.m	(revision 924)
+++ trunk/src/toolbox_calib/project_points2.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.
-%=======================================================================
-
 function [xp,dxpdom,dxpdT,dxpdf,dxpdc,dxpdk,dxpdalpha] = project_points2(X,om,T,f,c,k,alpha)
 
@@ -240,7 +222,7 @@
 % Pixel coordinates:
 if length(f)>1,
-    xp = xd3 .* (f * ones(1,n))  +  c*ones(1,n);
+    xp = xd3 .* (f(:) * ones(1,n))  +  c(:)*ones(1,n);
     if nargout > 1,
-        coeff = reshape(f*ones(1,n),2*n,1);
+        coeff = reshape(f(:)*ones(1,n),2*n,1);
         dxpdom = (coeff*ones(1,3)) .* dxd3dom;
         dxpdT = (coeff*ones(1,3)) .* dxd3dT;
Index: trunk/src/toolbox_calib/rigid_motion.m
===================================================================
--- trunk/src/toolbox_calib/rigid_motion.m	(revision 924)
+++ trunk/src/toolbox_calib/rigid_motion.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.
-%=======================================================================
-
 function [Y,dYdom,dYdT] = rigid_motion(X,om,T);
 
Index: trunk/src/toolbox_calib/rodrigues.m
===================================================================
--- trunk/src/toolbox_calib/rodrigues.m	(revision 924)
+++ trunk/src/toolbox_calib/rodrigues.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.
-%=======================================================================
-
 function	[out,dout]=rodrigues(in)
 
@@ -206,6 +188,6 @@
                 wabs = sqrt(M(3,3));
 
-                mvec = [M(1,2), M(2,3), M(1,3)];
-                syn  = ((mvec > 1e-4) - (mvec < -1e-4)); % robust sign() function
+                mvec = ([M(1,2), M(2,3), M(1,3)] + [M(2,1), M(3,2), M(3,1)])/2;
+                syn  = ((mvec > eps) - (mvec < -eps)); % robust sign() function
                 hash = syn * [9; 3; 1];
                 idx = find(hash == hashvec);
@@ -231,16 +213,13 @@
 %% test of the Jacobians:
 
-%%%% TEST OF dRdom:
+%% TEST OF dRdom:
 om = randn(3,1);
 dom = randn(3,1)/1000000;
-
 [R1,dR1] = rodrigues(om);
 R2 = rodrigues(om+dom);
-
 R2a = R1 + reshape(dR1 * dom,3,3);
-
 gain = norm(R2 - R1)/norm(R2 - R2a)
 
-%%% TEST OF dOmdR:
+%% TEST OF dOmdR:
 om = randn(3,1);
 R = rodrigues(om);
@@ -250,12 +229,9 @@
 [omc,domdR] = rodrigues(R);
 [om2] = rodrigues(R+dR);
-
 om_app = omc + domdR*dR(:);
-
 gain = norm(om2 - omc)/norm(om2 - om_app)
 
 
-%%% OTHER BUG: (FIXED NOW!!!)
-
+%% OTHER BUG: (FIXED NOW!!!)
 omu = randn(3,1);   
 omu = omu/norm(omu)
@@ -265,6 +241,5 @@
 [om om2]
 
-%%% NORMAL OPERATION
-
+%% NORMAL OPERATION
 om = randn(3,1);         
 [R,dR]= rodrigues(om);
@@ -272,14 +247,27 @@
 [om om2]
 
-return
-
-% Test: norm(om) = pi
-
+%% Test: norm(om) = pi
 u = randn(3,1);
 u = u / sqrt(sum(u.^2));
 om = pi*u;
 R = rodrigues(om);
-
 R2 = rodrigues(rodrigues(R));
-
 norm(R - R2)
+
+%% Another test case where norm(om)=pi from Chen Feng (June 27th, 2014)
+R = [-0.950146567583153 -6.41765854280073e-05 0.311803617668748; ...
+     -6.41765854277654e-05 -0.999999917385145 -0.000401386434914383; ...
+      0.311803617668748 -0.000401386434914345 0.950146484968298];
+om = rodrigues(R)
+norm(om) - pi
+
+%% Another test case where norm(om)=pi from äœæä¹ (July 1st, 2014)
+R = [-0.999920129411407	-6.68593208347372e-05	-0.0126384464118876; ...
+     9.53007036072085e-05	-0.999997464662094	-0.00224979713751896; ...
+    -0.0126382639492467	-0.00225082189773293	0.999917600647740];
+om = rodrigues(R)
+norm(om) - pi
+
+
+
+
