Feature Request: General λ-connected (lambda-connected) segmentation (beyond flood_fill())
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 活跃
- 技术栈
- python
调研方向
首先检查现有的 cv2.floodFill() 和 skimage flood/flood_fill() 接口,然后确定此分割功能应属于 opencv-python 打包仓库还是 OpenCV upstream。完成的要求是:就 lambda-connected API 和实现范围达成一致,并验证它会返回所提议的布尔掩码,同时不替换现有的 flood-fill 行为。
由索引模型根据 Issue 内容生成。
描述
Title: Feature Request: General λ-connected (lambda-connected) segmentation
Summary
Both cv2.floodFill() and skimage.segmentation.flood()/flood_fill() implement region-growing using a purely local, pairwise similarity rule — a pixel is added if it differs from an already-included neighbor by less than a fixed tolerance. This is fast and simple, but it inherits a well-known weakness: gradient leakage. A smooth intensity gradient can chain together pixels that are locally similar at every step but globally very different, causing the region to "leak" past intended boundaries.
Proposed addition
Implement λ-connected segmentation, a formal generalization of region-growing based on fuzzy connectedness theory. Instead of a local pairwise test, connectivity between two pixels is defined by the strongest path between them — specifically, the maximum over all paths of the minimum pairwise similarity along that path (a max-min / bottleneck-path formulation). Two pixels are λ-connected if this path strength is ≥ λ.
Why this is a natural fit
• It's a strict generalization: setting λ's degree function to a simple local threshold and ignoring the path constraint collapses back to today's flood_fill() behavior — so it wouldn't replace existing functionality, only extend it.
• It directly addresses flood-fill's most common failure mode (leakage through gradients) without requiring users to switch to a heavier method like GrabCut or a full DL segmentation model.
• Efficient implementation is well understood: this is equivalent to a maximum-capacity/bottleneck shortest-path problem, solvable with a Dijkstra-like or Kruskal-like (max-spanning-forest) approach in effectively linear-ish time for practical image sizes — no need for iterative PDE solvers.
• It would sit naturally alongside existing skimage.segmentation tools (flood, watershed, random_walker, chan_vese) as another region-growing option, giving users a controlled way to compare "naive" vs. "leak-resistant" region growing on the same image.
• Related lambda-connectedness methods already have precedent in imaging toolkits (e.g., Leadtools lambda-connectedness segmentation), so this isn't an unprecedented ask — it would bring scikit-image/OpenCV's region-growing toolbox to parity with a well-established technique in medical/scientific imaging.
python
cv2.segmentation.lambda_connected(image, seed, lam, connectivity=1, degree_func='intensity_diff')
Returns a boolean mask, mirroring flood()'s existing interface for easy comparison in the same script.
References
• L. Chen, Cheng, H.D. and Zhang, J., 1994. Fuzzy subfiber and its application to seismic lithology classification. Information Sciences-Applications, 1(2), pp.77-95.
• L. Chen, "The lambda-connected segmentation and the optimal algorithm for split-and-merge segmentation," Chinese J. Computers, Vol. 14, pp. 321–331, 1991.
- 主要语言
- Python
- 星标
- 5.4k
- 派生
- 1k
- 平均合并
- 22 小时 17 分钟
- 30 天内合并 PR
- 3
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
opencv/opencv-python 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 85/100
opencv/opencv-python#1217 · 3 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
opencv/opencv-python#1165 · 2 条评论 · 1 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 45/100
opencv/opencv-python#1272 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 70/100
opencv/opencv-python#1268 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 45/100
opencv/opencv-python#1267 ·
查看 opencv/opencv-python 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
stephrobert/dsoxlab#238 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100
sublimehq/package_control#1780 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 2/5 1-3 小时 新手友好度 70/100
nwg-piotr/nwg-displays#145 ·