Help us understand the problem. What is going on with this article?

SLIC Superpixel segmentation in scikit image

More than 5 years have passed since last update.

To calculate SLIC superpixels in python, we have two options:

I found that these provided completely different segmentation unless enforce_connectivity=True in skimage.segmentation.slic. Here I show a brief example describing how different they are, which we could not see at http://scikit-image.org/docs/dev/auto_examples/plot_segmentations.html

example.py
from skimage.segmentation import slic, mark_boundaries
from skimage.data import lena
import slic as slic_wrap # code available at https://github.com/amueller/slic-python
import matplotlib.pyplot as plt

img = lena()

plt.subplot(1,3,1)
plt.imshow(mark_boundaries(img, slic_wrap.slic_n(img, 40, 10)))
title('Original version')
plt.subplot(1,3,2)
plt.imshow(mark_boundaries(img, slic(img, 40, 10, sigma=1, enforce_connectivity=False)))
title('skimage version\n enforce_connectivity=False', size=9)
plt.subplot(1,3,3)
plt.imshow(mark_boundaries(img, slic(img, 40, 10, sigma=1, enforce_connectivity=True)))
title('skimage version\n  enforce_connectivity=True', size=9)

Here I tried to tune the parameter sigma in skimage version to obtain a similar output to the original version. Obviously, enforce_connectivity option is essential to avoid color-sensitive segments.

Screen Shot 2014-07-08 at 9.56.51.png

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away