mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-24 13:20:43 +08:00
Fix im_class access in Python 3.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import warnings
|
||||
import functools
|
||||
import sys
|
||||
|
||||
from . import six
|
||||
|
||||
@@ -54,3 +55,10 @@ class deprecated(object):
|
||||
wrapped.__doc__ = doc + '\n\n ' + wrapped.__doc__
|
||||
|
||||
return wrapped
|
||||
|
||||
|
||||
def get_bound_method_class(m):
|
||||
"""Return the class for a bound method.
|
||||
|
||||
"""
|
||||
return m.im_class if sys.version < '3' else m.__self__.__class__
|
||||
|
||||
@@ -4,6 +4,7 @@ from scipy import ndimage, spatial
|
||||
from skimage.util import img_as_float
|
||||
from ._warps_cy import _warp_fast
|
||||
|
||||
from skimage._shared.utils import get_bound_method_class
|
||||
|
||||
class GeometricTransform(object):
|
||||
"""Perform geometric transformations on a set of coordinates.
|
||||
@@ -1009,8 +1010,8 @@ def warp(image, inverse_map=None, map_args={}, output_shape=None, order=1,
|
||||
if inverse_map in HOMOGRAPHY_TRANSFORMS:
|
||||
matrix = inverse_map._matrix
|
||||
elif hasattr(inverse_map, '__name__') \
|
||||
and inverse_map.__name__ == 'inverse' \
|
||||
and inverse_map.im_class in HOMOGRAPHY_TRANSFORMS:
|
||||
and inverse_map.__name__ == 'inverse' \
|
||||
and get_bound_method_class(inverse_map) in HOMOGRAPHY_TRANSFORMS:
|
||||
matrix = np.linalg.inv(inverse_map.im_self._matrix)
|
||||
if matrix is not None:
|
||||
# transform all bands
|
||||
|
||||
Reference in New Issue
Block a user