InpaintFunc

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m
(Requirements)
Line 16: Line 16:
 
== Requirements ==
 
== Requirements ==
 
* AviSynth 2.5.8 or [http://sourceforge.net/projects/avisynth2/ greater]
 
* AviSynth 2.5.8 or [http://sourceforge.net/projects/avisynth2/ greater]
* AviSynth+ or AviSynth 2.6.x for v1.1 plugin
+
* AviSynth+ or AviSynth 2.6.x for InpaintFunc_v1.14/v1.15 or AVSInpaint v1.1 plugin  
 
* Supported color formats: [[RGB32]], [[RGB24]], [[YUY2]], [[YV12]]
 
* Supported color formats: [[RGB32]], [[RGB24]], [[YUY2]], [[YV12]]
  
Line 22: Line 22:
 
*[http://forum.doom9.org/showthread.php?t=133682 AVSInpaint] | [http://forum.doom9.org/attachment.php?attachmentid=8134&d=1203776927  AVSInpaint-2008.02.23.zip ]
 
*[http://forum.doom9.org/showthread.php?t=133682 AVSInpaint] | [http://forum.doom9.org/attachment.php?attachmentid=8134&d=1203776927  AVSInpaint-2008.02.23.zip ]
 
*[http://forum.doom9.org/showthread.php?t=133682 AVSInpaint] | [https://github.com/pinterf/AvsInpaint/releases  AVSInpaint 20190624 v1.1]
 
*[http://forum.doom9.org/showthread.php?t=133682 AVSInpaint] | [https://github.com/pinterf/AvsInpaint/releases  AVSInpaint 20190624 v1.1]
 +
*[[MaskTools2]] | [http://github.com/pinterf/masktools/releases GitHub] for InpaintFunc_v1.14/v1.15
  
 
AVSInpaint is an AviSynth C plugin, don't forget to add '''[[LoadPlugin#LoadCPlugin|loadCplugin("xxx\AVSInpaint.dll")]]''' in your script before calling this function !!!
 
AVSInpaint is an AviSynth C plugin, don't forget to add '''[[LoadPlugin#LoadCPlugin|loadCplugin("xxx\AVSInpaint.dll")]]''' in your script before calling this function !!!

Revision as of 15:25, 25 June 2019

Abstract
Author Reuf Toc, StainlessS
Version 1.13
Download InpaintFunc.avs

InpaintFunc_v1.14.avs InpaintFunc_v1.15.avs

Category Logo removal
License
Discussion

Contents

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.


Requirements

  • AviSynth 2.5.8 or greater
  • AviSynth+ or AviSynth 2.6.x for InpaintFunc_v1.14/v1.15 or AVSInpaint v1.1 plugin
  • Supported color formats: RGB32, RGB24, YUY2, YV12

Required Plugins

AVSInpaint is an AviSynth C plugin, don't forget to add loadCplugin("xxx\AVSInpaint.dll") in your script before calling this function !!! This may not be needed with plugin version v1.1

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".


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  loc = 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.


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 .


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.


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  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..


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.


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.


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  Sharpness = 75.0
Higher values can prevent blurring caused by high Radius values.


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  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.


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.



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.
string  loc = null
Select the part of the picture where is the logo to remove. Same as InpaintFunc loc parameter
string  alignment = "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)


External Links

  • Doom9 Forum - InpaintFunc.avs - Different result depending on AviSynth version
  • Doom9 Forum - Help with InpaintFunc




Back to External Filters

Personal tools