首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从Scikits-Image初始化RAG图的方法

从Scikits-Image初始化RAG图的方法
EN

Stack Overflow用户
提问于 2015-04-20 23:33:30
回答 1查看 262关注 0票数 2

我想用我自己的数据初始化scikit-Image中的RAG图形对象,以便使用它对可视化的良好支持。

执行这样的初始化需要什么数据?我应该调用什么函数来执行这样的初始化?

EN

回答 1

Stack Overflow用户

发布于 2015-04-21 02:28:46

现在从am图像初始化图形的唯一方法是rag_mean_color函数。它在一个图像和它的标签数组中输入。

标记的阵列可以从任何分割算法获得,例如在分割模块中实现的那些分割算法。

这里有一个使用Quickshift方法的快速示例。为了更好地可视化碎布,您可以使用matplotlib的任何颜色映射。

代码语言:javascript
复制
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

谢谢

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29752203

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档