Use public attribute for parameter values

This commit is contained in:
Johannes Schönberger
2014-01-19 09:40:54 -05:00
parent c262ad2d44
commit b3d62afa28
4 changed files with 84 additions and 55 deletions
+15 -15
View File
@@ -56,19 +56,19 @@ def test_similarity_estimation():
# exact solution
tform = estimate_transform('similarity', SRC[:2, :], DST[:2, :])
assert_array_almost_equal(tform(SRC[:2, :]), DST[:2, :])
assert_equal(tform._matrix[0, 0], tform._matrix[1, 1])
assert_equal(tform._matrix[0, 1], - tform._matrix[1, 0])
assert_equal(tform.matrix_[0, 0], tform.matrix_[1, 1])
assert_equal(tform.matrix_[0, 1], - tform.matrix_[1, 0])
# over-determined
tform2 = estimate_transform('similarity', SRC, DST)
assert_array_almost_equal(tform2.inverse(tform2(SRC)), SRC)
assert_equal(tform2._matrix[0, 0], tform2._matrix[1, 1])
assert_equal(tform2._matrix[0, 1], - tform2._matrix[1, 0])
assert_equal(tform2.matrix_[0, 0], tform2.matrix_[1, 1])
assert_equal(tform2.matrix_[0, 1], - tform2.matrix_[1, 0])
# via estimate method
tform3 = SimilarityTransform()
tform3.estimate(SRC, DST)
assert_array_almost_equal(tform3._matrix, tform2._matrix)
assert_array_almost_equal(tform3.matrix_, tform2.matrix_)
def test_similarity_init():
@@ -83,7 +83,7 @@ def test_similarity_init():
assert_array_almost_equal(tform.translation, translation)
# init with transformation matrix
tform2 = SimilarityTransform(tform._matrix)
tform2 = SimilarityTransform(tform.matrix_)
assert_array_almost_equal(tform2.scale, scale)
assert_array_almost_equal(tform2.rotation, rotation)
assert_array_almost_equal(tform2.translation, translation)
@@ -111,7 +111,7 @@ def test_affine_estimation():
# via estimate method
tform3 = AffineTransform()
tform3.estimate(SRC, DST)
assert_array_almost_equal(tform3._matrix, tform2._matrix)
assert_array_almost_equal(tform3.matrix_, tform2.matrix_)
def test_affine_init():
@@ -128,7 +128,7 @@ def test_affine_init():
assert_array_almost_equal(tform.translation, translation)
# init with transformation matrix
tform2 = AffineTransform(tform._matrix)
tform2 = AffineTransform(tform.matrix_)
assert_array_almost_equal(tform2.scale, scale)
assert_array_almost_equal(tform2.rotation, rotation)
assert_array_almost_equal(tform2.shear, shear)
@@ -155,14 +155,14 @@ def test_projective_estimation():
# via estimate method
tform3 = ProjectiveTransform()
tform3.estimate(SRC, DST)
assert_array_almost_equal(tform3._matrix, tform2._matrix)
assert_array_almost_equal(tform3.matrix_, tform2.matrix_)
def test_projective_init():
tform = estimate_transform('projective', SRC, DST)
# init with transformation matrix
tform2 = ProjectiveTransform(tform._matrix)
assert_array_almost_equal(tform2._matrix, tform._matrix)
tform2 = ProjectiveTransform(tform.matrix_)
assert_array_almost_equal(tform2.matrix_, tform.matrix_)
def test_polynomial_estimation():
@@ -173,20 +173,20 @@ def test_polynomial_estimation():
# via estimate method
tform2 = PolynomialTransform()
tform2.estimate(SRC, DST, order=10)
assert_array_almost_equal(tform2._params, tform._params)
assert_array_almost_equal(tform2.params_, tform.params_)
def test_polynomial_init():
tform = estimate_transform('polynomial', SRC, DST, order=10)
# init with transformation parameters
tform2 = PolynomialTransform(tform._params)
assert_array_almost_equal(tform2._params, tform._params)
tform2 = PolynomialTransform(tform.params_)
assert_array_almost_equal(tform2.params_, tform.params_)
def test_polynomial_default_order():
tform = estimate_transform('polynomial', SRC, DST)
tform2 = estimate_transform('polynomial', SRC, DST, order=2)
assert_array_almost_equal(tform2._params, tform._params)
assert_array_almost_equal(tform2.params_, tform.params_)
def test_polynomial_inverse():