Log in

View Full Version : Inpainting black borders


Roemer
6th February 2021, 01:18
Hello all
i am working on some video which has a few pixels black borders (it's a cartoon). The borders are between 2 and 10 pixels on the sides.

Now I thought about just inpainting the borders instead of cropping them.

I actually wrote a small function that uses exinpaint to do this:

function InPaintBorder(clip v, int left, int top, int right, int bottom) {
correctedClip = v.Crop(left, top, -right, -bottom).AddBorders(left,top,right,bottom,color=$ffffff).ConvertToRGB(matrix="Rec709", interlaced=false)
mask = BlankClip(width=correctedClip.Width()-left-right, height=correctedClip.Height()-top-bottom).AddBorders(left,top,right,bottom,color=$ffffff).ConvertToRGB(matrix="Rec709", interlaced=false)
return exinpaint(correctedClip, mask, dilate=0, radius=64, color=$ffffff)
}


For single frames, it looks absolutely marvelous. But for animated stuff, as it only looks at the current frame, it shows some temporal instabilities.

Does anyone know of an alternative inpaint which does not have those instabilities?

Many thanks!

wonkey_monkey
6th February 2021, 13:35
The borders are between 2 and 10 pixels on the sides.

Now I thought about just inpainting the borders instead of cropping them.

Cropping them may be the "right" thing to do. "NTSC" and "PAL" digital video, on DVDs for example, is usually 720 pixels wide. But only 704 (NTSC)/702 (PAL) of these pixels are meant to be the actively viewable area. The rest is nominal analogue blanking and should not be displayed.

Inpainting is just one of those problems that has no real solution, only approximations.