mirror of
https://github.com/visioncortex/vtracer.git
synced 2026-09-29 23:41:20 -07:00
Derive the watershed cutout merge tolerance from the detail dial
The detail dial has no color units - it targets a region count (2^(detail/25.5)) and the cut threshold is volume persistence - so a cutout merge tolerance cannot fall out of it dimensionally. Anchor it instead: at max detail the user asked for every distinction the hierarchy can make (merge only identical colors, as before), and at the default detail (128) it matches the color-cluster default gradient step (16), which is the tolerance the cutout merge was designed around. Linear in between: merge_diff = (255 - detail) / 8, reaching 1 at detail 247. Floor the watershed cutout merge tolerance at a just-noticeable difference Faces a human cannot tell apart (e.g. #863339 next to #863238, 2 L1 apart) are pointless as separate patches at any detail, so the derived tolerance becomes max(2, (255 - detail) / 8): the 248..=255 band merges sub-JND neighbours instead of nothing. The default-detail anchor (16, the color-cluster default gradient step) is unchanged. Cityscape cutout at max detail: 992 faces down to 886.
This commit is contained in:
+1
-1
@@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
* 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.
|
||||
* Watershed clustering (`--clustering watershed`): an alternative region-forming frontend — a hierarchical watershed by volume on the pixel graph (Cousty et al., TPAMI 2009; Najman, Cousty & Perret, ISMM 2013), cut at a single `--watershed-detail` dial (0..=255, each +25.5 roughly doubles the region count). Content-adaptive regions with no watershed-line pixels; antialiased boundary pixels snap to the color-midpoint iso-line, so edges come out as calm as the color-cluster frontend's instead of meandering with the pixel noise inside the ramp. With `cutout` the partition reaches the mosaic natively (no gradient-step re-merge); with `stacked` the merge tree itself is the stack — coarse ancestors below, refined regions on top, the same principle as color clustering — so sub-pixel gaps show ancestor colors and overdraw stays seam-free.
|
||||
* Watershed clustering (`--clustering watershed`): an alternative region-forming frontend — a hierarchical watershed by volume on the pixel graph (Cousty et al., TPAMI 2009; Najman, Cousty & Perret, ISMM 2013), cut at a single `--watershed-detail` dial (0..=255, each +25.5 roughly doubles the region count). Content-adaptive regions with no watershed-line pixels; antialiased boundary pixels snap to the color-midpoint iso-line, so edges come out as calm as the color-cluster frontend's instead of meandering with the pixel noise inside the ramp. With `cutout` the partition reaches the mosaic natively, and near-identical neighbouring faces merge within a detail-derived tolerance (`max(2, (255 − detail) / 8)`: the color-cluster default gradient step at the default detail, and never less than a just-noticeable difference — faces a human cannot tell apart never survive as separate patches); with `stacked` the merge tree itself is the stack — coarse ancestors below, refined regions on top, the same principle as color clustering — so sub-pixel gaps show ancestor colors and overdraw stays seam-free.
|
||||
* `WatershedHierarchy` is public and split into `build` (expensive, depends only on the image) and `cut` (near-instant): `Session` builds it once and re-cuts on every `watershed_detail`/`filter_speckle` change, making the detail slider fully interactive (~25 ms re-cut vs ~40 ms rebuild on a 1400×775 photo).
|
||||
|
||||
### Changed
|
||||
|
||||
Reference in New Issue
Block a user