Fix index type error in SLIC function

This commit is contained in:
Johannes Schönberger
2013-02-15 15:11:54 +01:00
parent 983cb76319
commit 7e578b5dec
+1 -1
View File
@@ -66,7 +66,7 @@ def slic(image, n_segments=100, ratio=10., max_iter=10, sigma=1,
cdef Py_ssize_t height, width
height, width = image.shape[:2]
# 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]
means_y = grid_y[::step, ::step]
means_x = grid_x[::step, ::step]