mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-09 23:11:31 +08:00
Improve conditioning of homography design matrix
This commit is contained in:
@@ -264,6 +264,10 @@ class ProjectiveTransform(GeometricTransform):
|
||||
Destination coordinates.
|
||||
|
||||
"""
|
||||
|
||||
src_matrix, src = _center_and_normalize_points(src)
|
||||
dst_matrix, dst = _center_and_normalize_points(dst)
|
||||
|
||||
xs = src[:, 0]
|
||||
ys = src[:, 1]
|
||||
xd = dst[:, 0]
|
||||
@@ -296,6 +300,9 @@ class ProjectiveTransform(GeometricTransform):
|
||||
H.flat[list(self._coeffs) + [8]] = - V[-1, :-1] / V[-1, -1]
|
||||
H[2, 2] = 1
|
||||
|
||||
# De-center and de-normalize
|
||||
H = np.dot(np.linalg.inv(dst_matrix), np.dot(H, src_matrix))
|
||||
|
||||
self.params = H
|
||||
|
||||
def __add__(self, other):
|
||||
|
||||
Reference in New Issue
Block a user