mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-10 09:56:41 +08:00
Rename km_segmentation to slic. They have a PAMI paper now so I guess we should use their name.
This commit is contained in:
@@ -6,12 +6,12 @@ import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
from skimage.data import lena
|
||||
from skimage.segmentation import km_segmentation, visualize_boundaries
|
||||
from skimage.segmentation import slic, visualize_boundaries
|
||||
from skimage.util import img_as_float
|
||||
from skimage.color import rgb2lab
|
||||
|
||||
img = img_as_float(lena()).copy("C")
|
||||
segments = km_segmentation(rgb2lab(img), ratio=10.0, n_segments=1000)
|
||||
segments = slic(rgb2lab(img), ratio=10.0, n_segments=1000)
|
||||
|
||||
print("number of segments: %d" % len(np.unique(segments)))
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from .random_walker_segmentation import random_walker
|
||||
from .felzenszwalb import felzenszwalb_segmentation
|
||||
from .km_segmentation import km_segmentation
|
||||
from .slic import slic
|
||||
from .quickshift import quickshift
|
||||
from .boundaries import find_boundaries, visualize_boundaries
|
||||
|
||||
__all__ = [random_walker, quickshift, felzenszwalb_segmentation,
|
||||
km_segmentation, find_boundaries, visualize_boundaries]
|
||||
slic, find_boundaries, visualize_boundaries]
|
||||
|
||||
@@ -17,8 +17,8 @@ def configuration(parent_package='', top_path=None):
|
||||
cython(['quickshift.pyx'], working_path=base_path)
|
||||
config.add_extension('quickshift', sources=['quickshift.c'],
|
||||
include_dirs=[get_numpy_include_dirs()])
|
||||
cython(['km_segmentation.pyx'], working_path=base_path)
|
||||
config.add_extension('km_segmentation', sources=['km_segmentation.c'],
|
||||
cython(['slic.pyx'], working_path=base_path)
|
||||
config.add_extension('slic', sources=['slic.c'],
|
||||
include_dirs=[get_numpy_include_dirs()])
|
||||
|
||||
return config
|
||||
|
||||
@@ -5,7 +5,7 @@ from scipy import ndimage
|
||||
from ..util import img_as_float
|
||||
|
||||
|
||||
def km_segmentation(image, n_segments=100, ratio=10., max_iter=10, sigma=1):
|
||||
def slic(image, n_segments=100, ratio=10., max_iter=10, sigma=1):
|
||||
"""Segments image using k-means clustering in Color-(x,y) space.
|
||||
|
||||
Parameters
|
||||
@@ -32,9 +32,9 @@ def km_segmentation(image, n_segments=100, ratio=10., max_iter=10, sigma=1):
|
||||
|
||||
References
|
||||
----------
|
||||
.. [1] Slic superpixels, Achanta, R. and Shaji, A. and Smith, K. and Lucchi,
|
||||
A. and Fua, P. and Suesstrunk, S.
|
||||
Technical Report 2010
|
||||
.. [1] Radhakrishna Achanta, Appu Shaji, Kevin Smith, Aurelien Lucchi,
|
||||
Pascal Fua, and Sabine Süsstrunk, SLIC Superpixels Compared to
|
||||
State-of-the-art Superpixel Methods, TPAMI, May 2012.
|
||||
|
||||
"""
|
||||
image = np.atleast_3d(image)
|
||||
Reference in New Issue
Block a user