我想用我自己的数据从 scikit-Image 初始化 RAG 图形对象,以便利用它对可视化的良好支持。
执行此类初始化需要哪些数据?我应该调用什么函数来执行这样的初始化?
最佳答案
现在从 am 图像初始化图形的唯一方法是 rag_mean_color功能。它在图像及其标记数组中输入。
标记数组可以从任何分割算法获得,例如在分割模块中实现的算法。
这是一个使用 Quickshift 方法的快速示例。为了更好地可视化 RAG,您可以使用 matplotlib 的任何颜色图。
from skimage import data, segmentation
from skimage.future import graph
from matplotlib import pyplot as plt
img = data.chelsea()
# A colormap to draw the edge
cmap = plt.get_cmap('autumn')
# Labelled image
qs_labels = segmentation.quickshift(img, ratio=0.5)
# Image with boundaries marked
qs_marked = segmentation.mark_boundaries(img, qs_labels,color=(0,0,0))
# Constructing the RAG
qs_graph = graph.rag_mean_color(img, qs_labels)
#Drawing the RAG
qs_out = graph.draw_rag(qs_labels, qs_graph , qs_marked, colormap=cmap)
plt.imshow(qs_out)
plt.show()
您还可以查看更详细的RAG Drawing Example
谢谢
关于python - 从 Scikits-Image 初始化 RAG 图的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29752203/