首页 > 解决方案 > 关于使用 skimage 执行基于区域边界的 RAG 的代码

问题描述

关于基于区域边界的 RAG,我不清楚定义 edges_rgb 的代码,如果我对灰度图像执行 RAG 分析,为什么需要将边缘转换为 rgb 颜色?

edges_rgb = color.gray2rgb(edges)
g = graph.rag_boundary(labels, edges)
lc = graph.show_rag(labels, g, edges_rgb, img_cmap=None, edge_cmap='viridis',
                    edge_width=1.2)

标签: python-3.xopencvimage-processingscikit-learnscikit-image

解决方案


事实证明你没有。这段代码做同样的事情:

g = graph.rag_boundary(labels, edges)
lc = graph.show_rag(labels, g, edges, img_cmap='gray', edge_cmap='viridis',
                    edge_width=1.2)

我猜原作者更喜欢使用gray2rgb而不是颜色映射。但这是一个偏好问题,而不是必要性问题!


推荐阅读