From 9d86c9a1e1199c223ac435cb16a39c230c3de313 Mon Sep 17 00:00:00 2001 From: Juan Nunez-Iglesias Date: Mon, 16 Sep 2013 17:33:08 +1000 Subject: [PATCH] Ignore `convert2lab` keyword if not multichannel --- skimage/segmentation/slic_superpixels.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/skimage/segmentation/slic_superpixels.py b/skimage/segmentation/slic_superpixels.py index 07bb54a5..08ea7126 100644 --- a/skimage/segmentation/slic_superpixels.py +++ b/skimage/segmentation/slic_superpixels.py @@ -109,9 +109,8 @@ def slic(image, n_segments=100, compactness=10., max_iter=10, sigma=None, sigma = list(sigma) + [0] image = ndimage.gaussian_filter(image, sigma) - if convert2lab: - - if not multichannel or image.shape[3] != 3: + if convert2lab and multichannel: + if image.shape[3] != 3: raise ValueError("Lab colorspace conversion requires a RGB image.") image = rgb2lab(image)