1 | %=======================================================================
|
---|
2 | % Copyright 2008-2015, LEGI UMR 5519 / CNRS UJF 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 |
|
---|
19 | %%% Extraction of the final intrinsic and extrinsic paramaters:
|
---|
20 |
|
---|
21 | check_active_images;
|
---|
22 |
|
---|
23 | if ~exist('solution_error')
|
---|
24 | solution_error = zeros(6*n_ima + 15,1);
|
---|
25 | end;
|
---|
26 |
|
---|
27 | fc = solution(1:2);%***
|
---|
28 | cc = solution(3:4);%***
|
---|
29 | alpha_c = solution(5);%***
|
---|
30 | kc = solution(6:10);%***
|
---|
31 |
|
---|
32 | fc_error = solution_error(1:2);
|
---|
33 | cc_error = solution_error(3:4);
|
---|
34 | alpha_c_error = solution_error(5);
|
---|
35 | kc_error = solution_error(6:10);
|
---|
36 |
|
---|
37 | % Calibration matrix:
|
---|
38 |
|
---|
39 | KK = [fc(1) fc(1)*alpha_c cc(1);0 fc(2) cc(2); 0 0 1];
|
---|
40 | inv_KK = inv(KK);
|
---|
41 |
|
---|
42 | % Extract the extrinsic paramters, and recomputer the collineations
|
---|
43 |
|
---|
44 | for kk = 1:n_ima,
|
---|
45 |
|
---|
46 | if active_images(kk),
|
---|
47 |
|
---|
48 | omckk = solution(15+6*(kk-1) + 1:15+6*(kk-1) + 3);%***
|
---|
49 | Tckk = solution(15+6*(kk-1) + 4:15+6*(kk-1) + 6);%***
|
---|
50 |
|
---|
51 | omckk_error = solution_error(15+6*(kk-1) + 1:15+6*(kk-1) + 3);
|
---|
52 | Tckk_error = solution_error(15+6*(kk-1) + 4:15+6*(kk-1) + 6);
|
---|
53 |
|
---|
54 | Rckk = rodrigues(omckk);
|
---|
55 |
|
---|
56 | Hkk = KK * [Rckk(:,1) Rckk(:,2) Tckk];
|
---|
57 |
|
---|
58 | Hkk = Hkk / Hkk(3,3);
|
---|
59 |
|
---|
60 | else
|
---|
61 |
|
---|
62 | omckk = NaN*ones(3,1);
|
---|
63 | Tckk = NaN*ones(3,1);
|
---|
64 | Rckk = NaN*ones(3,3);
|
---|
65 | Hkk = NaN*ones(3,3);
|
---|
66 | omckk_error = NaN*ones(3,1);
|
---|
67 | Tckk_error = NaN*ones(3,1);
|
---|
68 |
|
---|
69 | end;
|
---|
70 |
|
---|
71 | eval(['omc_' num2str(kk) ' = omckk;']);
|
---|
72 | eval(['Rc_' num2str(kk) ' = Rckk;']);
|
---|
73 | eval(['Tc_' num2str(kk) ' = Tckk;']);
|
---|
74 | eval(['H_' num2str(kk) '= Hkk;']);
|
---|
75 | eval(['omc_error_' num2str(kk) ' = omckk_error;']);
|
---|
76 | eval(['Tc_error_' num2str(kk) ' = Tckk_error;']);
|
---|
77 |
|
---|
78 | end;
|
---|