fix and improve estimation of geometric transformation parameters

Design matrix was not composed correctly as functional model was incorrect.
Additionally estimation is now based on total least-squares method.
This commit is contained in:
Johannes Schönberger
2012-08-08 19:13:45 +02:00
parent d9a88c95b5
commit eb1e71114c
2 changed files with 40 additions and 15 deletions
+2 -4
View File
@@ -42,7 +42,6 @@ def test_similarity_estimation():
#: exact solution
tform = estimate_transform('similarity', SRC[:2, :], DST[:2, :])
assert_array_almost_equal(tform(SRC[:2, :]), DST[:2, :])
assert_array_almost_equal(tform.inverse(tform(SRC)), SRC)
assert_equal(tform._matrix[0, 0], tform._matrix[1, 1])
assert_equal(tform._matrix[0, 1], - tform._matrix[1, 0])
@@ -68,7 +67,6 @@ def test_affine_estimation():
#: exact solution
tform = estimate_transform('affine', SRC[:3, :], DST[:3, :])
assert_array_almost_equal(tform(SRC[:3, :]), DST[:3, :])
assert_array_almost_equal(tform.inverse(tform(SRC)), SRC)
#: over-determined
tform = estimate_transform('affine', SRC, DST)
@@ -91,10 +89,10 @@ def test_affine_implicit():
def test_projective():
#: exact solution
tform = estimate_transform('projective', SRC[:4, :], DST[:4, :])
assert_array_almost_equal(tform.inverse(tform(SRC)), SRC)
assert_array_almost_equal(tform(SRC[:4, :]), DST[:4, :])
#: over-determined
tform = estimate_transform('projective', SRC[:4, :], DST[:4, :])
tform = estimate_transform('projective', SRC, DST)
assert_array_almost_equal(tform.inverse(tform(SRC)), SRC)