1 | % By Philip Torr 2002
|
---|
2 | % copyright Microsoft Corp.
|
---|
3 | %
|
---|
4 | % %designed for the good of the world by Philip Torr based on ideas contained in
|
---|
5 | % copyright Philip Torr and Microsoft Corp 2002
|
---|
6 | %
|
---|
7 | %returns the first order approx to the reprojection error as defined in:
|
---|
8 | %
|
---|
9 | % @phdthesis{Torr:thesis,
|
---|
10 | % author="Torr, P. H. S.",
|
---|
11 | % title="Outlier Detection and Motion Segmentation",
|
---|
12 | % school=" Dept. of Engineering Science, University of Oxford",
|
---|
13 | % year=1995}
|
---|
14 | %
|
---|
15 | %
|
---|
16 | %
|
---|
17 | % @article{Torr97c,
|
---|
18 | % author="Torr, P. H. S. and Murray, D. W. ",
|
---|
19 | % title="The Development and Comparison of Robust Methods for Estimating the Fundamental Matrix",
|
---|
20 | % journal="IJCV",
|
---|
21 | % volume = 24,
|
---|
22 | % % number = 3,
|
---|
23 | % % pages = {271--300},
|
---|
24 | % % year=1997
|
---|
25 | %
|
---|
26 | % %the F matrix is defined like:
|
---|
27 | % % (nx2, ny2, m3) f(1 2 3) nx1
|
---|
28 | % % (4 5 6) ny1
|
---|
29 | % % (7 8 9) m3
|
---|
30 | %
|
---|
31 | % %returns the square of the error
|
---|
32 | %
|
---|
33 | % %this one does a non linear estimate of the exact point location!
|
---|
34 | %
|
---|
35 | %
|
---|
36 | % function [e, cx1,cy1,cx2,cy2] = torr_errf_nl_2(f, nx1,ny1,nx2,ny2, no_matches, m3)
|
---|
37 | % %disp('estimating squared errors on f')
|
---|
38 | % f = f /norm(f);
|
---|
39 | %
|
---|
40 | % for (i = 1:no_matches)
|
---|
41 | % [cx1(i,1),cy1(i,1),cx2(i,1),cy2(i,1), e(i,1)] = torr_correct_point(f, nx1(i),ny1(i),nx2(i),ny2(i), m3);
|
---|
42 | % end
|
---|
43 | %
|
---|
44 | %
|
---|
45 | % function [cx1,cy1,cx2,cy2, sq_err] = torr_correct_point(f, nx1,ny1,nx2,ny2, m3)
|
---|
46 | %
|
---|
47 | %
|
---|
48 | % options = optimset('Display','off');
|
---|
49 | % init_point = [nx1,ny1,ny2];
|
---|
50 | %
|
---|
51 | % [est_point, sq_err] = fminsearch('torr_f_reprojection_error', init_point, options, nx1,ny1,nx2,ny2,f, m3);
|
---|
52 | %
|
---|
53 | % cx1 = est_point(1);
|
---|
54 | % cy1 = est_point(2);
|
---|
55 | % cy2 = est_point(3);
|
---|
56 | % cx2 = -(f(4) * cx1* cy2 + f(5) * cy1* cy2+ f(6) * m3* cy2 + f(7) * cx1* m3+ f(8) * cy1* m3+ f(9) * m3* m3);
|
---|
57 | % cx2 = cx2 / ( f(1) * cx1 + f(2)* cy1 + f(3) * m3 );
|
---|
58 | %
|
---|
59 | %
|
---|
60 | %
|
---|
61 | % |
---|