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

Blobs: build the blob hierarchy as a pgraph graph instead of hand-rolled parent/children + exporters

Aperta
#128 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

Start with src/machinevisiontoolbox/ImageBlobs.py and the existing test_graph_* tests in tests/test_image_blobs.py; compare the current graph output with the pgraph 1.0 exporters and check compatibility with pgraph 0.6.x. Decide how Blob.parent and Blob.children and filtering behave, then preserve the public signatures and output formats while replacing the hand-written exporters.

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

Descrizione

tech-debt

Current state

Blobs (src/machinevisiontoolbox/ImageBlobs.py) represents the blob hierarchy with ad-hoc parent / children references on each Blob, built from OpenCV's findContours hierarchy array. Blobs.graph() (and dotfile()) then re-implements graph export by hand: DOT, Mermaid, fenced Mermaid, GraphML and ELK JSON, roughly 150 lines of string building.

pgraph is already a core dependency (it is only used by BundleAdjust today), and pgraph 1.0 ships exporters for exactly these formats (pgraph.exporters.dot/mermaid/graphml/elk, Graph.export(), Graph.dotfile()), plus rendering to images via GraphViz.

Proposal

  • Build the blob tree as a pgraph.DGraph (parent -> child edges), with Blob instances as vertices (or vertices holding them).
  • Replace the hand-written exporters in Blobs.graph() / dotfile() with the pgraph ones, keeping the public signatures and output formats.
  • Decide whether Blob.parent / Blob.children stay as thin views over the graph or remain stored references (public API, so don't break it).
  • Gain for free: tree traversal, components, plotting and rendered images, and one place to fix export bugs.

Things to check

  • Output compatibility with the existing test_graph_* tests in tests/test_image_blobs.py (node labels, ordering, attributes in GraphML/ELK).
  • Must work with both pgraph 0.6.x (no Vertex, edges() is a set, no exporters module) and 1.0, or the minimum pgraph version has to be raised in pyproject.toml. The exporters exist only in 1.0.
  • Filtering a Blobs set can leave dangling parent/child references (see the warning in the __getitem__/filter docs); a graph representation should either handle or make explicit this.

Related: pgraph test coverage review (BundleAdjust is currently the only pgraph user).

Lingua principale
Python
Stelle
224
Fork
31
Merge medio
1g 20h
PR unite (30g)
28

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 petercorke/machinevision-toolbox-python

Tutte le issue di petercorke/machinevision-toolbox-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.