The halo around a blurred-background portrait is not a bad mask, it is the person's own pixels
When you replace a video background with a blurred copy of the original, a smeared ring often shows up around the person. The usual first guess is that the matting mask is sloppy. In the run described here, the ring appears even when the mask is good, because the blur is applied to a picture that still contains the person. The numbers below come from one 3-second, 90-frame clip, a few synthetic…
A blurred ring often appears around a person when a video background is replaced with a blurred copy of the original. The usual assumption is that the matting mask is poor, but this is not always the case. Researchers tested this phenomenon using a 3-second, 90-frame clip, synthetic test figures, and a single run on an Apple-silicon Mac with Python, NumPy, and OpenCV.
They found that blurring first, then pasting the sharp person on top, results in a ring that cannot be removed, while filling the hole first, then blurring, eliminates the ring entirely. The color of the ring is the person's own color, which means dark clothing against a light background creates a darker ring, while red clothing creates a red tint.
Feathering the edges of the person layer does not alleviate the issue, and using a mask smaller than the person or growing the mask too far can exacerbate the problem. The researchers used CIELAB color difference (ΔE) in a band 0 to 4 pixels outside the person to measure the ring's appearance, with a ΔE around 2.3 being roughly noticeable.
The blur strength, measured by the Gaussian sigma, also has an impact, with sigma 18 yielding a ΔE of 17.10 when blurring first, and 0.63 when filling the hole first. The researchers used Telea, Navier-Stokes, and normalized convolution from OpenCV for the fill, but did not use learned inpainting models. The process proved time-consuming, with blurring alone taking 162.4 ms per frame on a single CPU thread and the Telea fill plus blur taking 398.0 ms. The mask for the real-person clip was created using the video background tool in ImgIng, which generated an edge that matched the predicted result of blurring the entire original picture.
For a clean edge, it is recommended to use the transparent background option in ImgIng, which exports WebM files. However, the researchers noted that flicker and slow performance on moving backgrounds, 4K, older devices, fast motion, semi-transparent objects, and shot cuts were not tested.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to