【问题标题】:Skimage Region Adjacency Graph (RAG) from quickshift segmentation来自 quickshift 分割的 Skimage 区域邻接图 (RAG)
【发布时间】:2016-07-27 18:00:48
【问题描述】:

我正在尝试使用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.quickshift 或 segmentation.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 分段一起使用方法。有什么建议吗?

【问题讨论】:

    标签: python python-2.7 classification image-segmentation scikit-image


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2020-01-13
      • 2020-03-07
      • 1970-01-01
      • 1970-01-01
      • 2019-08-06
      • 1970-01-01
      • 2019-08-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多