[#76] Line-quality Phase 0: axis-snap + smooth-gate fix + gated dark-outline snap#77
Merged
Conversation
…outline snap Three fidelity-safe line-quality wins, loop-validated on a 23-image harness. - smooth.py: _axis_snap post-pass — straight runs already classified by the fitter, if within ~10deg of an exact 0/45/90/135 axis, snap to exact (length-preserving, endpoint propagated as the pen so contours stay seamless, per-snap drift guard). - pipeline.py: wobble-relief escape on the all-or-nothing smooth gate — keep the smoothed output when it cuts contour wobble >=25% within a 0.10 SSIM hard floor, even when the plain 0.06 tolerance would veto the visibly-sharper result (SSIM rewards the antialiased staircase). The 0.06 safety net is unchanged. - preprocess.py/postprocess.py/pipeline.py: gated dark-outline palette-snap — on the coverage path, collapse scattered near-black outline tints to one clean #000000 layer (luma/DeltaE snap + palette exclusion + output-side fill snap), NO morph erosion. Class-gated (near-black-mass pre-gate) and SSIM-guarded. Harness medians baseline->after: axis_purity 0.199->0.233, jitter 0.427->0.387, dark_colors 33->22, SSIM 0.908->0.907 (flat). c_17 dark 47->1 SSIM +0.034; c_15 dark 125->26 paths 311->192 (cleaner outlines, visually confirmed); c_41 axis +0.10. Only c_15 crosses -0.02 SSIM (the known SSIM metric inversion on the staircase). No class leak; corpus goldens + full suite green; ruff clean. Tests added for _axis_snap and snap_dark_fills. Version 0.5.0 -> 0.5.1. Fixes #76 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #76. Version 0.5.0 → 0.5.1. Three fidelity-safe line-quality wins, validated on a 23-image harness; see the issue for the measured table. Cleaner/straighter outlines on outlined-cartoon art (c_17 dark 47→1 & SSIM +0.034, c_15 311→192 paths visibly cleaner), no class leak (gradient/photo/line-free byte-identical or ±0.003), corpus goldens + full suite green, ruff clean, regression tests added. The only image past the −0.02 SSIM line is c_15 (−0.024) — the known SSIM metric inversion (it scores the cleaner output lower because the staircase overlaps the antialiased original); visually confirmed sharper. No competitor names anywhere.