mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-18 12:30:14 +08:00
Added test for slic segmentation: case where more segments than pixels
are asked for.
This commit is contained in:
committed by
Juan Nunez-Iglesias
parent
12c173908f
commit
bb64e8cfcb
@@ -155,7 +155,8 @@ def slic(image, n_segments=100, compactness=10., max_iter=10, sigma=0,
|
||||
# initialize cluster centroids for desired number of segments
|
||||
grid_z, grid_y, grid_x = np.mgrid[:depth, :height, :width]
|
||||
slices = regular_grid(image.shape[:3], n_segments)
|
||||
step_z, step_y, step_x = [int(s.step) for s in slices]
|
||||
step_z, step_y, step_x = [int(s.step if s.step is not None else 1)
|
||||
for s in slices]
|
||||
segments_z = grid_z[slices]
|
||||
segments_y = grid_y[slices]
|
||||
segments_x = grid_x[slices]
|
||||
|
||||
Reference in New Issue
Block a user