source: trunk/src/toolbox_calib/comp_ext_calib.m @ 1053

Last change on this file since 1053 was 926, checked in by sommeria, 9 years ago

geometry cqlib updated

File size: 2.1 KB
RevLine 
[926]1%%% Computes the extrinsic parameters for all the active calibration images
2
3check_active_images;
4
5N_points_views = zeros(1,n_ima);
6
7for kk = 1:n_ima,
8   
9    if exist(['x_' num2str(kk)]),
10       
11        eval(['x_kk = x_' num2str(kk) ';']);
12        eval(['X_kk = X_' num2str(kk) ';']);
13       
14        if (isnan(x_kk(1,1))),
15            if active_images(kk),
16                fprintf(1,'Warning: Cannot calibrate with image %d. Need to extract grid corners first.\n',kk)
17                fprintf(1,'         Set active_images(%d)=1; and run Extract grid corners.\n',kk)
18            end;
19        end;
20        if active_images(kk),
21            N_points_views(kk) = size(x_kk,2);
22            [omckk,Tckk] = compute_extrinsic_init(x_kk,X_kk,fc,cc,kc,alpha_c);
23            [omckk,Tckk,Rckk,JJ_kk] = compute_extrinsic_refine(omckk,Tckk,x_kk,X_kk,fc,cc,kc,alpha_c,20,thresh_cond);
24            if check_cond,
25                if (cond(JJ_kk)> thresh_cond),
26                    active_images(kk) = 0;
27                    omckk = NaN*ones(3,1);
28                    Tckk = NaN*ones(3,1);
29                    fprintf(1,'\nWarning: View #%d ill-conditioned. This image is now set inactive.\n',kk)
30                    desactivated_images = [desactivated_images kk];
31                end;
32            end;
33            if isnan(omckk(1,1)),
34                %fprintf(1,'\nWarning: Desactivating image %d. Re-activate it later by typing:\nactive_images(%d)=1;\nand re-run optimization\n',[kk kk])
35                active_images(kk) = 0;
36            end;
37        else
38            omckk = NaN*ones(3,1);
39            Tckk = NaN*ones(3,1);
40        end;
41       
42    else
43       
44        omckk = NaN*ones(3,1);
45        Tckk = NaN*ones(3,1);
46       
47        if active_images(kk),
48            fprintf(1,'Warning: Cannot calibrate with image %d. Need to extract grid corners first.\n',kk)
49            fprintf(1,'         Set active_images(%d)=1; and run Extract grid corners.\n',kk)
50        end;
51       
52        active_images(kk) = 0;
53       
54    end;
55   
56    eval(['omc_' num2str(kk) ' = omckk;']);
57    eval(['Tc_' num2str(kk) ' = Tckk;']);
58   
59end;
60
61
62check_active_images;
Note: See TracBrowser for help on using the repository browser.