mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-10 23:41:29 +08:00
Add test cases for piecewise affine
This commit is contained in:
@@ -3,7 +3,8 @@ from numpy.testing import assert_equal, assert_array_almost_equal
|
||||
from skimage.transform._geometric import _stackcopy
|
||||
from skimage.transform import (estimate_transform,
|
||||
SimilarityTransform, AffineTransform,
|
||||
ProjectiveTransform, PolynomialTransform)
|
||||
ProjectiveTransform, PolynomialTransform,
|
||||
PiecewiseAffineTransform)
|
||||
|
||||
|
||||
SRC = np.array([
|
||||
@@ -110,6 +111,14 @@ def test_affine_init():
|
||||
assert_array_almost_equal(tform2.translation, translation)
|
||||
|
||||
|
||||
def test_piecewise_affine():
|
||||
tform = PiecewiseAffineTransform()
|
||||
tform.estimate(SRC, DST)
|
||||
# make sure each single affine transform is exactly estimated
|
||||
assert_array_almost_equal(tform(SRC), DST)
|
||||
assert_array_almost_equal(tform.inverse(DST), SRC)
|
||||
|
||||
|
||||
def test_projective_estimation():
|
||||
# exact solution
|
||||
tform = estimate_transform('projective', SRC[:4, :], DST[:4, :])
|
||||
|
||||
Reference in New Issue
Block a user