Add chroma-guided alpha suppression for background holes
Pull alpha toward 0 in the unknown band where bg_confidence is high, so green that survives in hair gaps and hole pockets goes transparent (doc section 10). Runs between trimap enforcement and alpha cleanup; sure-foreground pixels are never touched, keyed by the bg_confidence we already compute. On the two samples this clears the faint outer green halo (edge pixels 19.3k -> 16.0k) but has little *visible* effect, because their residual is no longer green: it is magenta from the pymatting unmix on genuine semi-transparent hair (vis-magenta p95 ~0.07, identical pre/post despill), which this pass deliberately leaves alone. The magenta needs a separate colour fix. Knobs live in AlphaPostSettings (chroma_suppress*, default on). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -33,6 +33,12 @@ class AlphaPostSettings:
|
||||
fill_hole_area_ratio: float = 0.00002
|
||||
alpha_floor: float = 0.002
|
||||
alpha_ceil: float = 0.998
|
||||
# Chroma-guided alpha suppression: in the unknown band, pull alpha toward 0
|
||||
# where background (green) confidence is high, clearing spill in gaps/holes.
|
||||
chroma_suppress: bool = True
|
||||
chroma_suppress_bg_low: float = 0.35
|
||||
chroma_suppress_bg_high: float = 0.80
|
||||
chroma_suppress_strength: float = 1.0
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
|
||||
Reference in New Issue
Block a user