Revert "Carve background green embedded in the foreground (hole handling)"

This reverts commit f7e12d3.

The carve set alpha to 0 on a colour-thresholded mask across the whole
foreground, which cannot distinguish background green from green the AI
generator bled onto the subject. It therefore (1) deleted green-tinted hair
strands and (2) hard-cut the green-spill silhouette edge, replacing ViTMatte's
anti-aliased edge with a jagged one. Local cues (surround, opacity, thinness,
connectivity, neighbour colour) could not reliably separate green hair from
green holes, so the mask is not fixable by tuning. Reverting restores intact
hair and smooth edges; the finger-gap green stays a minor residual.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-30 20:12:27 +08:00
parent f7e12d3498
commit a9886f1479
4 changed files with 1 additions and 50 deletions
+1 -7
View File
@@ -6,12 +6,7 @@ from pathlib import Path
import numpy as np
from .alpha_post import (
carve_background_holes,
clean_alpha,
enforce_trimap,
suppress_alpha_by_chroma,
)
from .alpha_post import clean_alpha, enforce_trimap, suppress_alpha_by_chroma
from .chroma import compute_bg_confidence
from .despill import despill_green
from .foreground import estimate_foreground_rgb
@@ -78,7 +73,6 @@ def _run_image(
alpha = enforce_trimap(alpha, trimap)
alpha = suppress_alpha_by_chroma(alpha, bg_confidence, trimap, settings.alpha_post)
alpha = clean_alpha(alpha, trimap, settings.alpha_post)
alpha = carve_background_holes(alpha, rgb, settings.alpha_post)
foreground = estimate_foreground_rgb(
rgb, alpha, bg_confidence, model, settings.foreground
)