diff --git a/skimage/segmentation/_slic.pyx b/skimage/segmentation/_slic.pyx index 98a6f6bc..684740d6 100644 --- a/skimage/segmentation/_slic.pyx +++ b/skimage/segmentation/_slic.pyx @@ -51,9 +51,10 @@ def slic(image, n_segments=100, ratio=10., max_iter=10, sigma=1, image = rgb2lab(image) # initialize on grid: + cdef int height, width height, width = image.shape[:2] # approximate grid size for desired n_segments - step = np.ceil(np.sqrt(height * width / n_segments)) + cdef int step = np.ceil(np.sqrt(height * width / n_segments)) grid_y, grid_x = np.mgrid[:height, :width] means_y = grid_y[::step, ::step] means_x = grid_x[::step, ::step]