[PYTHON] Segmentation SLIC Superpixel dans une image scikit

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

Recommended Posts

Segmentation SLIC Superpixel dans une image scikit
Implémentation de la segmentation d'image en python (Union-Find)
Format d'image en Python
Segmentation d'image à l'aide de U-net
Téléchargeur d'images avec Flask
Tweet avec image en Python
Collection de traitement d'image en Python
Mémo d'ajout d'image dans reportlab