mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-11 11:25:30 +08:00
Use safe_as_int for input checking.
This commit is contained in:
@@ -8,6 +8,7 @@ from skimage.feature.util import _prepare_grayscale_input_2D
|
||||
from skimage.feature.corner_cy import _corner_fast
|
||||
from ._hessian_det_appx import _hessian_matrix_det
|
||||
from ..transform import integral_image
|
||||
from .._shared.utils import safe_as_int
|
||||
|
||||
|
||||
def _compute_derivatives(image, mode='constant', cval=0):
|
||||
@@ -675,7 +676,7 @@ def corner_subpix(image, corners, window_size=11, alpha=0.99):
|
||||
image = pad(image, pad_width=wext, mode='constant', constant_values=0)
|
||||
|
||||
# add pad width, make sure to not modify the input values in-place
|
||||
corners = corners + wext
|
||||
corners = safe_as_int(corners + wext)
|
||||
|
||||
# normal equation arrays
|
||||
N_dot = np.zeros((2, 2), dtype=np.double)
|
||||
|
||||
@@ -7,6 +7,7 @@ from scipy import ndimage, spatial
|
||||
from skimage._shared.utils import get_bound_method_class
|
||||
from skimage.util import img_as_float
|
||||
from ._warps_cy import _warp_fast
|
||||
from .._shared.utils import safe_as_int
|
||||
|
||||
|
||||
class GeometricTransform(object):
|
||||
@@ -722,6 +723,7 @@ class PolynomialTransform(GeometricTransform):
|
||||
rows = src.shape[0]
|
||||
|
||||
# number of unknown polynomial coefficients
|
||||
order = safe_as_int(order)
|
||||
u = (order + 1) * (order + 2)
|
||||
|
||||
A = np.zeros((rows * 2, u + 1))
|
||||
@@ -958,6 +960,7 @@ def warp_coords(coord_map, shape, dtype=np.float64):
|
||||
>>> warped_image = map_coordinates(image, coords)
|
||||
|
||||
"""
|
||||
shape = safe_as_int(shape)
|
||||
rows, cols = shape[0], shape[1]
|
||||
coords_shape = [len(shape), rows, cols]
|
||||
if len(shape) == 3:
|
||||
|
||||
Reference in New Issue
Block a user