-
Notifications
You must be signed in to change notification settings - Fork 2
/
absolute_orient.m
148 lines (105 loc) · 1.92 KB
/
absolute_orient.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
clc
%format long
format short
% DATA MATRIX
%control model point coordinates in m,
xc = [
210.47
219.92
594.13
] / 1000;
yc = [
896.96
507.34
243.06
] / 1000;
zc = [
174.54
195.46
206.49
] / 1000;
%model coordinates for all the six points in mm
x= [
210.47
219.92
229.82
578.42
587.52
594.13
] / 1000;
y=[
896.96
507.34
206.32
849.63
546.88
243.06
] / 1000;
z=[
174.54
195.46
217.02
174.46
188.91
206.49
] / 1000;
%Ground point xoordinates: the GCPs in m
N = [
223343.72
223345.03
223619.54
];
E = [
670296.32
670542.31
670745.89
];
H = [
1243.65
1259.22
1267.65
];
%matrix of initial parameters IP
IP = getIP(xc, yc, zc, N, E, H);
lm = IP(1,1); %quick access
w = IP(2,1);
p = IP(3,1);
k = IP(4,1);
%rotational matrix Rs
R = getR(w, p, k)';
%differentials of rotational elements
drw = getOmegaDiff(w, p, k);
drp = getPhiDiff(w, p, k);
drk = getKappaDiff(w, p, k);
%number of data points n :
r = length(N); % = len(E) = len(H) :: number of control points
r2 = length(x); % number of all the data points
%first iteration values
A = getA_control(IP, xc, yc, zc, R, drw, drp, drk, r);
L = getL(IP, xc, yc, zc, E, N, H, R, r);
dx = getdx(A,L);
ENH = getCoords(x, y, z, IP, R, r2);
deviations = getDeviations(A, L, dx);
%%%%-------------------------------------%%%
iterations = 7;
for m = 1: iterations
% all shifts above equal to
IP = IP+dx;
w = IP(2,1);
p = IP(3,1);
k = IP(4,1);
R = getR(w, p, k); %get a new rotational
drw = getOmegaDiff(w, p, k);
drp = getPhiDiff(w, p, k);
drk = getKappaDiff(w, p, k);
A = getA_control(IP, xc, yc, zc, R, drw, drp, drk, r);
L = getL(IP, xc, yc, zc, E, N, H, R, r);
dx = getdx(A,L);
% --------------------- accuracy check ------------------------ %
deviations = getDeviations(A, L, dx)
m
if m == iterations
format long
ENH = getCoords(x, y, z, IP, R, r2)
end
end