Remove dead colour-model/despill code; simplify despill; refresh stale docs
- chroma: drop BackgroundModel.hsv_center/hue_sigma (unused since the green gating went away), their estimation, _hue_distance, and the now-unused hsv channel from convert_color_spaces (one fewer cvtColor per image). - despill: delete the dead green-channel-algebra path (the pipeline always passes a colour) and fold the remaining Lab-direction despill into a single despill() with no screen_color arg (127 -> 60 lines). Renamed despill_green -> despill. - settings: remove the now-dead ChromaSettings.hue_sigma_min and DespillSettings.green_excess_margin (plus the matching config lines). - docs/comments: generalise stale "green" wording to "background colour" (module docstring, alpha_post/trimap/foreground/settings) and rename the trimap variable green_bg -> screen_bg. Kept: the unmix foreground fallback, --matting-method chroma, and green/blue as illustrative examples. Verified: package compiles, both configs parse, and an auto-detect end-to-end run is unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,6 @@ from dataclasses import dataclass
|
||||
class ChromaSettings:
|
||||
border_ratio: float = 0.04
|
||||
min_samples: int = 2048
|
||||
hue_sigma_min: float = 7.0
|
||||
lab_sigma_min: float = 10.0
|
||||
rgb_sigma_min: float = 0.08
|
||||
# Background-colour auto-detection (used when screen_color is None): find the
|
||||
@@ -50,7 +49,7 @@ class AlphaPostSettings:
|
||||
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.
|
||||
# where background-colour 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
|
||||
@@ -81,12 +80,11 @@ class DespillSettings:
|
||||
enabled: bool = True
|
||||
edge_low: float = 0.005
|
||||
strength: float = 0.92
|
||||
green_excess_margin: float = 0.015
|
||||
edge_expand_radius: int = 2
|
||||
alpha_weight_floor: float = 0.35
|
||||
# Custom-screen despill (when screen_color is set): margin, in Lab a*/b*
|
||||
# units, of chroma allowed along the background colour direction before it is
|
||||
# treated as spill. Larger keeps more of the subject's own colour.
|
||||
# Margin, in Lab a*/b* units, of chroma allowed along the background-colour
|
||||
# direction before it counts as spill. Larger keeps more of the subject's own
|
||||
# colour.
|
||||
color_margin_lab: float = 4.0
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user