fix transformation union and add test case

This commit is contained in:
Johannes Schönberger
2012-07-15 15:47:12 +02:00
parent 234810be10
commit b2ca833509
2 changed files with 28 additions and 3 deletions
+21
View File
@@ -122,6 +122,27 @@ def test_polynomial():
assert_array_almost_equal(tform.forward(SRC), DST, 6)
def test_union():
tform1 = SimilarityTransformation()
scale1 = 0.1
rotation1 = 1
translation1 = (0, 0)
tform1.from_params(scale1, rotation1, translation1)
tform2 = SimilarityTransformation()
scale2 = 0.1
rotation2 = 1
translation2 = (0, 0)
tform2.from_params(scale2, rotation2, translation2)
tform = tform1.union(tform2)
tform = tform1 + tform2
tform = tform1 * tform2
assert_array_almost_equal(tform.scale, scale1 * scale2)
assert_array_almost_equal(tform.rotation, rotation1 + rotation2)
def test_homography():
x = np.zeros((5,5), dtype=np.uint8)
x[1, 1] = 255