InpaintFunc
(→Requirements) |
(requirement updates) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
{{Filter3 | {{Filter3 | ||
|Reuf Toc, StainlessS | |Reuf Toc, StainlessS | ||
− | |1. | + | |1.15 |
− | | | + | |[https://pastebin.com/raw/ZSD7P9ZM InpaintFunc_v1.15.avs] |
− | + | ||
− | [https://pastebin.com/ | + | |
|Logo removal | |Logo removal | ||
| | | | ||
Line 15: | Line 13: | ||
== Requirements == | == Requirements == | ||
− | * AviSynth | + | * [x86]: [[AviSynth+]] or [http://sourceforge.net/projects/avisynth2/ AviSynth 2.6] |
− | * AviSynth+ | + | * [x64]: [[AviSynth+]] |
* Supported color formats: [[RGB32]], [[RGB24]], [[YUY2]], [[YV12]] | * Supported color formats: [[RGB32]], [[RGB24]], [[YUY2]], [[YV12]] | ||
− | + | ===Required Plugins=== | |
− | + | Latest versions of the following filters are recommended unless stated otherwise.<br> | |
− | *[ | + | *[[AvsInpaint]] |
− | *[[MaskTools2]] | + | *[[MaskTools2]] |
− | + | ||
− | + | ||
− | + | ||
+ | AvsInpaint is an AviSynth C plugin. If you're using 'classic' AviSynth you'll have to add '''[[LoadPlugin#LoadCPlugin|loadCplugin("xxx\AVSInpaint.dll")]]''' in your script before calling this function. AviSynth+ can auto-load C-plugins so the LoadCPlugin() statement is not necessary in this case. | ||
+ | <br> | ||
+ | <br> | ||
== [[Script variables|Syntax and Parameters]] == | == [[Script variables|Syntax and Parameters]] == | ||
:{{Template:FuncDef|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")}} | :{{Template:FuncDef|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")}} | ||
Line 144: | Line 142: | ||
*[http://forum.doom9.org/showthread.php?t=172208 Doom9 Forum] - InpaintFunc.avs - Different result depending on AviSynth version | *[http://forum.doom9.org/showthread.php?t=172208 Doom9 Forum] - InpaintFunc.avs - Different result depending on AviSynth version | ||
*[http://forum.doom9.org/showthread.php?t=162124 Doom9 Forum] - Help with InpaintFunc | *[http://forum.doom9.org/showthread.php?t=162124 Doom9 Forum] - Help with InpaintFunc | ||
+ | *[[Media:InpaintFunc.avs|InpaintFunc.avs v1.13]] | ||
+ | *[https://pastebin.com/raw/X6v36CQ8 InpaintFunc_v1.14.avs] | ||
<br> | <br> | ||
<br> | <br> | ||
----------------------------------------------- | ----------------------------------------------- | ||
'''Back to [[External_filters#Logo_Removal|External Filters]] ←''' | '''Back to [[External_filters#Logo_Removal|External Filters]] ←''' |
Latest revision as of 14:59, 7 May 2020
Abstract | |
---|---|
Author | Reuf Toc, StainlessS |
Version | 1.15 |
Download | InpaintFunc_v1.15.avs |
Category | Logo removal |
License | |
Discussion |
Contents |
[edit] Description
Uses AVSInpaint to remove a logo, such as that of a TV station, from a specified clip. 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.
[edit] Requirements
[edit] Required Plugins
Latest versions of the following filters are recommended unless stated otherwise.
AvsInpaint is an AviSynth C plugin. If you're using 'classic' AviSynth you'll have to add loadCplugin("xxx\AVSInpaint.dll") in your script before calling this function. AviSynth+ can auto-load C-plugins so the LoadCPlugin() statement is not necessary in this case.
[edit] Syntax and Parameters
- 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")
- clip clp = last
- The clip to be "delogo-ed".
- clip clp = last
- string mask = 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"
- string mask = null
- string loc = null
- Select the region of the picture where the logo to remove is. See the table :
- string loc = null
______________ ______________ | 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.
- float AR = 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 .
- float AR = 1.0
- string mode = "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.
- Deblend : If the logo is transparent, use this mode.
- 3 Choices (default both) :
- string mode = "both"
- int speed = 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).
- int speed = 5
- int PPmode = 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..
- If you want to apply post-processing, 3 modes are available. Default is 0 (disabled)
- int PPmode = 0
- int PP = 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.
- int PP = 50
- bool Reset = 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.
- bool Reset = False
- Float Radius = 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.
- Float Radius = 8.0
- Float Sharpness = 75.0
- Higher values can prevent blurring caused by high Radius values.
- Float Sharpness = 75.0
- Float PreBlur = 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.
- Float PreBlur = 8.0
- Float PostBlur = 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.
- Float PostBlur = 4.0
- Bool Show = 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.
- Bool Show = False
[edit] InpaintAssist
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 divided 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 highlighted. Keep in mind you have to keep a little border around the logo since inpainting use nearby pixels to compute the hidden ones.
- InpaintAssist(clip clp, string "loc", string "alignment")
- clip =
- Input clip.
- clip =
- string loc = null
- Select the part of the picture where is the logo to remove. Same as InpaintFunc loc parameter
- string loc = null
- string alignment = "top"
- Alignment of the text. "Top", "Center" and "Bottom" are allowed
- string alignment = "top"
[edit] 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)
[edit] External Links
- Doom9 Forum - InpaintFunc.avs - Different result depending on AviSynth version
- Doom9 Forum - Help with InpaintFunc
- InpaintFunc.avs v1.13
- InpaintFunc_v1.14.avs
Back to External Filters ←