Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Feature Request: General λ-connected (lambda-connected) segmentation (beyond flood_fill())

Aperta
#1,273 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

Iniziare esaminando le interfacce esistenti di cv2.floodFill() e skimage flood/flood_fill(), quindi determinare se questa funzionalità di segmentazione debba appartenere al repository di packaging di opencv-python o a OpenCV upstream. Il lavoro sarà completato quando saranno concordati un’API lambda-connected e l’ambito dell’implementazione, e sarà stato verificato che restituisca la maschera booleana proposta senza sostituire il comportamento esistente di flood-fill.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Python
Stelle
5.4k
Fork
1k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di opencv/opencv-python

Tutte le issue di opencv/opencv-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.