-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo_uncalibF_epipoles_nakano_iccv2023.m
64 lines (52 loc) · 2.56 KB
/
demo_uncalibF_epipoles_nakano_iccv2023.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
w = 640;
h = 480;
c1 = [w/2, h/2];
c2 = [w/2, h/2];
f_gt = 400;
d_gt = -1.250000000000000e-06;
K1 = [f_gt 0 c1(1)
0 f_gt c1(2)
0 0 1];
K2 = [f_gt 0 c2(1)
0 f_gt c2(2)
0 0 1];
R_gt = [...
-0.962690637319940 0 -0.270604391716999
-0.042840063293329 0.987389054969578 0.152405981192693
0.267191814608065 0.158312520434374 -0.950550198611396];
t_gt = [...
0.311308391061123
-0.162215200237001
0.936361743380733];
E_gt = skew3x3(t_gt)*R_gt;
E_gt = E_gt / norm(E_gt,'fro');
F_gt = K2'\E_gt/K1;
F_gt = F_gt / norm(F_gt,'fro');
% undistorted image points and epipoles
m1u = [...
9.023271322 619.0895749 364.0161952 130.9043769 476.3047208 125.8794384 372.4883545 620.842773 542.1236042 154.2627181
73.31977124 375.1209488 434.0653303 112.9752038 188.33648 154.5504693 391.613449 294.8789059 365.0408394 205.8515828
1 1 1 1 1 1 1 1 1 1];
m2u = [...
557.3629617 170.9656191 421.9791723 580.259557 407.421612 481.7689788 385.654727 259.1794062 188.2319998 517.6326886
119.0587995 294.544401 326.1735059 94.19786533 152.6659224 158.9909307 393.8259687 204.0643248 317.1095559 157.3473706
1 1 1 1 1 1 1 1 1 1];
e1u = null(F_gt);
e1u = e1u / e1u(3);
e2u = null(F_gt');
e2u = e2u / e2u(3);
% image points and epipoles distorted by d
m1d = distort_pts_k1(m1u,d_gt,c1);
m2d = distort_pts_k1(m2u,d_gt,c2);
e1d = distort_pts_k1(e1u,d_gt,c1);
e2d = distort_pts_k1(e2u,d_gt,c1);
% run minimal solvers
[F1,f1,E1] = Ff6pt_Larsson(m1u(:,1:6),m2u(:,1:6),c1,c2)
[F2,f2,d2,E2] = Ffk7pt_LarssonMartyushev(m1u(:,1:7),m2u(:,1:7),c1,c2,"larsson")
[F3,f3,d3,E3] = Ffk7pt_LarssonMartyushev(m1u(:,1:7),m2u(:,1:7),c1,c2,"martyushev")
[F4,f4,E4] = F3pt_e1e2_Ito(e1u,e2u,m1u(:,1:3),m2u(:,1:3),c1,c2)
[F5,f5,E5] = F5pt_e1_Ito(e1u,m1u(:,1:5),m2u(:,1:5),c1,c2)
[F6,f6,E6] = Ff2pt_e1e2_Nakano(e1u,e2u,m1u(:,1:2),m2u(:,1:2),c1,c2)
[F7,f7,E7] = Ff4pt_e1_Nakano(e1u,m1u(:,1:4),m2u(:,1:4),c1,c2)
[F8,f8,d8,E8] = Ffk3pt_e1e2_Nakano(e1d,e2d,m1d(:,1:3),m2d(:,1:3),c1,c2)
[F9,f9,d9,E9] = Ffk5pt_e1_Nakano(e1d,m1d(:,1:5),m2d(:,1:5),c1,c2)