InpaintFunc
m (1 revision) |
Revision as of 00:03, 20 May 2013
Abstract | |
---|---|
Author | Reuf Toc |
Version | 1.13 |
Download | InpaintFunc.avs |
Category | Logo removal |
Requirements |
YV12, YUY2, RGB24, RGB32 |
License | |
Discussion |
InpaintFunc(clip clp, string "mask", string "loc", float "AR", string "mode",int "speed", int "pp", int "ppmode", bool "reset", float "radius", float "sharpness", float "preblur", float"postblur")
InpaintAssist(clip clp, string "loc", string "alignment")
Contents |
Abstract
InpaintFunc is a new delogo function using AVSInpaint.dll an AviSynth C plugin developed by AMSS. See thread : http://forum.doom9.org/showthread.php?t=133682 to download this plugin and get more information about it. Just some advice : AVSInpaint plugin is rather slow so be patient ;-)
Requires Filters
AVSInpaint is an avisynth C plugin, don't forget to add loadCplugin("xxx\AVSInpaint.dll") in your script before calling this function !!!
Background Information
Image Inpainting is the art of restoring destroyed parts of an image by using information of valid parts of the image in a way, so that the human eye does not recognize the damaged areas (at least not at a first sight). In video processing image inpainting is often applied to videos in order to remove TV station logos.
Description
Uses AVSInpaint to remove a logo, such as that of a TV station, from a specified clip.
clp clip = last
The clip to be "delogo-ed".
mask string = null
Path to the mask of the logo. The mask is a black and white picture. Areas where the logo is are white, the rest is black. Example : mask="C:\my_mask.bmp"
loc string = null
Select the region of the picture where the logo to remove is.
See the table :
______________ ______________ | TL | TC |TR | | X1 | X2 |X3 | |____|____|___| |____|____|___| | ML | MC |MR | or | Y1 | Y2 |Y3 | |____|____|___| |____|____|___| | BL | BC |BR | | Z1 | Z2 |Z3 | |____|____|___| |____|____|___|
If the logo you want to remove is in the top right corner, then you can choose either loc="TR" or loc="x3".
But if you're not satisfied with those presets, you can enter your own parameters by pixels to isolate the logo.
example : loc = "0,300,-440,-20". Spaces are not allowed in "loc" parameter.
AR float = 1.0
The Sample Aspect Ratio of your video. E.g. : 16/9, 4/3... (Default 1.0). This value is used to calculate the PAR of your video. If you don't set this parameter, then PAR will be set to 1:1. When you set the AR, take care to add ".0" to your values if you use exact value (16/9 or 4/3). Example : AR=16.0/9.0 or AR=4.0/3.0 .
mode string = "both"
3 Choices (default both) :
- Deblend : If the logo is transparent, use this mode.
- Inpaint : If the logo is opaque, use this mode.
- Both : If the logo is both opaque and transparent, use this mode.
speed int = 5
With this parameter you can speed up this function by trimming the clip analyzed by AnalyseLogo. A value of 20 means that 100% of clip will be analyzed. With a value of 1, only 5% will be analyzed. (min value 1, max value 20, default 5).
PPmode int = 0
If you want to apply post-processing, 3 modes are available. Default is 0 (disabled)
- Mode 1 : Blur all the area where logo was present.
- Mode 2 : Blur all the area where logo was present using TemporalSoften and SpatialSoften.
- Mode 3 : Blur only the edge of logo area using TemporalSoften and SpatialSoften..
PP int = 50
Strength of the post-processing. Default is 50 (min value 0, max value 100)
A 0 value will disable post processing, 100 will process at full strength.
Reset bool = False
InpaintFunc contain a feature that allow to not compute logo analysis when it was already done.
By setting Reset to true, logo analysis is always computed. Default is false.
Radius Float = 8.0
Radius around a damaged pixel from where values are taken when the pixel is inpainted. Bigger values prevent inpainting in the wrong direction, but also create more blur.
Sharpness Float = 75.0
Higher values can prevent blurring caused by high Radius values.
PreBlur Float = 8.0
Standard deviation of the blur which is applied to the image before the structure tensor is computed. Higher values help connecting isophotes which have been cut by the inpainting region, but also increase CPU usage. PreBlur=0.0 disables pre-blurring.
PostBlur Float = 4.0
Standard deviation of the blur which is applied to the structure tensors before they are used to determine the inpainting direction. Higher values help gather more directional information when there are only few valid pixels available, but increases CPU usage.
Show Bool = False
Allow the user to see the differents steps of the delogoing. Are displayed the source, the repaired, the repaired post-processed, the mask, the repair masks (edge and global), the color mask, the alpha mask and the inpaint mask.
Rev 1.11 introduce a subfunction, InpaintAssist, that can be used to help you in order to set your own crop values to isolate the logo to remove.
With HD footage, the delogo process is slow due to the resolution (especialy for analysis) and to maximize speed, it is adviced to reduce the size of the cropped clip by setting your own crop values.
- If you don't specify a loc value, this function will display your clip divised in 9 parts (the nine loc preset of InpaintFunc) with the crop values for each one in order to give you an idea about the values to use.
- After that step, you can enter your own loc values and check they are correct. The selected area will be hightlighted. Keep in mind you have to keep a little border around the logo since inpainting use nearby pixels to compute the hidden ones.
loc string = null
Select the part of the picture where is the logo to remove. Same as InpaintFunc loc parameter
alignment string = "top"
Alignment of the text. "Top", "Center" and "Bottom" are allowed
Example
LOADCPLUGIN("AVSINPAINT.DLL") Import("InpaintFunc.avs") avisource("videowithlogo.avi") InpaintFunc(last, mask="logo.bmp", loc="br", AR=4.0/3.0, mode="both", speed=10, ppmode=3, pp=75)
Links
Download InpaintFunc.avs Current version (recommended).
Download AVSInpaint from this post.