[37] | 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 g = torr_grad_f(f, nx1,ny1,nx2,ny2, no_matches, m3)
|
---|
| 33 | %disp('estimating squared errors on f')
|
---|
| 34 |
|
---|
| 35 | fdx1 = f(1) .* nx2(:) + f(4) .* ny2(:) + f(7) .* m3;
|
---|
| 36 | fdx2 = f(1) .* nx1(:) + f(2).* ny1(:) + f(3) .* m3;
|
---|
| 37 | fdy1 = f(2).* nx2(:) + f(5) .* ny2(:)+ f(8) .* m3;
|
---|
| 38 | fdy2 = f(4) .* nx1(:) + f(5) .* ny1(:)+ f(6) .* m3;
|
---|
| 39 |
|
---|
| 40 | g = (fdx1 .* fdx1 +fdx2 .* fdx2 +fdy1 .* fdy1 +fdy2 .* fdy2);
|
---|
| 41 |
|
---|
| 42 | % for non squared error
|
---|
| 43 | % g = sqrt(fdx1 .* fdx1 +fdx2 .* fdx2 +fdy1 .* fdy1 +fdy2 .* fdy2);
|
---|
| 44 | % g = sqrt(g);
|
---|
| 45 |
|
---|
| 46 |
|
---|