Ignore convert2lab keyword if not multichannel

This commit is contained in:
Juan Nunez-Iglesias
2013-09-16 17:33:08 +10:00
parent bf5f08e894
commit 9d86c9a1e1
+2 -3
View File
@@ -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)