Merge pull request #398 from ahojnnes/polynomial-order-default

BUG:Polynomial order default.
This commit is contained in:
Stefan van der Walt
2012-12-22 14:02:19 -08:00
2 changed files with 10 additions and 3 deletions
+4 -3
View File
@@ -604,7 +604,7 @@ class PolynomialTransform(GeometricTransform):
raise ValueError("invalid shape of transformation parameters")
self._params = params
def estimate(self, src, dst, order):
def estimate(self, src, dst, order=2):
"""Set the transformation matrix with the explicit transformation
parameters.
@@ -645,7 +645,7 @@ class PolynomialTransform(GeometricTransform):
Source coordinates.
dst : (N, 2) array
Destination coordinates.
order : int
order : int, optional
Polynomial order (number of coefficients is order + 1).
"""
@@ -750,7 +750,8 @@ def estimate_transform(ttype, src, dst, **kwargs):
'affine' `src, `dst`
'piecewise-affine' `src, `dst`
'projective' `src, `dst`
'polynomial' `src, `dst`, `order` (polynomial order)
'polynomial' `src, `dst`, `order` (polynomial order,
default order is 2)
Also see examples below.
@@ -159,6 +159,12 @@ def test_polynomial_init():
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)
def test_union():
tform1 = SimilarityTransform(scale=0.1, rotation=0.3)
tform2 = SimilarityTransform(scale=0.1, rotation=0.9)