mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-07 11:28:14 +08:00
Add some more comments
This commit is contained in:
@@ -1031,21 +1031,24 @@ def warp(image, inverse_map=None, map_args={}, output_shape=None, order=1,
|
||||
|
||||
out = None
|
||||
|
||||
# use fast Cython version for specific interpolation orders
|
||||
# use fast Cython version for specific interpolation orders and input
|
||||
if order in range(4) and not map_args:
|
||||
|
||||
matrix = None
|
||||
|
||||
# inverse_map is a transformation matrix as numpy array
|
||||
if isinstance(inverse_map, np.ndarray) and inverse_map.shape == (3, 3):
|
||||
matrix = inverse_map
|
||||
|
||||
# inverse_map is a homography
|
||||
elif isinstance(inverse_map, HOMOGRAPHY_TRANSFORMS):
|
||||
matrix = inverse_map._matrix
|
||||
|
||||
# inverse_map is the inverse of a homography
|
||||
elif (hasattr(inverse_map, '__name__')
|
||||
and inverse_map.__name__ == 'inverse'
|
||||
and get_bound_method_class(inverse_map)
|
||||
in HOMOGRAPHY_TRANSFORMS):
|
||||
|
||||
matrix = np.linalg.inv(six.get_method_self(inverse_map)._matrix)
|
||||
|
||||
if matrix is not None:
|
||||
@@ -1067,6 +1070,7 @@ def warp(image, inverse_map=None, map_args={}, output_shape=None, order=1,
|
||||
|
||||
rows, cols = output_shape[:2]
|
||||
|
||||
# inverse_map is a transformation matrix as numpy array
|
||||
if isinstance(inverse_map, np.ndarray) and inverse_map.shape == (3, 3):
|
||||
inverse_map = ProjectiveTransform(matrix=inverse_map)
|
||||
|
||||
@@ -1075,7 +1079,7 @@ def warp(image, inverse_map=None, map_args={}, output_shape=None, order=1,
|
||||
|
||||
coords = warp_coords(coord_map, (rows, cols, bands))
|
||||
|
||||
# Prefilter not necessary for order 0, 1 interpolation
|
||||
# Pre-filtering not necessary for order 0, 1 interpolation
|
||||
prefilter = order > 1
|
||||
out = ndimage.map_coordinates(image, coords, prefilter=prefilter,
|
||||
mode=mode, order=order, cval=cval)
|
||||
|
||||
Reference in New Issue
Block a user