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 | function e = torr_errf2(f, nx1,ny1,nx2,ny2, no_matches, m3)
|
---|
33 | %disp('estimating squared errors on f')
|
---|
34 | f = f /norm(f);
|
---|
35 |
|
---|
36 | r = f(1) .* nx1(:).* nx2(:) + f(2).* ny1(:).* nx2(:) + f(3) .* m3.* nx2(:);
|
---|
37 | r = r + f(4) .* nx1(:).* ny2(:) + f(5) .* ny1(:).* ny2(:)+ f(6) .* m3.* ny2(:);
|
---|
38 | r = r + f(7) .* nx1(:).* m3+ f(8) .* ny1(:).* m3+ f(9) .* m3.* m3;
|
---|
39 | r = r.^2;
|
---|
40 |
|
---|
41 | fdx1 = f(1) .* nx2(:) + f(4) .* ny2(:) + f(7) .* m3;
|
---|
42 | fdx2 = f(1) .* nx1(:) + f(2).* ny1(:) + f(3) .* m3;
|
---|
43 | fdy1 = f(2).* nx2(:) + f(5) .* ny2(:)+ f(8) .* m3;
|
---|
44 | fdy2 = f(4) .* nx1(:) + f(5) .* ny1(:)+ f(6) .* m3;
|
---|
45 |
|
---|
46 | g = (fdx1 .* fdx1 +fdx2 .* fdx2 +fdy1 .* fdy1 +fdy2 .* fdy2);
|
---|
47 |
|
---|
48 | % for non squared error
|
---|
49 | % g = sqrt(fdx1 .* fdx1 +fdx2 .* fdx2 +fdy1 .* fdy1 +fdy2 .* fdy2);
|
---|
50 | % g = sqrt(g);
|
---|
51 |
|
---|
52 | e = r./g;
|
---|
53 |
|
---|