Remove dead code: unused detect_background_color and ForegroundEstimate extras

- chroma.detect_background_color had no callers anywhere (auto-detection
  goes through estimate_background_model / _background_border_cluster).
- ForegroundEstimate.background and .correction were computed on every
  image but never consumed; only .rgb was used. estimate_foreground_rgb
  now returns the foreground array directly and the dataclass is gone,
  which also drops pymatting return_background work and a per-image
  correction-norm pass.

Verified: CLI output on samples/TestImage3.png is byte-identical
(SHA256) to the pre-cleanup baseline.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-04 22:41:11 +08:00
parent 8417653598
commit 88987f508c
3 changed files with 9 additions and 53 deletions
+1 -1
View File
@@ -178,7 +178,7 @@ def _process_rgb(rgb: np.ndarray, pipeline: MattingPipeline) -> MattingResult:
foreground = estimate_foreground_rgb(
rgb, alpha, bg_confidence, model, settings.foreground
)
corrected_rgb, color_mask = despill(foreground.rgb, alpha, model, settings.despill)
corrected_rgb, color_mask = despill(foreground, alpha, model, settings.despill)
metadata = {
"alpha_source": alpha_source,