mirror of
https://github.com/visioncortex/vtracer.git
synced 2026-09-29 23:41:20 -07:00
Cutout: merge neighbouring mosaic regions within one gradient step
The stacked hierarchy deliberately splits smooth areas into gradient layers one deepen_diff apart — that is what makes stacking look continuous. When cutout flattens those layers into a mosaic, the layering degenerates into abutting faces with barely distinguishable fills that clustering would have treated as one region. Add LabelMap::merge_similar: agglomerative union-find over the flattened adjacency graph using the clustering color metric (sum of per-channel absolute diffs, merge when <= deepen_diff). Most-similar pairs union first and each merged region's color is re-derived as the area-weighted mean, so gradient chains only coalesce while they genuinely stay within the threshold — no transitive collapse. compose_mosaic runs it between flattening and boundary extraction; Compositing::Mosaic carries the threshold and Config wires it to layer_difference (gradient step), so there is no new knob. On the gum-tree sample (poster preset, cutout) this drops 919 faces to 745 with no visible difference. Covered by unit tests for the merge semantics (running means, OUTSIDE handling, zero threshold) plus a compose-level test that gradient strips coalesce into one face; goldens and the stacked/cutout equivalence suite are unaffected.
This commit is contained in:
+1
-2
@@ -9,9 +9,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
### Added
|
||||
|
||||
* Progress reporting and cancellation for driving a UI from a worker thread: `Pipeline::run_with_progress` with a `CancelToken` and a per-phase callback.
|
||||
* `Session`: interactive tuning that clusters an image once and re-renders per `Config` change, re-clustering only when a clustering parameter actually changes. Built on `Pipeline::segment`/`finish` (cache the segmentation, re-run just color/curve/optimize); `Config::segment_key` exposes what it compares.
|
||||
* Binary thresholding: a tunable fixed threshold and Bradley–Roth adaptive thresholding for uneven lighting — CLI `--threshold` / `--adaptive` (`--adaptive-window`, `--adaptive-t`), also on `Config`, Python, and Node.
|
||||
* Cutout mode merges neighbouring mosaic regions whose colors are within one gradient step — the flattened tessellation no longer keeps the near-identical faces that stacked gradient layering splits a smooth area into.
|
||||
|
||||
## 1.0.0-alpha.1 - 2026-07-24
|
||||
|
||||
|
||||
Reference in New Issue
Block a user