scikit-image示例中的错误:RAG阈值处理

时间:2015-01-14 20:50:47

标签: python scikit-image

我是scikit-learning软件包的新手,我正在阅读一些教程,并参加了这个例子:http://scikit-image.org/docs/dev/auto_examples/plot_rag_mean_color.html#example-plot-rag-mean-color-py

from skimage import graph, data, io, segmentation, color
from matplotlib import pyplot as plt


img = data.coffee()

labels1 = segmentation.slic(img, compactness=30, n_segments=400)
out1 = color.label2rgb(labels1, img, kind='avg')

g = graph.rag_mean_color(img, labels1)
labels2 = graph.cut_threshold(labels1, g, 29)
out2 = color.label2rgb(labels2, img, kind='avg')

plt.figure()
io.imshow(out1)
plt.figure()
io.imshow(out2)
io.show()

我收到此错误:

Traceback (most recent call last):
File "ColorThresh.py", line 8, in <module>
out1 = color.label2rgb(labels1, img, kind='avg')
TypeError: label2rgb() got an unexpected keyword argument 'kind'

关于功能的文件:

http://scikit-image.org/docs/dev/api/skimage.color.html?highlight=label2rgb#skimage.color.label2rgb

我在ubuntu 14.04上运行

scikit-image(0.10.1)

python(2.7.6)

任何建议?

1 个答案:

答案 0 :(得分:0)

我试过你的代码。也在Ubuntu 14.04上。 ITS工作正常 我只需安装 scipy http://www.scipy.org/

或者您可以使用pip安装手册所有列表:

# pip install numpy --upgrade
# pip install scipy --upgrade
# pip install matplotlib --upgrade
# pip install ipython --upgrade
# pip install pandas --upgrade
# pip install sympy --upgrade
# pip install nose --upgrade