Changeset 926 for trunk/src/toolbox_calib
- Timestamp:
- Feb 18, 2016, 12:05:51 PM (9 years ago)
- Location:
- trunk/src/toolbox_calib
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/toolbox_calib/check_active_images.m
r924 r926 1 %=======================================================================2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France3 % http://www.legi.grenoble-inp.fr4 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr5 %6 % This file is part of the toolbox UVMAT.7 %8 % UVMAT is free software; you can redistribute it and/or modify9 % it under the terms of the GNU General Public License as published10 % by the Free Software Foundation; either version 2 of the license,11 % or (at your option) any later version.12 %13 % UVMAT is distributed in the hope that it will be useful,14 % but WITHOUT ANY WARRANTY; without even the implied warranty of15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 % GNU General Public License (see LICENSE.txt) for more details.17 %=======================================================================18 19 1 if n_ima ~= 0, 20 2 … … 35 17 if prod(double(active_images == 0)), 36 18 disp('Error: There is no active image. Run Add/Suppress images to add images'); 37 break19 return; 38 20 end; 39 21 -
trunk/src/toolbox_calib/check_directory.m
r924 r926 1 %=======================================================================2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France3 % http://www.legi.grenoble-inp.fr4 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr5 %6 % This file is part of the toolbox UVMAT.7 %8 % UVMAT is free software; you can redistribute it and/or modify9 % it under the terms of the GNU General Public License as published10 % by the Free Software Foundation; either version 2 of the license,11 % or (at your option) any later version.12 %13 % UVMAT is distributed in the hope that it will be useful,14 % but WITHOUT ANY WARRANTY; without even the implied warranty of15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 % GNU General Public License (see LICENSE.txt) for more details.17 %=======================================================================18 19 1 % This small script looks in the direcory and checks if the images are there. 20 2 % -
trunk/src/toolbox_calib/check_extracted_images.m
r924 r926 1 %=======================================================================2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France3 % http://www.legi.grenoble-inp.fr4 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr5 %6 % This file is part of the toolbox UVMAT.7 %8 % UVMAT is free software; you can redistribute it and/or modify9 % it under the terms of the GNU General Public License as published10 % by the Free Software Foundation; either version 2 of the license,11 % or (at your option) any later version.12 %13 % UVMAT is distributed in the hope that it will be useful,14 % but WITHOUT ANY WARRANTY; without even the implied warranty of15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 % GNU General Public License (see LICENSE.txt) for more details.17 %=======================================================================18 19 1 check_active_images; 20 2 -
trunk/src/toolbox_calib/click_calib.m
r924 r926 1 %=======================================================================2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France3 % http://www.legi.grenoble-inp.fr4 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr5 %6 % This file is part of the toolbox UVMAT.7 %8 % UVMAT is free software; you can redistribute it and/or modify9 % it under the terms of the GNU General Public License as published10 % by the Free Software Foundation; either version 2 of the license,11 % or (at your option) any later version.12 %13 % UVMAT is distributed in the hope that it will be useful,14 % but WITHOUT ANY WARRANTY; without even the implied warranty of15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 % GNU General Public License (see LICENSE.txt) for more details.17 %=======================================================================18 19 1 %if exist('images_read'); 20 2 % active_images = active_images & images_read; -
trunk/src/toolbox_calib/comp_distortion_oulu.m
r924 r926 1 %=======================================================================2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France3 % http://www.legi.grenoble-inp.fr4 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr5 %6 % This file is part of the toolbox UVMAT.7 %8 % UVMAT is free software; you can redistribute it and/or modify9 % it under the terms of the GNU General Public License as published10 % by the Free Software Foundation; either version 2 of the license,11 % or (at your option) any later version.12 %13 % UVMAT is distributed in the hope that it will be useful,14 % but WITHOUT ANY WARRANTY; without even the implied warranty of15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 % GNU General Public License (see LICENSE.txt) for more details.17 %=======================================================================18 19 1 function [x] = comp_distortion_oulu(xd,k); 20 2 -
trunk/src/toolbox_calib/comp_error_calib.m
r924 r926 1 %=======================================================================2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France3 % http://www.legi.grenoble-inp.fr4 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr5 %6 % This file is part of the toolbox UVMAT.7 %8 % UVMAT is free software; you can redistribute it and/or modify9 % it under the terms of the GNU General Public License as published10 % by the Free Software Foundation; either version 2 of the license,11 % or (at your option) any later version.12 %13 % UVMAT is distributed in the hope that it will be useful,14 % but WITHOUT ANY WARRANTY; without even the implied warranty of15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 % GNU General Public License (see LICENSE.txt) for more details.17 %=======================================================================18 19 1 %%%%%%%%%%%%%%%%%%%% RECOMPUTES THE REPROJECTION ERROR %%%%%%%%%%%%%%%%%%%%%%%% 20 2 -
trunk/src/toolbox_calib/comp_ext_calib.m
r924 r926 1 %=======================================================================2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France3 % http://www.legi.grenoble-inp.fr4 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr5 %6 % This file is part of the toolbox UVMAT.7 %8 % UVMAT is free software; you can redistribute it and/or modify9 % it under the terms of the GNU General Public License as published10 % by the Free Software Foundation; either version 2 of the license,11 % or (at your option) any later version.12 %13 % UVMAT is distributed in the hope that it will be useful,14 % but WITHOUT ANY WARRANTY; without even the implied warranty of15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 % GNU General Public License (see LICENSE.txt) for more details.17 %=======================================================================18 19 1 %%% Computes the extrinsic parameters for all the active calibration images 20 2 -
trunk/src/toolbox_calib/compute_extrinsic.m
r924 r926 1 %=======================================================================2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France3 % http://www.legi.grenoble-inp.fr4 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr5 %6 % This file is part of the toolbox UVMAT.7 %8 % UVMAT is free software; you can redistribute it and/or modify9 % it under the terms of the GNU General Public License as published10 % by the Free Software Foundation; either version 2 of the license,11 % or (at your option) any later version.12 %13 % UVMAT is distributed in the hope that it will be useful,14 % but WITHOUT ANY WARRANTY; without even the implied warranty of15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 % GNU General Public License (see LICENSE.txt) for more details.17 %=======================================================================18 19 1 function [omckk,Tckk,Rckk,H,x,ex,JJ] = compute_extrinsic(x_kk,X_kk,fc,cc,kc,alpha_c,MaxIter,thresh_cond), 20 2 -
trunk/src/toolbox_calib/compute_extrinsic_init.m
r924 r926 1 %=======================================================================2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France3 % http://www.legi.grenoble-inp.fr4 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr5 %6 % This file is part of the toolbox UVMAT.7 %8 % UVMAT is free software; you can redistribute it and/or modify9 % it under the terms of the GNU General Public License as published10 % by the Free Software Foundation; either version 2 of the license,11 % or (at your option) any later version.12 %13 % UVMAT is distributed in the hope that it will be useful,14 % but WITHOUT ANY WARRANTY; without even the implied warranty of15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 % GNU General Public License (see LICENSE.txt) for more details.17 %=======================================================================18 19 1 function [omckk,Tckk,Rckk] = compute_extrinsic_init(x_kk,X_kk,fc,cc,kc,alpha_c), 20 2 -
trunk/src/toolbox_calib/compute_extrinsic_refine.m
r924 r926 1 %=======================================================================2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France3 % http://www.legi.grenoble-inp.fr4 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr5 %6 % This file is part of the toolbox UVMAT.7 %8 % UVMAT is free software; you can redistribute it and/or modify9 % it under the terms of the GNU General Public License as published10 % by the Free Software Foundation; either version 2 of the license,11 % or (at your option) any later version.12 %13 % UVMAT is distributed in the hope that it will be useful,14 % but WITHOUT ANY WARRANTY; without even the implied warranty of15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 % GNU General Public License (see LICENSE.txt) for more details.17 %=======================================================================18 19 1 function [omckk,Tckk,Rckk,JJ] = compute_extrinsic_refine(omc_init,Tc_init,x_kk,X_kk,fc,cc,kc,alpha_c,MaxIter,thresh_cond), 20 2 -
trunk/src/toolbox_calib/compute_homography.m
r924 r926 1 %=======================================================================2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France3 % http://www.legi.grenoble-inp.fr4 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr5 %6 % This file is part of the toolbox UVMAT.7 %8 % UVMAT is free software; you can redistribute it and/or modify9 % it under the terms of the GNU General Public License as published10 % by the Free Software Foundation; either version 2 of the license,11 % or (at your option) any later version.12 %13 % UVMAT is distributed in the hope that it will be useful,14 % but WITHOUT ANY WARRANTY; without even the implied warranty of15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 % GNU General Public License (see LICENSE.txt) for more details.17 %=======================================================================18 19 1 function [H,Hnorm,inv_Hnorm] = compute_homography(m,M); 20 2 -
trunk/src/toolbox_calib/data_calib.m
r924 r926 1 %=======================================================================2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France3 % http://www.legi.grenoble-inp.fr4 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr5 %6 % This file is part of the toolbox UVMAT.7 %8 % UVMAT is free software; you can redistribute it and/or modify9 % it under the terms of the GNU General Public License as published10 % by the Free Software Foundation; either version 2 of the license,11 % or (at your option) any later version.12 %13 % UVMAT is distributed in the hope that it will be useful,14 % but WITHOUT ANY WARRANTY; without even the implied warranty of15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 % GNU General Public License (see LICENSE.txt) for more details.17 %=======================================================================18 19 1 %%% This script alets the user enter the name of the images (base name, numbering scheme,... 20 2 … … 41 23 if s_tot < 1, 42 24 fprintf(1,'No image in this directory in either ras, bmp, tif, pgm, ppm or jpg format. Change directory and try again.\n'); 43 break;25 return; 44 26 end; 45 27 -
trunk/src/toolbox_calib/extract_parameters.m
r924 r926 1 %=======================================================================2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France3 % http://www.legi.grenoble-inp.fr4 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr5 %6 % This file is part of the toolbox UVMAT.7 %8 % UVMAT is free software; you can redistribute it and/or modify9 % it under the terms of the GNU General Public License as published10 % by the Free Software Foundation; either version 2 of the license,11 % or (at your option) any later version.12 %13 % UVMAT is distributed in the hope that it will be useful,14 % but WITHOUT ANY WARRANTY; without even the implied warranty of15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 % GNU General Public License (see LICENSE.txt) for more details.17 %=======================================================================18 1 19 2 %%% Extraction of the final intrinsic and extrinsic paramaters: -
trunk/src/toolbox_calib/go_calib_optim.m
r924 r926 1 %=======================================================================2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France3 % http://www.legi.grenoble-inp.fr4 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr5 %6 % This file is part of the toolbox UVMAT.7 %8 % UVMAT is free software; you can redistribute it and/or modify9 % it under the terms of the GNU General Public License as published10 % by the Free Software Foundation; either version 2 of the license,11 % or (at your option) any later version.12 %13 % UVMAT is distributed in the hope that it will be useful,14 % but WITHOUT ANY WARRANTY; without even the implied warranty of15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 % GNU General Public License (see LICENSE.txt) for more details.17 %=======================================================================18 19 1 %go_calib_optim 20 2 % … … 48 30 %For now, if using a 3D calibration rig, set quick_init to 1 for an easy initialization of the focal length 49 31 50 if ~exist('rosette_calibration','var')51 rosette_calibration = 0;52 end;53 32 54 33 if ~exist('n_ima'), … … 59 38 60 39 check_active_images; 61 62 40 check_extracted_images; 63 64 41 check_active_images; 65 66 42 desactivated_images = []; 67 43 68 44 recompute_extrinsic = (length(ind_active) < 100); % if there are too many images, do not spend time recomputing the extrinsic parameters twice.. 69 45 70 if (rosette_calibration)71 %%% Special Setting for the Rosette:72 est_dist = ones(5,1);73 end;74 75 76 46 %%% MAIN OPTIMIZATION CALL!!!!! (look into this function for the details of implementation) 77 47 go_calib_optim_iter; 78 48 79 80 49 if ~isempty(desactivated_images), 81 82 50 param_list_save = param_list; 83 84 51 fprintf(1,'\nNew optimization including the images that have been deactivated during the previous optimization.\n'); 85 52 active_images(desactivated_images) = ones(1,length(desactivated_images)); 86 53 desactivated_images = []; 87 88 54 go_calib_optim_iter; 89 90 55 if ~isempty(desactivated_images), 91 56 fprintf(1,['List of images left desactivated: ' num2str(desactivated_images) '\n' ] ); 92 57 end; 93 94 58 param_list = [param_list_save(:,1:end-1) param_list]; 95 96 59 end; 97 98 99 %%%%%%%%%%%%%%%%%%%% GRAPHICAL OUTPUT %%%%%%%%%%%%%%%%%%%%%%%%100 101 %graphout_calib;102 -
trunk/src/toolbox_calib/go_calib_optim_iter.m
r924 r926 1 %=======================================================================2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France3 % http://www.legi.grenoble-inp.fr4 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr5 %6 % This file is part of the toolbox UVMAT.7 %8 % UVMAT is free software; you can redistribute it and/or modify9 % it under the terms of the GNU General Public License as published10 % by the Free Software Foundation; either version 2 of the license,11 % or (at your option) any later version.12 %13 % UVMAT is distributed in the hope that it will be useful,14 % but WITHOUT ANY WARRANTY; without even the implied warranty of15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 % GNU General Public License (see LICENSE.txt) for more details.17 %=======================================================================18 19 1 %go_calib_optim_iter 20 2 % … … 114 96 check_active_images; 115 97 98 116 99 quick_init = 0; % Set to 1 for using a quick init (necessary when using 3D rigs) 117 100 … … 169 152 if isequal(est_fc,[0;1]), 170 153 fprintf(1,'The second component of focal (fc(1)) is estimated, but not the first one (est_fc=[0;1])\n'); 171 else 154 else 172 155 fprintf(1,'The focal vector fc is not optimized (est_fc=[0;0])\n'); 173 156 end; … … 236 219 237 220 alpha_smooth = 0.1; % set alpha_smooth = 1; for steepest gradient descent 238 % alpha_smooth = 0.01; % modified L. Gostiaux239 221 240 222 241 223 % Conditioning threshold for view rejection 242 thresh_cond = 1e 5;224 thresh_cond = 1e6; 243 225 244 226 … … 260 242 end; 261 243 262 263 264 244 if ~exist('alpha_c'), 265 245 fprintf(1,'Initialization of the image skew to zero.\n'); … … 268 248 end; 269 249 270 if ~exist('fc') & quick_init,250 if ~exist('fc') && quick_init, 271 251 FOV_angle = 35; % Initial camera field of view in degrees 272 252 fprintf(1,['Initialization of the focal length to a FOV of ' num2str(FOV_angle) ' degrees.\n']); … … 340 320 341 321 342 while (change > 1e- 2)&(iter < MaxIter),322 while (change > 1e-9) && (iter < MaxIter), 343 323 344 324 fprintf(1,'%d...',iter+1); … … 602 582 solution_error = param_error; 603 583 604 if ~est_aspect_ratio & isequal(est_fc,[1;1]),584 if ~est_aspect_ratio && isequal(est_fc,[1;1]), 605 585 solution_error(2) = solution_error(1); 606 586 end; … … 615 595 616 596 fprintf(1,'\n\nCalibration results after optimization (with uncertainties):\n\n'); 617 fprintf(1,'Focal Length: fc = [ %3.5f %3.5f ] ?[ %3.5f %3.5f ]\n',[fc;fc_error]);618 fprintf(1,'Principal point: cc = [ %3.5f %3.5f ] ?[ %3.5f %3.5f ]\n',[cc;cc_error]);619 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);620 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]);597 fprintf(1,'Focal Length: fc = [ %3.5f %3.5f ] +/- [ %3.5f %3.5f ]\n',[fc;fc_error]); 598 fprintf(1,'Principal point: cc = [ %3.5f %3.5f ] +/- [ %3.5f %3.5f ]\n',[cc;cc_error]); 599 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); 600 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]); 621 601 fprintf(1,'Pixel error: err = [ %3.5f %3.5f ]\n\n',err_std); 622 602 fprintf(1,'Note: The numerical errors are approximately three times the standard deviations (for reference).\n\n\n') … … 630 610 alpha_c_max = alpha_c + alpha_c_error/2; 631 611 632 if (alpha_c_min < 0) & (alpha_c_max > 0),612 if (alpha_c_min < 0) && (alpha_c_max > 0), 633 613 fprintf(1,'Recommendation: The skew coefficient alpha_c is found to be equal to zero (within its uncertainty).\n'); 634 614 fprintf(1,' You may want to reject it from the optimization by setting est_alpha=0 and run Calibration\n\n'); … … 640 620 prob_kc = (kc_min < 0) & (kc_max > 0); 641 621 642 if ~(prob_kc(3) & prob_kc(4))622 if ~(prob_kc(3) && prob_kc(4)) 643 623 prob_kc(3:4) = [0;0]; 644 624 end; -
trunk/src/toolbox_calib/ima_read_calib.m
r924 r926 1 %=======================================================================2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France3 % http://www.legi.grenoble-inp.fr4 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr5 %6 % This file is part of the toolbox UVMAT.7 %8 % UVMAT is free software; you can redistribute it and/or modify9 % it under the terms of the GNU General Public License as published10 % by the Free Software Foundation; either version 2 of the license,11 % or (at your option) any later version.12 %13 % UVMAT is distributed in the hope that it will be useful,14 % but WITHOUT ANY WARRANTY; without even the implied warranty of15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 % GNU General Public License (see LICENSE.txt) for more details.17 %=======================================================================18 1 19 2 if ~exist('calib_name')|~exist('format_image'), -
trunk/src/toolbox_calib/init_intrinsic_param.m
r924 r926 1 %=======================================================================2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France3 % http://www.legi.grenoble-inp.fr4 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr5 %6 % This file is part of the toolbox UVMAT.7 %8 % UVMAT is free software; you can redistribute it and/or modify9 % it under the terms of the GNU General Public License as published10 % by the Free Software Foundation; either version 2 of the license,11 % or (at your option) any later version.12 %13 % UVMAT is distributed in the hope that it will be useful,14 % but WITHOUT ANY WARRANTY; without even the implied warranty of15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 % GNU General Public License (see LICENSE.txt) for more details.17 %=======================================================================18 19 1 %init_intrinsic_param 20 2 % -
trunk/src/toolbox_calib/is3D.m
r924 r926 1 %=======================================================================2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France3 % http://www.legi.grenoble-inp.fr4 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr5 %6 % This file is part of the toolbox UVMAT.7 %8 % UVMAT is free software; you can redistribute it and/or modify9 % it under the terms of the GNU General Public License as published10 % by the Free Software Foundation; either version 2 of the license,11 % or (at your option) any later version.12 %13 % UVMAT is distributed in the hope that it will be useful,14 % but WITHOUT ANY WARRANTY; without even the implied warranty of15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 % GNU General Public License (see LICENSE.txt) for more details.17 %=======================================================================18 19 1 function test = is3D(X), 20 2 -
trunk/src/toolbox_calib/mosaic.m
r924 r926 1 %=======================================================================2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France3 % http://www.legi.grenoble-inp.fr4 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr5 %6 % This file is part of the toolbox UVMAT.7 %8 % UVMAT is free software; you can redistribute it and/or modify9 % it under the terms of the GNU General Public License as published10 % by the Free Software Foundation; either version 2 of the license,11 % or (at your option) any later version.12 %13 % UVMAT is distributed in the hope that it will be useful,14 % but WITHOUT ANY WARRANTY; without even the implied warranty of15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 % GNU General Public License (see LICENSE.txt) for more details.17 %=======================================================================18 1 19 2 if ~exist('I_1'), -
trunk/src/toolbox_calib/normalize_pixel.m
r924 r926 1 %=======================================================================2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France3 % http://www.legi.grenoble-inp.fr4 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr5 %6 % This file is part of the toolbox UVMAT.7 %8 % UVMAT is free software; you can redistribute it and/or modify9 % it under the terms of the GNU General Public License as published10 % by the Free Software Foundation; either version 2 of the license,11 % or (at your option) any later version.12 %13 % UVMAT is distributed in the hope that it will be useful,14 % but WITHOUT ANY WARRANTY; without even the implied warranty of15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 % GNU General Public License (see LICENSE.txt) for more details.17 %=======================================================================18 19 1 function [xn] = normalize_pixel(x_kk,fc,cc,kc,alpha_c) 20 2 -
trunk/src/toolbox_calib/project_points2.m
r924 r926 1 %=======================================================================2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France3 % http://www.legi.grenoble-inp.fr4 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr5 %6 % This file is part of the toolbox UVMAT.7 %8 % UVMAT is free software; you can redistribute it and/or modify9 % it under the terms of the GNU General Public License as published10 % by the Free Software Foundation; either version 2 of the license,11 % or (at your option) any later version.12 %13 % UVMAT is distributed in the hope that it will be useful,14 % but WITHOUT ANY WARRANTY; without even the implied warranty of15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 % GNU General Public License (see LICENSE.txt) for more details.17 %=======================================================================18 19 1 function [xp,dxpdom,dxpdT,dxpdf,dxpdc,dxpdk,dxpdalpha] = project_points2(X,om,T,f,c,k,alpha) 20 2 … … 240 222 % Pixel coordinates: 241 223 if length(f)>1, 242 xp = xd3 .* (f * ones(1,n)) + c*ones(1,n);224 xp = xd3 .* (f(:) * ones(1,n)) + c(:)*ones(1,n); 243 225 if nargout > 1, 244 coeff = reshape(f *ones(1,n),2*n,1);226 coeff = reshape(f(:)*ones(1,n),2*n,1); 245 227 dxpdom = (coeff*ones(1,3)) .* dxd3dom; 246 228 dxpdT = (coeff*ones(1,3)) .* dxd3dT; -
trunk/src/toolbox_calib/rigid_motion.m
r924 r926 1 %=======================================================================2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France3 % http://www.legi.grenoble-inp.fr4 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr5 %6 % This file is part of the toolbox UVMAT.7 %8 % UVMAT is free software; you can redistribute it and/or modify9 % it under the terms of the GNU General Public License as published10 % by the Free Software Foundation; either version 2 of the license,11 % or (at your option) any later version.12 %13 % UVMAT is distributed in the hope that it will be useful,14 % but WITHOUT ANY WARRANTY; without even the implied warranty of15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 % GNU General Public License (see LICENSE.txt) for more details.17 %=======================================================================18 19 1 function [Y,dYdom,dYdT] = rigid_motion(X,om,T); 20 2 -
trunk/src/toolbox_calib/rodrigues.m
r924 r926 1 %=======================================================================2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France3 % http://www.legi.grenoble-inp.fr4 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr5 %6 % This file is part of the toolbox UVMAT.7 %8 % UVMAT is free software; you can redistribute it and/or modify9 % it under the terms of the GNU General Public License as published10 % by the Free Software Foundation; either version 2 of the license,11 % or (at your option) any later version.12 %13 % UVMAT is distributed in the hope that it will be useful,14 % but WITHOUT ANY WARRANTY; without even the implied warranty of15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 % GNU General Public License (see LICENSE.txt) for more details.17 %=======================================================================18 19 1 function [out,dout]=rodrigues(in) 20 2 … … 206 188 wabs = sqrt(M(3,3)); 207 189 208 mvec = [M(1,2), M(2,3), M(1,3)];209 syn = ((mvec > 1e-4) - (mvec < -1e-4)); % robust sign() function190 mvec = ([M(1,2), M(2,3), M(1,3)] + [M(2,1), M(3,2), M(3,1)])/2; 191 syn = ((mvec > eps) - (mvec < -eps)); % robust sign() function 210 192 hash = syn * [9; 3; 1]; 211 193 idx = find(hash == hashvec); … … 231 213 %% test of the Jacobians: 232 214 233 %% %%TEST OF dRdom:215 %% TEST OF dRdom: 234 216 om = randn(3,1); 235 217 dom = randn(3,1)/1000000; 236 237 218 [R1,dR1] = rodrigues(om); 238 219 R2 = rodrigues(om+dom); 239 240 220 R2a = R1 + reshape(dR1 * dom,3,3); 241 242 221 gain = norm(R2 - R1)/norm(R2 - R2a) 243 222 244 %% %TEST OF dOmdR:223 %% TEST OF dOmdR: 245 224 om = randn(3,1); 246 225 R = rodrigues(om); … … 250 229 [omc,domdR] = rodrigues(R); 251 230 [om2] = rodrigues(R+dR); 252 253 231 om_app = omc + domdR*dR(:); 254 255 232 gain = norm(om2 - omc)/norm(om2 - om_app) 256 233 257 234 258 %%% OTHER BUG: (FIXED NOW!!!) 259 235 %% OTHER BUG: (FIXED NOW!!!) 260 236 omu = randn(3,1); 261 237 omu = omu/norm(omu) … … 265 241 [om om2] 266 242 267 %%% NORMAL OPERATION 268 243 %% NORMAL OPERATION 269 244 om = randn(3,1); 270 245 [R,dR]= rodrigues(om); … … 272 247 [om om2] 273 248 274 return 275 276 % Test: norm(om) = pi 277 249 %% Test: norm(om) = pi 278 250 u = randn(3,1); 279 251 u = u / sqrt(sum(u.^2)); 280 252 om = pi*u; 281 253 R = rodrigues(om); 282 283 254 R2 = rodrigues(rodrigues(R)); 284 285 255 norm(R - R2) 256 257 %% Another test case where norm(om)=pi from Chen Feng (June 27th, 2014) 258 R = [-0.950146567583153 -6.41765854280073e-05 0.311803617668748; ... 259 -6.41765854277654e-05 -0.999999917385145 -0.000401386434914383; ... 260 0.311803617668748 -0.000401386434914345 0.950146484968298]; 261 om = rodrigues(R) 262 norm(om) - pi 263 264 %% Another test case where norm(om)=pi from äœæä¹ (July 1st, 2014) 265 R = [-0.999920129411407 -6.68593208347372e-05 -0.0126384464118876; ... 266 9.53007036072085e-05 -0.999997464662094 -0.00224979713751896; ... 267 -0.0126382639492467 -0.00225082189773293 0.999917600647740]; 268 om = rodrigues(R) 269 norm(om) - pi 270 271 272 273
Note: See TracChangeset
for help on using the changeset viewer.