diff --git a/skimage/transform/_geometric.py b/skimage/transform/_geometric.py index 4b2a38d5..1fcb55bb 100644 --- a/skimage/transform/_geometric.py +++ b/skimage/transform/_geometric.py @@ -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.