我想用我自己的数据初始化scikit-Image中的RAG图形对象,以便使用它对可视化的良好支持。
执行这样的初始化需要什么数据?我应该调用什么函数来执行这样的初始化?
发布于 2015-04-21 02:28:46
现在从am图像初始化图形的唯一方法是rag_mean_color函数。它在一个图像和它的标签数组中输入。
标记的阵列可以从任何分割算法获得,例如在分割模块中实现的那些分割算法。
这里有一个使用Quickshift方法的快速示例。为了更好地可视化碎布,您可以使用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
谢谢
https://stackoverflow.com/questions/29752203
复制相似问题