mirror of
https://github.com/wassname/scikit-image.git
synced 2026-10-29 13:30:24 +08:00
Add residuals method to geometric transforms
This commit is contained in:
1 parent
5b78b2a69e
commit
bf2a5a429b
1 file changed
+22
@@ -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