Propose black and white points from the scan
Levels shipped at 0–255 unless someone moved the sliders, and Bicycle Race showed what that costs. Its ink is grey, not black — a scanned engraving, ink at 2–95, paper at 163–255 — and with alpha = 255 − luminance that greyness becomes transparency. No pixel in the exported bundle was even fully opaque, and the downscale to the song's width blended every stroke edge further. Nothing downstream can rescue it. So detection proposes levels too, like it proposes cuts and skew. Notation is two-tone, which makes Otsu's split the measurement wanted; the points sit halfway from it to each end of the range, so the ramp between them survives as antialiasing rather than going jagged. A page already scanned bilevel has no interior split — Otsu degenerates to 0 — and is left alone. Per page, with the median becoming the song's, so a near-blank page cannot set them.
This commit is contained in:
@@ -236,6 +236,14 @@ point just under the paper's luminance and the paper vanishes completely; set th
|
||||
black point at the ink's darkest and notes go solid. It is also the single
|
||||
biggest lever on output size.
|
||||
|
||||
**Detection proposes both**, like it proposes cuts and skew, because the default
|
||||
0–255 is the one setting whose harm is invisible until the bundle is on a tablet.
|
||||
Notation is two-tone, so Otsu's split between ink and paper is the measurement;
|
||||
the points sit halfway from it to each end of the range, leaving the ramp between
|
||||
them as the antialiasing. A page already scanned bilevel has no interior split —
|
||||
Otsu degenerates to 0 there — and is left at 0–255. The proposal is per page and
|
||||
the median becomes the song's, so a near-blank page cannot set it.
|
||||
|
||||
Adaptive methods (CLAHE, adaptive thresholding) are the trap — tuned for text,
|
||||
they eat the thin stuff on notation: hairpin tips, slur ends, ledger lines,
|
||||
tapered beams. A global LUT whose effect you can see beats a local algorithm you
|
||||
|
||||
Reference in New Issue
Block a user