From be6bb0c809da448a846f6092cfc9085c74380f61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Sun, 22 Jul 2012 16:38:25 +0200 Subject: [PATCH] combination of two transformations of the same type result in this type again --- skimage/transform/_geometric.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/skimage/transform/_geometric.py b/skimage/transform/_geometric.py index a47b51e4..087e4ae6 100644 --- a/skimage/transform/_geometric.py +++ b/skimage/transform/_geometric.py @@ -176,7 +176,13 @@ class ProjectiveTransform(GeometricTransform): """ if isinstance(other, ProjectiveTransform): - return ProjectiveTransform(np.dot(other._matrix, self._matrix)) + # combination of the same types result in a transformation of this + # type again, otherwise use general projective transformation + if type(self) == type(other): + tform = self.__class__ + else: + tform = ProjectiveTransform + return tform(other._matrix.dot(self._matrix)) else: raise TypeError("Cannot combine transformations of differing " "types.")