View Single Post
Old 29th December 2019, 00:01   #67  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,079
I agree that using InpaintDelogo can be a little bit confusing at first - I found it confusing even with a lot of experience from other delogo plugins...

In this post I will try to remove some of the confusion. To achieve this I will only refer to the "Inpaint" mode which is meant for opaque logos. The two other modes ("Deblend" and "Both") are meant for semi-transparent logos, they try to reconstruct the original pixels behind the semi-transparent logo. This makes these modes much more complex and slower, and I found that the result oftentimes does not justify the effort.

For the "Inpaint" mode only one "base mask" is needed. The additional Alpha and Color masks are not needed at all.

This is the basic work flow:
1. Create a "base mask". This is an image file with the identical size of the source clip where the logo itself is all white and the rest of the image is all black. Save it as a BMP file to your HDD.

2. Determine the coordinates for the "Loc" parameter. The dimensions need to be about 10 pixels larger than the logo, and the format is identical to the AviSynth Crop parameters.

3. Call the "InpaintDelogo" function for the logo removal. Use the parameters for the mask file location and the Loc parameter with the coordinates which you have determined.


The InpaintDelogo plugin includes methods to do the #1 and #2 tasks, but it is in no way required to use these methods. For many users it may be much easier to perform these steps manually without using the plugin functions.

Have a look at manono's script two posts above. He does steps #1 and #2 manually, and his final logo removal call can even be stripped down considerably. His original script can be reduced to:
InpaintDelogo(mask="G:\Jugnu\Logo.bmp", Loc="44,34,-524,-386", Mode="Inpaint")

Especially the "Analyze=1" should not be used here. When the mode is set to "Inpaint" then "Analyze=0" will be forced unconditionally. This is because the base mask is already there, and the "Inpaint" mode does not need additional masks which would need analyzing.

For better speed you can play with the "Turbo" parameter, but this is basically it. If you are familiar with using a photo editor to create the mask then this will be your fastest method.


If your are like me and do not feel comfortable with image editors like PhotoShop then it may be a good idea to use the InpaintDelogo plugin to create the required base mask automatically. The "InpaintDelogo" function needs to be called with the "AutoMask=1" parameter for this. With this parameter the function will ONLY CREATE A MASK, nothing else. To actually remove the logo the function has to be called for a second time without the "AutoMask" parameter.

First you need to determine the "Loc" coordinates and enter them into the "Loc" parameter. Then you need to decide which "Analyze" method you want to use for the mask creation. The best and fastest method for the "Inpaint" mode is "Analyze=4". You need to find a source frame where the logo is surrounded by black. For real world movies such a frame can usually be found at the start of the movie or at the very end. The frame number of such a frame needs to be entered with the "Fr1" parameter.

If you cannot find a source frame where the logo is surrounded by black then you need to use the "Analyze=1" method. With this method 3% of the source will be analyzed for the mask creation. This takes time, especially for HD sources. For longer sources you can use this hack to speed up the mask creation:
Quote:
If you use the "Analyze=1" parameter for the AutoMask creation then 3% of the source clip will be used for analyzing. For a longer movie (duration 90 min or above) this takes a long time. You can use "Trim", but for me I get better results after specifying a lower percentage for analyzing. I edited the InpaintDelogo.avsi file and replaced "every=33" with "every=400", and this is way faster without damaging the mask.
So if you decide to use the AutoMask feature of the plugin your first call to the "InpaintDelogo" function should look similar to this:
Quote:
Loc="22,12,-588,-328"
InpaintDelogo(automask=1, analyze=4, fr1=10329, mask="d:\logomask.bmp", Loc=Loc)
Or like this:
Quote:
Loc="22,12,-588,-328"
InpaintDelogo(automask=1, analyze=1, mask="d:\logomask.bmp", Loc=Loc)
And the second call for the actual logo removal could look similar to this one:
Quote:
Loc="22,12,-588,-328"
InpaintDelogo(mask="d:\logomask.bmp", Loc=Loc, Mode="Inpaint", Turbo=0)

Hint for better speed if you are downscaling your source:

The logo removal will be much faster if you apply it after the resizer (when downscaling). Of course this also means that you need to use a downscaled image for creating the mask.


Cheers
manolito

Last edited by manolito; 29th December 2019 at 01:25.
manolito is offline   Reply With Quote