Ignore:
Timestamp:
Jan 20, 2022, 8:30:32 PM (3 years ago)
Author:
sommeria
Message:

calibration with plane angl corrected

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/toolbox_calib/go_calib_optim_iter.m

    r926 r1110  
    3030%For now, if using a 3D calibration rig, quick_init is set to 1 for an easy initialization of the focal length
    3131
    32 if ~exist('desactivated_images'),
     32if ~exist('desactivated_images','var')
    3333    desactivated_images = [];
    34 end;
    35 
    36 
    37 
    38 if ~exist('est_aspect_ratio'),
     34end
     35
     36if ~exist('est_aspect_ratio','var')
    3937    est_aspect_ratio = 1;
    40 end;
    41 
    42 if ~exist('est_fc');
     38end
     39
     40if ~exist('est_fc','var')
    4341    est_fc = [1;1]; % Set to zero if you do not want to estimate the focal length (it may be useful! believe it or not!)
    44 end;
    45 
    46 if ~exist('recompute_extrinsic'),
     42end
     43
     44if ~exist('recompute_extrinsic','var')
    4745    recompute_extrinsic = 1; % Set this variable to 0 in case you do not want to recompute the extrinsic parameters
    4846    % at each iterstion.
    49 end;
    50 
    51 if ~exist('MaxIter'),
     47end
     48
     49if ~exist('MaxIter','var')
    5250    MaxIter = 30; % Maximum number of iterations in the gradient descent
    5351end;
    5452
    55 if ~exist('check_cond'),
     53if ~exist('check_cond','var'),
    5654    check_cond = 1; % Set this variable to 0 in case you don't want to extract view dynamically
    5755end;
    5856
    59 if ~exist('center_optim'),
     57if ~exist('center_optim','var'),
    6058    center_optim = 1; %%% Set this variable to 0 if your do not want to estimate the principal point
    6159end;
    6260
    63 if exist('est_dist'),
     61if exist('est_dist','var'),
    6462    if length(est_dist) == 4,
    6563        est_dist = [est_dist ; 0];
     
    6765end;
    6866
    69 if ~exist('est_dist'),
     67if ~exist('est_dist','var'),
    7068    est_dist = [1;1;1;1;0];
    7169end;
    7270
    73 if ~exist('est_alpha'),
     71if ~exist('est_alpha','var'),
    7472    est_alpha = 0; % by default, do not estimate skew
    7573end;
     
    8785fprintf(1,'\n');
    8886
    89 if ~exist('nx')&~exist('ny'),
     87if ~exist('nx','var')&~exist('ny','var'),
    9088    fprintf(1,'WARNING: No image size (nx,ny) available. Setting nx=640 and ny=480. If these are not the right values, change values manually.\n');
    9189    nx = 640;
     
    116114end;
    117115
    118 if ~exist('dont_ask'),
     116if ~exist('dont_ask','var'),
    119117    dont_ask = 0;
    120118end;
     
    161159if ~center_optim, % In the case where the principal point is not estimated, keep it at the center of the image
    162160    fprintf(1,'Principal point not optimized (center_optim=0). ');
    163     if ~exist('cc'),
     161    if ~exist('cc','var'),
    164162        fprintf(1,'It is kept at the center of the image.\n');
    165163        cc = [(nx-1)/2;(ny-1)/2];
     
    228226% Initialization of the intrinsic parameters (if necessary)
    229227
    230 if ~exist('cc'),
     228if ~exist('cc','var')
    231229    fprintf(1,'Initialization of the principal point at the center of the image.\n');
    232230    cc = [(nx-1)/2;(ny-1)/2];
    233231    alpha_smooth = 0.1; % slow convergence
    234 end;
    235 
    236 
    237 if exist('kc'),
    238     if length(kc) == 4;
     232end
     233
     234
     235if exist('kc','var')
     236    if length(kc) == 4
    239237        fprintf(1,'Adding a new distortion coefficient to kc -> radial distortion model up to the 6th degree');
    240238        kc = [kc;0];
    241     end;
    242 end;
    243 
    244 if ~exist('alpha_c'),
     239    end
     240end
     241
     242if ~exist('alpha_c','var')
    245243    fprintf(1,'Initialization of the image skew to zero.\n');
    246244    alpha_c = 0;
    247245    alpha_smooth = 0.1; % slow convergence
    248 end;
    249 
    250 if ~exist('fc') && quick_init,
     246end
     247
     248if ~exist('fc','var') && quick_init
    251249    FOV_angle = 35; % Initial camera field of view in degrees
    252250    fprintf(1,['Initialization of the focal length to a FOV of ' num2str(FOV_angle) ' degrees.\n']);
     
    254252    est_fc = [1;1];
    255253    alpha_smooth = 0.1; % slow
    256 end;
    257 
    258 
    259 if ~exist('fc'),
     254end
     255
     256
     257if ~exist('fc','var')
    260258    % Initialization of the intrinsic parameters:
    261259    fprintf(1,'Initialization of the intrinsic parameters using the vanishing points of planar patterns.\n')
     
    263261    alpha_smooth = 0.1; % slow convergence
    264262    est_fc = [1;1];
    265 end;
     263end
    266264
    267265
Note: See TracChangeset for help on using the changeset viewer.