来自 quickshift 分割的 Skimage 区域邻接图 (RAG)

Skimage Region Adjacency Graph (RAG) from quickshift segmentation

我正在尝试使用 Skimage 包中的工具对图像进行分割后创建区域邻接图。使用文档中的示例,我可以使用 SLIC 分割图像并成功创建 RAG。

from skimage import data
from skimage import segmentation
from skimage.future import graph
import matplotlib.pyplot as plt

#Load Image
img = data.coffee()

#Segment image
labels = segmentation.slic(img, compactness=30, n_segments=800)
#Create RAG
g = graph.rag_mean_color(img, labels)
#Draw RAG
gplt = graph.draw_rag(labels, g, img)
plt.imshow(gplt)

但是,如果我使用 segmentation.quickshiftsegmentation.felzenszwalb 分割图像然后创建 RAG,我会在 draw_rag().

处收到错误消息
labels = segmentation.quickshift(img, kernel_size=5, max_dist=5, ratio=0.5)
g = graph.rag_mean_color(img, labels)
gplt = graph.draw_rag(labels, g, img)

labels = segmentation.felzenszwalb(img, scale=100, sigma=0.5, min_size=50)
g = graph.rag_mean_color(img, labels)
gplt = graph.draw_rag(labels, g, img)
Traceback (most recent call last):
  File "C:\Anaconda\lib\site-packages\IPython\core\interactiveshell.py", line 3032, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-34-c0784622a6c7>", line 1, in <module>
    gplt = graph.draw_rag(labels, g, img)
  File "C:\Anaconda\lib\site-packages\skimage\future\graph\rag.py", line 429, in draw_rag
    out[circle] = node_color
IndexError: index 600 is out of bounds for axis 1 with size 600

文档似乎表明 RAG 方法应该与这些方法中的任何一个的片段兼容,所以我不确定我是否做错了什么,有错误,或者 RAG 只能与SLIC分割方法。有什么建议吗?

这似乎是 Skimage 0.11.2 中的一个问题,但在版本 0.12.3 中已修复。