Add residuals method to geometric transforms

This commit is contained in:
Johannes Schönberger
2013-05-01 12:57:30 +02:00
parent 5b78b2a69e
commit bf2a5a429b
+22
View File
@@ -61,6 +61,28 @@ class GeometricTransform(object):
# well- and over-determined.
return False
def residuals(self, src, dst):
"""Determine residuals of transformed destination coordinates.
For each transformed source coordinate the euclidean distance to the
respective destination coordinate is determined.
Parameters
----------
src : (N, 2) array
Source coordinates.
dst : (N, 2) array
Destination coordinates.
Returns
-------
residuals : (N, ) array
Residual for coordinate.
"""
return np.sqrt(np.sum((self(src) - dst) ** 2, axis=1))
def __add__(self, other):
"""Combine this transformation with another.