mirror of
https://github.com/wassname/scikit-image.git
synced 2026-09-12 12:50:49 +08:00
Fix index type error in SLIC function
This commit is contained in:
@@ -66,7 +66,7 @@ def slic(image, n_segments=100, ratio=10., max_iter=10, sigma=1,
|
|||||||
cdef Py_ssize_t height, width
|
cdef Py_ssize_t height, width
|
||||||
height, width = image.shape[:2]
|
height, width = image.shape[:2]
|
||||||
# approximate grid size for desired n_segments
|
# approximate grid size for desired n_segments
|
||||||
cdef Py_ssize_t step = np.ceil(np.sqrt(height * width / n_segments))
|
cdef Py_ssize_t step = int(np.ceil(np.sqrt(height * width / n_segments)))
|
||||||
grid_y, grid_x = np.mgrid[:height, :width]
|
grid_y, grid_x = np.mgrid[:height, :width]
|
||||||
means_y = grid_y[::step, ::step]
|
means_y = grid_y[::step, ::step]
|
||||||
means_x = grid_x[::step, ::step]
|
means_x = grid_x[::step, ::step]
|
||||||
|
|||||||
Reference in New Issue
Block a user