gpt4 book ai didi

python - 将边缘检测转换为蒙版

转载 作者:行者123 更新时间:2023-12-02 16:16:00 25 4
gpt4 key购买 nike

给我应用边缘检测滤镜的图像,将如何实现标记段中点的“和”的蒙版(希望高效/高效)?
图片说明:
enter image description here
先感谢您。
更新:
添加了更亮的图像(https://imgur.com/a/MN0t3pH)的示例。
如您在下图中所看到的,我们假设当用户标记一个区域(ROI)时,将有一个对象从其背景中“突出”。我们的最终目标是获得该对象的最准确的“蒙版”,因此我们可以将其用于ML处理。
enter image description here

最佳答案

1.
鉴于您拥有“ROI”监督,我强烈建议您探索GrabCut(由YoniChechnik提议):
牧师C,科尔莫哥洛夫V,布莱克A. "GrabCut" interactive foreground extraction using iterated graph cuts。图形上的ACM事务(TOG)。 2004年。
要了解其工作原理,可以使用PowerPoint的“背景消除”工具:
enter image description here
这是基于GrabCut算法的。
这是在Power Point中的外观:
enter image description here
GrabCut主要根据前景/背景颜色分布将前景对象分割为选定的ROI,而边缘/边界信息则较少,尽管可以将这些额外信息集成到公式中。
似乎opencv具有GrabCut的基本实现,请参见here

2.
如果正在寻找仅使用边界信息的方法,则可能会发现this answer有用。

3.
另一种方法是使用NCuts:
Shi J,Malik J. Normalized cuts and image segmentation。关于模式分析和机器智能的IEEE Transactions 2000。
如果您有非常可靠的边缘图,则可以将NCuts使用的“亲和矩阵”修改为二进制矩阵

         0  if there is a boundary between i and j
w_ij = 1 if there is no boundary between i and j
0 if i and j are not neighbors of each other
NCuts可以看作是一种估计“鲁棒连接组件”的方法。

关于python - 将边缘检测转换为蒙版,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62622154/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com