Changeset 926


Ignore:
Timestamp:
Feb 18, 2016, 12:05:51 PM (8 years ago)
Author:
sommeria
Message:

geometry cqlib updated

Location:
trunk/src
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/geometry_calib.m

    r924 r926  
    12291229hh=findobj('Tag','calib_points');
    12301230if  ~isempty(Coord) && isempty(hh)
    1231     hh=line(Coord_plot(:,1),Coord_plot(:,2),'Color','m','Tag','calib_points','LineStyle','.','Marker','+','MarkerSize',10);
     1231    hh=line(Coord_plot(:,1),Coord_plot(:,2),'Color','m','Tag','calib_points','LineStyle','none','Marker','+','MarkerSize',10);
    12321232elseif isempty(Coord)%empty list of points, suppress the plot
    12331233    delete(hh)
  • trunk/src/mouse_down.m

    r924 r926  
    496496        end
    497497        if isempty(hh)
    498             hh=line(Coord(:,4),Coord(:,5),'Color','m','Tag','calib_points','LineStyle','.','Marker','+');
     498            hh=line(Coord(:,4),Coord(:,5),'Color','m','Tag','calib_points','LineStyle','none','Marker','+');
    499499        else
    500500            set(hh,'XData',Coord(:,4))
  • trunk/src/toolbox_calib/check_active_images.m

    r924 r926  
    1 %=======================================================================
    2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
    3 %   http://www.legi.grenoble-inp.fr
    4 %   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
    5 %
    6 %     This file is part of the toolbox UVMAT.
    7 %
    8 %     UVMAT is free software; you can redistribute it and/or modify
    9 %     it under the terms of the GNU General Public License as published
    10 %     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 of
    15 %     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 %     GNU General Public License (see LICENSE.txt) for more details.
    17 %=======================================================================
    18 
    191if n_ima ~= 0,
    202   
     
    3517    if prod(double(active_images == 0)),
    3618        disp('Error: There is no active image. Run Add/Suppress images to add images');
    37         break
     19        return;
    3820    end;
    3921   
  • trunk/src/toolbox_calib/check_directory.m

    r924 r926  
    1 %=======================================================================
    2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
    3 %   http://www.legi.grenoble-inp.fr
    4 %   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
    5 %
    6 %     This file is part of the toolbox UVMAT.
    7 %
    8 %     UVMAT is free software; you can redistribute it and/or modify
    9 %     it under the terms of the GNU General Public License as published
    10 %     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 of
    15 %     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 %     GNU General Public License (see LICENSE.txt) for more details.
    17 %=======================================================================
    18 
    191% This small script looks in the direcory and checks if the images are there.
    202%
  • trunk/src/toolbox_calib/check_extracted_images.m

    r924 r926  
    1 %=======================================================================
    2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
    3 %   http://www.legi.grenoble-inp.fr
    4 %   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
    5 %
    6 %     This file is part of the toolbox UVMAT.
    7 %
    8 %     UVMAT is free software; you can redistribute it and/or modify
    9 %     it under the terms of the GNU General Public License as published
    10 %     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 of
    15 %     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 %     GNU General Public License (see LICENSE.txt) for more details.
    17 %=======================================================================
    18 
    191check_active_images;
    202
  • trunk/src/toolbox_calib/click_calib.m

    r924 r926  
    1 %=======================================================================
    2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
    3 %   http://www.legi.grenoble-inp.fr
    4 %   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
    5 %
    6 %     This file is part of the toolbox UVMAT.
    7 %
    8 %     UVMAT is free software; you can redistribute it and/or modify
    9 %     it under the terms of the GNU General Public License as published
    10 %     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 of
    15 %     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 %     GNU General Public License (see LICENSE.txt) for more details.
    17 %=======================================================================
    18 
    191%if exist('images_read');
    202%   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, France
    3 %   http://www.legi.grenoble-inp.fr
    4 %   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
    5 %
    6 %     This file is part of the toolbox UVMAT.
    7 %
    8 %     UVMAT is free software; you can redistribute it and/or modify
    9 %     it under the terms of the GNU General Public License as published
    10 %     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 of
    15 %     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 %     GNU General Public License (see LICENSE.txt) for more details.
    17 %=======================================================================
    18 
    191function [x] = comp_distortion_oulu(xd,k);
    202
  • trunk/src/toolbox_calib/comp_error_calib.m

    r924 r926  
    1 %=======================================================================
    2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
    3 %   http://www.legi.grenoble-inp.fr
    4 %   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
    5 %
    6 %     This file is part of the toolbox UVMAT.
    7 %
    8 %     UVMAT is free software; you can redistribute it and/or modify
    9 %     it under the terms of the GNU General Public License as published
    10 %     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 of
    15 %     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 %     GNU General Public License (see LICENSE.txt) for more details.
    17 %=======================================================================
    18 
    191%%%%%%%%%%%%%%%%%%%% RECOMPUTES THE REPROJECTION ERROR %%%%%%%%%%%%%%%%%%%%%%%%
    202
  • trunk/src/toolbox_calib/comp_ext_calib.m

    r924 r926  
    1 %=======================================================================
    2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
    3 %   http://www.legi.grenoble-inp.fr
    4 %   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
    5 %
    6 %     This file is part of the toolbox UVMAT.
    7 %
    8 %     UVMAT is free software; you can redistribute it and/or modify
    9 %     it under the terms of the GNU General Public License as published
    10 %     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 of
    15 %     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 %     GNU General Public License (see LICENSE.txt) for more details.
    17 %=======================================================================
    18 
    191%%% Computes the extrinsic parameters for all the active calibration images
    202
  • trunk/src/toolbox_calib/compute_extrinsic.m

    r924 r926  
    1 %=======================================================================
    2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
    3 %   http://www.legi.grenoble-inp.fr
    4 %   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
    5 %
    6 %     This file is part of the toolbox UVMAT.
    7 %
    8 %     UVMAT is free software; you can redistribute it and/or modify
    9 %     it under the terms of the GNU General Public License as published
    10 %     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 of
    15 %     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 %     GNU General Public License (see LICENSE.txt) for more details.
    17 %=======================================================================
    18 
    191function [omckk,Tckk,Rckk,H,x,ex,JJ] = compute_extrinsic(x_kk,X_kk,fc,cc,kc,alpha_c,MaxIter,thresh_cond),
    202
  • trunk/src/toolbox_calib/compute_extrinsic_init.m

    r924 r926  
    1 %=======================================================================
    2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
    3 %   http://www.legi.grenoble-inp.fr
    4 %   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
    5 %
    6 %     This file is part of the toolbox UVMAT.
    7 %
    8 %     UVMAT is free software; you can redistribute it and/or modify
    9 %     it under the terms of the GNU General Public License as published
    10 %     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 of
    15 %     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 %     GNU General Public License (see LICENSE.txt) for more details.
    17 %=======================================================================
    18 
    191function [omckk,Tckk,Rckk] = compute_extrinsic_init(x_kk,X_kk,fc,cc,kc,alpha_c),
    202
  • trunk/src/toolbox_calib/compute_extrinsic_refine.m

    r924 r926  
    1 %=======================================================================
    2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
    3 %   http://www.legi.grenoble-inp.fr
    4 %   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
    5 %
    6 %     This file is part of the toolbox UVMAT.
    7 %
    8 %     UVMAT is free software; you can redistribute it and/or modify
    9 %     it under the terms of the GNU General Public License as published
    10 %     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 of
    15 %     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 %     GNU General Public License (see LICENSE.txt) for more details.
    17 %=======================================================================
    18 
    191function [omckk,Tckk,Rckk,JJ] = compute_extrinsic_refine(omc_init,Tc_init,x_kk,X_kk,fc,cc,kc,alpha_c,MaxIter,thresh_cond),
    202
  • trunk/src/toolbox_calib/compute_homography.m

    r924 r926  
    1 %=======================================================================
    2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
    3 %   http://www.legi.grenoble-inp.fr
    4 %   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
    5 %
    6 %     This file is part of the toolbox UVMAT.
    7 %
    8 %     UVMAT is free software; you can redistribute it and/or modify
    9 %     it under the terms of the GNU General Public License as published
    10 %     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 of
    15 %     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 %     GNU General Public License (see LICENSE.txt) for more details.
    17 %=======================================================================
    18 
    191function [H,Hnorm,inv_Hnorm] = compute_homography(m,M);
    202
  • trunk/src/toolbox_calib/data_calib.m

    r924 r926  
    1 %=======================================================================
    2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
    3 %   http://www.legi.grenoble-inp.fr
    4 %   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
    5 %
    6 %     This file is part of the toolbox UVMAT.
    7 %
    8 %     UVMAT is free software; you can redistribute it and/or modify
    9 %     it under the terms of the GNU General Public License as published
    10 %     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 of
    15 %     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 %     GNU General Public License (see LICENSE.txt) for more details.
    17 %=======================================================================
    18 
    191%%% This script alets the user enter the name of the images (base name, numbering scheme,...
    202
     
    4123if s_tot < 1,
    4224   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;
    4426end;
    4527
  • trunk/src/toolbox_calib/extract_parameters.m

    r924 r926  
    1 %=======================================================================
    2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
    3 %   http://www.legi.grenoble-inp.fr
    4 %   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
    5 %
    6 %     This file is part of the toolbox UVMAT.
    7 %
    8 %     UVMAT is free software; you can redistribute it and/or modify
    9 %     it under the terms of the GNU General Public License as published
    10 %     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 of
    15 %     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 %     GNU General Public License (see LICENSE.txt) for more details.
    17 %=======================================================================
    181
    192%%% 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, France
    3 %   http://www.legi.grenoble-inp.fr
    4 %   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
    5 %
    6 %     This file is part of the toolbox UVMAT.
    7 %
    8 %     UVMAT is free software; you can redistribute it and/or modify
    9 %     it under the terms of the GNU General Public License as published
    10 %     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 of
    15 %     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 %     GNU General Public License (see LICENSE.txt) for more details.
    17 %=======================================================================
    18 
    191%go_calib_optim
    202%
     
    4830%For now, if using a 3D calibration rig, set quick_init to 1 for an easy initialization of the focal length
    4931
    50 if ~exist('rosette_calibration','var')
    51     rosette_calibration = 0;
    52 end;
    5332
    5433if ~exist('n_ima'),
     
    5938
    6039check_active_images;
    61 
    6240check_extracted_images;
    63 
    6441check_active_images;
    65 
    6642desactivated_images = [];
    6743
    6844recompute_extrinsic = (length(ind_active) < 100); % if there are too many images, do not spend time recomputing the extrinsic parameters twice..
    6945
    70 if (rosette_calibration)
    71   %%% Special Setting for the Rosette:
    72   est_dist = ones(5,1);
    73 end;
    74 
    75 
    7646%%% MAIN OPTIMIZATION CALL!!!!! (look into this function for the details of implementation)
    7747go_calib_optim_iter;
    7848
    79 
    8049if ~isempty(desactivated_images),
    81    
    8250   param_list_save = param_list;
    83    
    8451   fprintf(1,'\nNew optimization including the images that have been deactivated during the previous optimization.\n');
    8552   active_images(desactivated_images) = ones(1,length(desactivated_images));
    8653   desactivated_images = [];
    87    
    8854   go_calib_optim_iter;
    89    
    9055   if ~isempty(desactivated_images),
    9156      fprintf(1,['List of images left desactivated: ' num2str(desactivated_images) '\n' ] );
    9257   end;
    93    
    9458   param_list = [param_list_save(:,1:end-1) param_list];
    95    
    9659end;
    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, France
    3 %   http://www.legi.grenoble-inp.fr
    4 %   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
    5 %
    6 %     This file is part of the toolbox UVMAT.
    7 %
    8 %     UVMAT is free software; you can redistribute it and/or modify
    9 %     it under the terms of the GNU General Public License as published
    10 %     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 of
    15 %     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 %     GNU General Public License (see LICENSE.txt) for more details.
    17 %=======================================================================
    18 
    191%go_calib_optim_iter
    202%
     
    11496check_active_images;
    11597
     98
    11699quick_init = 0; % Set to 1 for using a quick init (necessary when using 3D rigs)
    117100
     
    169152        if isequal(est_fc,[0;1]),
    170153            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
    172155            fprintf(1,'The focal vector fc is not optimized (est_fc=[0;0])\n');
    173156        end;
     
    236219
    237220alpha_smooth = 0.1; % set alpha_smooth = 1; for steepest gradient descent
    238 % alpha_smooth = 0.01; % modified L. Gostiaux
    239221
    240222
    241223% Conditioning threshold for view rejection
    242 thresh_cond = 1e5;
     224thresh_cond = 1e6;
    243225
    244226
     
    260242end;
    261243
    262 
    263 
    264244if ~exist('alpha_c'),
    265245    fprintf(1,'Initialization of the image skew to zero.\n');
     
    268248end;
    269249
    270 if ~exist('fc')& quick_init,
     250if ~exist('fc') && quick_init,
    271251    FOV_angle = 35; % Initial camera field of view in degrees
    272252    fprintf(1,['Initialization of the focal length to a FOV of ' num2str(FOV_angle) ' degrees.\n']);
     
    340320
    341321
    342 while (change > 1e-2)&(iter < MaxIter),
     322while (change > 1e-9) && (iter < MaxIter),
    343323   
    344324    fprintf(1,'%d...',iter+1);
     
    602582solution_error = param_error;
    603583
    604 if ~est_aspect_ratio & isequal(est_fc,[1;1]),
     584if ~est_aspect_ratio && isequal(est_fc,[1;1]),
    605585    solution_error(2) = solution_error(1);
    606586end;
     
    615595
    616596fprintf(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]);   
     597fprintf(1,'Focal Length:          fc = [ %3.5f   %3.5f ] +/- [ %3.5f   %3.5f ]\n',[fc;fc_error]);
     598fprintf(1,'Principal point:       cc = [ %3.5f   %3.5f ] +/- [ %3.5f   %3.5f ]\n',[cc;cc_error]);
     599fprintf(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);
     600fprintf(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]);   
    621601fprintf(1,'Pixel error:          err = [ %3.5f   %3.5f ]\n\n',err_std);
    622602fprintf(1,'Note: The numerical errors are approximately three times the standard deviations (for reference).\n\n\n')
     
    630610alpha_c_max = alpha_c + alpha_c_error/2;
    631611
    632 if (alpha_c_min < 0) & (alpha_c_max > 0),
     612if (alpha_c_min < 0) && (alpha_c_max > 0),
    633613    fprintf(1,'Recommendation: The skew coefficient alpha_c is found to be equal to zero (within its uncertainty).\n');
    634614    fprintf(1,'                You may want to reject it from the optimization by setting est_alpha=0 and run Calibration\n\n');
     
    640620prob_kc = (kc_min < 0) & (kc_max > 0);
    641621
    642 if ~(prob_kc(3) & prob_kc(4))
     622if ~(prob_kc(3) && prob_kc(4))
    643623    prob_kc(3:4) = [0;0];
    644624end;
  • trunk/src/toolbox_calib/ima_read_calib.m

    r924 r926  
    1 %=======================================================================
    2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
    3 %   http://www.legi.grenoble-inp.fr
    4 %   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
    5 %
    6 %     This file is part of the toolbox UVMAT.
    7 %
    8 %     UVMAT is free software; you can redistribute it and/or modify
    9 %     it under the terms of the GNU General Public License as published
    10 %     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 of
    15 %     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 %     GNU General Public License (see LICENSE.txt) for more details.
    17 %=======================================================================
    181
    192if ~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, France
    3 %   http://www.legi.grenoble-inp.fr
    4 %   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
    5 %
    6 %     This file is part of the toolbox UVMAT.
    7 %
    8 %     UVMAT is free software; you can redistribute it and/or modify
    9 %     it under the terms of the GNU General Public License as published
    10 %     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 of
    15 %     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 %     GNU General Public License (see LICENSE.txt) for more details.
    17 %=======================================================================
    18 
    191%init_intrinsic_param
    202%
  • trunk/src/toolbox_calib/is3D.m

    r924 r926  
    1 %=======================================================================
    2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
    3 %   http://www.legi.grenoble-inp.fr
    4 %   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
    5 %
    6 %     This file is part of the toolbox UVMAT.
    7 %
    8 %     UVMAT is free software; you can redistribute it and/or modify
    9 %     it under the terms of the GNU General Public License as published
    10 %     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 of
    15 %     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 %     GNU General Public License (see LICENSE.txt) for more details.
    17 %=======================================================================
    18 
    191function test = is3D(X),
    202
  • trunk/src/toolbox_calib/mosaic.m

    r924 r926  
    1 %=======================================================================
    2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
    3 %   http://www.legi.grenoble-inp.fr
    4 %   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
    5 %
    6 %     This file is part of the toolbox UVMAT.
    7 %
    8 %     UVMAT is free software; you can redistribute it and/or modify
    9 %     it under the terms of the GNU General Public License as published
    10 %     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 of
    15 %     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 %     GNU General Public License (see LICENSE.txt) for more details.
    17 %=======================================================================
    181
    192if ~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, France
    3 %   http://www.legi.grenoble-inp.fr
    4 %   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
    5 %
    6 %     This file is part of the toolbox UVMAT.
    7 %
    8 %     UVMAT is free software; you can redistribute it and/or modify
    9 %     it under the terms of the GNU General Public License as published
    10 %     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 of
    15 %     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 %     GNU General Public License (see LICENSE.txt) for more details.
    17 %=======================================================================
    18 
    191function [xn] = normalize_pixel(x_kk,fc,cc,kc,alpha_c)
    202
  • trunk/src/toolbox_calib/project_points2.m

    r924 r926  
    1 %=======================================================================
    2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
    3 %   http://www.legi.grenoble-inp.fr
    4 %   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
    5 %
    6 %     This file is part of the toolbox UVMAT.
    7 %
    8 %     UVMAT is free software; you can redistribute it and/or modify
    9 %     it under the terms of the GNU General Public License as published
    10 %     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 of
    15 %     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 %     GNU General Public License (see LICENSE.txt) for more details.
    17 %=======================================================================
    18 
    191function [xp,dxpdom,dxpdT,dxpdf,dxpdc,dxpdk,dxpdalpha] = project_points2(X,om,T,f,c,k,alpha)
    202
     
    240222% Pixel coordinates:
    241223if 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);
    243225    if nargout > 1,
    244         coeff = reshape(f*ones(1,n),2*n,1);
     226        coeff = reshape(f(:)*ones(1,n),2*n,1);
    245227        dxpdom = (coeff*ones(1,3)) .* dxd3dom;
    246228        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, France
    3 %   http://www.legi.grenoble-inp.fr
    4 %   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
    5 %
    6 %     This file is part of the toolbox UVMAT.
    7 %
    8 %     UVMAT is free software; you can redistribute it and/or modify
    9 %     it under the terms of the GNU General Public License as published
    10 %     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 of
    15 %     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 %     GNU General Public License (see LICENSE.txt) for more details.
    17 %=======================================================================
    18 
    191function [Y,dYdom,dYdT] = rigid_motion(X,om,T);
    202
  • trunk/src/toolbox_calib/rodrigues.m

    r924 r926  
    1 %=======================================================================
    2 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
    3 %   http://www.legi.grenoble-inp.fr
    4 %   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
    5 %
    6 %     This file is part of the toolbox UVMAT.
    7 %
    8 %     UVMAT is free software; you can redistribute it and/or modify
    9 %     it under the terms of the GNU General Public License as published
    10 %     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 of
    15 %     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 %     GNU General Public License (see LICENSE.txt) for more details.
    17 %=======================================================================
    18 
    191function        [out,dout]=rodrigues(in)
    202
     
    206188                wabs = sqrt(M(3,3));
    207189
    208                 mvec = [M(1,2), M(2,3), M(1,3)];
    209                 syn  = ((mvec > 1e-4) - (mvec < -1e-4)); % robust sign() function
     190                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
    210192                hash = syn * [9; 3; 1];
    211193                idx = find(hash == hashvec);
     
    231213%% test of the Jacobians:
    232214
    233 %%%% TEST OF dRdom:
     215%% TEST OF dRdom:
    234216om = randn(3,1);
    235217dom = randn(3,1)/1000000;
    236 
    237218[R1,dR1] = rodrigues(om);
    238219R2 = rodrigues(om+dom);
    239 
    240220R2a = R1 + reshape(dR1 * dom,3,3);
    241 
    242221gain = norm(R2 - R1)/norm(R2 - R2a)
    243222
    244 %%% TEST OF dOmdR:
     223%% TEST OF dOmdR:
    245224om = randn(3,1);
    246225R = rodrigues(om);
     
    250229[omc,domdR] = rodrigues(R);
    251230[om2] = rodrigues(R+dR);
    252 
    253231om_app = omc + domdR*dR(:);
    254 
    255232gain = norm(om2 - omc)/norm(om2 - om_app)
    256233
    257234
    258 %%% OTHER BUG: (FIXED NOW!!!)
    259 
     235%% OTHER BUG: (FIXED NOW!!!)
    260236omu = randn(3,1);   
    261237omu = omu/norm(omu)
     
    265241[om om2]
    266242
    267 %%% NORMAL OPERATION
    268 
     243%% NORMAL OPERATION
    269244om = randn(3,1);         
    270245[R,dR]= rodrigues(om);
     
    272247[om om2]
    273248
    274 return
    275 
    276 % Test: norm(om) = pi
    277 
     249%% Test: norm(om) = pi
    278250u = randn(3,1);
    279251u = u / sqrt(sum(u.^2));
    280252om = pi*u;
    281253R = rodrigues(om);
    282 
    283254R2 = rodrigues(rodrigues(R));
    284 
    285255norm(R - R2)
     256
     257%% Another test case where norm(om)=pi from Chen Feng (June 27th, 2014)
     258R = [-0.950146567583153 -6.41765854280073e-05 0.311803617668748; ...
     259     -6.41765854277654e-05 -0.999999917385145 -0.000401386434914383; ...
     260      0.311803617668748 -0.000401386434914345 0.950146484968298];
     261om = rodrigues(R)
     262norm(om) - pi
     263
     264%% Another test case where norm(om)=pi from 䜙成义 (July 1st, 2014)
     265R = [-0.999920129411407 -6.68593208347372e-05   -0.0126384464118876; ...
     266     9.53007036072085e-05       -0.999997464662094      -0.00224979713751896; ...
     267    -0.0126382639492467 -0.00225082189773293    0.999917600647740];
     268om = rodrigues(R)
     269norm(om) - pi
     270
     271
     272
     273
Note: See TracChangeset for help on using the changeset viewer.