Vapoursynth FastLineDarken

From wiki.selur.net
Jump to navigation Jump to search

FastLineDarken (1.4x MT MOD by Vectrangle, Didée and Dogway) is a classic line darkener for drawn material, with optional line thinning.

Filtering → Vapoursynth → Line

FastLineDarken controls in Hybrid
FastLineDarken controls in Hybrid

What it does

Each luma pixel is compared with a grey-closed (maximum, then minimum) version of its neighborhood. Where it is darker than its surroundings – on a line – it is lowered; weak lines get proportionally less. Optional thinning makes the lines narrower. Chroma is not changed.

Settings

Control Parameter Range / values Hybrid default Meaning
Strength strength 0 – 256 48 Maximum luma reduction; weaker lines are darkened proportionally less.
Protection protection 0 – 50 5 Keeps the darkest lines from being darkened further; 0 = no protection, about 50 protects everything.
Luma cap luma_cap 0 – 255 191 Neighborhood values brighter than this are treated as this bright, so bright pixels do not blind the detection and grey lines on white still work; lower means less darkening, 255 = off.
Line threshold threshold 0 – 255 4 Darkenings smaller than this are skipped (noise); 0 = off.
Thinning thinning 0 – 256 0 Line thinning; 0 skips the second, much slower path. Thinning also darkens the remaining line pixels a little.
Tools: Expr – akarin, cranexpr, std akarin (std without AVX2) Expression evaluator.

Example

Default settings on a 10-bit YUV 4:2:0 source (640x356):

# Using FastLineDarkenMOD for line darkening
clip = linedarken.FastLineDarkenMOD(clip, tools={'expr': 'akarin'})

How Hybrid calls it

  • FastLineDarken works on YUV and gray clips of every bit depth, integer and float.
  • Values are only written when they differ from the defaults; Hybrid's defaults are the script's defaults.
  • Luma cap and Line threshold are on the 8-bit scale and are scaled to the bit depth by the script; Protection becomes a threshold relative to the format maximum. Strength and Thinning are relative factors.
  • Only the luma is processed; the chroma is copied back.
  • FastLineDarken also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

Origin

FastLineDarken started in the Doom9 forum and was reworked several times; Hybrid uses the MOD version from the script collection. The script notes recommend a threshold of 4 and point out that thinning is the slow part.

Sources