mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-13 10:19:45 +08:00
Add residuals method to geometric transforms
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user