From 0293403b685c379944bd986ff925a85b6f949f26 Mon Sep 17 00:00:00 2001 From: Emmanuelle Gouillart Date: Mon, 27 Aug 2012 12:57:24 +0200 Subject: [PATCH] DOC: example in slic segmentation docstring --- skimage/segmentation/_slic.pyx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/skimage/segmentation/_slic.pyx b/skimage/segmentation/_slic.pyx index ecb58efe..b6831e80 100644 --- a/skimage/segmentation/_slic.pyx +++ b/skimage/segmentation/_slic.pyx @@ -14,6 +14,8 @@ def slic(image, n_segments=100, ratio=10., max_iter=10, sigma=1, ---------- image : (width, height, 3) ndarray Input image. + n_segments : int + The (approximate) number of labels in the segmented output image. ratio: float Balances color-space proximity and image-space proximity. Higher values give more weight to color-space. @@ -42,6 +44,15 @@ def slic(image, n_segments=100, ratio=10., max_iter=10, sigma=1, Pascal Fua, and Sabine Süsstrunk, SLIC Superpixels Compared to State-of-the-art Superpixel Methods, TPAMI, May 2012. + Examples + -------- + >>> from skimage.segmentation import slic + >>> from skimage.data import lena + >>> from skimage.util import img_as_float + >>> img = lena() + >>> segments = slic(img, n_segments=100, ratio=10) + >>> # Increasing the ratio parameter yields more square regions + >>> segments = slic(img, n_segments=100, ratio=20) """ image = np.atleast_3d(image) if image.shape[2] != 3: