Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 31st August 2019, 21:57   #1  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 983
InpaintDelogo - advanced logo removal & hardcoded subtitles extraction

Code:
##================================================================================================##
#                                                                                                  #
#             ____                  _       __  ____       __                                      #
#            /  _/___  ____  ____ _(_)___  / /_/ __ \___  / /___  ____  ____                       #
#            / // __ \/ __ \/ __ `/ / __ \/ __/ / / / _ \/ / __ \/ __ `/ __ \                      #
#          _/ // / / / /_/ / /_/ / / / / / /_/ /_/ /  __/ / /_/ / /_/ / /_/ /                      #
#         /___/_/ /_/ .___/\__,_/_/_/ /_/\__/_____/\___/_/\____/\__, /\____/                       #
#                  /_/                                         /____/                              #
#                                                                                                  #
##================================================================================================##


#  InpaintDelogo is an advanced logo and watermark removal function using inpainting and deblending
# with an adjustable fine process to hide artifacts and get best delogo results.
# Can remove opaque, transparent, semi-transparent and some dynamic logos from video.
# Can be used to remove hardcoded subtitles or extract them to images for OCR.

#  Inpainting refers to the application of sophisticated algorithms to reconstruct of lost
# or deteriorated parts of images or videos. 


##================================================================================================##
Someone asked for my delogo script, so here it is: InpaintDelogo() is user friendly script for AvsInpaint plugin (plugin created by Wolfgang Boiger).
Why another script for AvsInpaint!? Because other scripts - rm_logo & InpaintFunc are both semi-broken, slow inpainting, with subpar to unusable results.

AvsInpaint is a great plugin, questionably the best tool atm to remove logos. With InpaintDelogo you can expect better delogo results than from any other tool.
InpaintDelogo can save your time by generating a logo mask automatically, get Color/Alpha masks for deblending in a second, 3x times faster inpainting than with previous user friendly scripts.

Issues with previous scripts for AvsInpaint:
Code:
InpaintFunc Deblend: Results from poor to unusable. As in practice you can't get good masks by analyzing random frames. 
InpaintFunc Both:    Broken. Results same as Inpaint, simply there is no code to do it.
InpaintFunc Inpaint: Works. No controls. Very slow.
InpaintFunc PP:      Subpar. Broken code creates edges and PP=3 can't solve it.

rm_logo Deblend:     Results from poor to unusable. Same as InpaintFunc.
rm_logo Both:        Broken. Does both but can't do PP as there is no masks to do it.
rm_logo Inpaint:     Works. Very slow.
rm_logo PP:          Works (not for both).
Benchmarks (in brackets - fps with all new features On. rm_logo is modded for speed or it wouldn't be able to run test at all, both rm_logo & InpaintFunc runs at ~same speed. ):
Code:
                 InpaintDelogo v1.11      rm_logo v0.6_mod/InpaintFunc v1.15
180x180(pre cut):
Deblend             702 fps (153 fps)         587 Fps
Inpaint              33 fps                    10 fps
Both                 47 fps                    10 fps

1920x1080:
Deblend             121 fps (60 fps)          121 Fps
Inpaint              12 fps                     4 fps

Basic short guide( things you need before doing delogo ):
0) Read help/manual (at the top of the script) about parameters mentioned below.
1) Run this function to get "Loc" values: InpaintLoc(Loc="100,100,-100,-100"). Adjust "Loc" crop parameters around logo (aka "Left,Top,-Right,-Bottom"). Use even(mod2) numbers.
2) Prepare the "mask" manually, or start InpaintDelogo with "Automask=1" and "Analyze=2", automask result can be adjusted with"aMix".

Some basic delogo parameters for non-transparent logo:
Quote:
InpaintDelogo( mask="D:\mask.bmp", Automask=0, aMix=0, Loc="100,100,-100,-100", Mode="Inpaint")

Version history:
Code:
# Version 3.7  : 2023/08/11.  Fixed: Broken "YColorSolidIns" arg [code typo].
#                             Fixed: Bug with "isHD" variable.
#                             Added 'Mask' path check before running 'Automask'.
#                             New params: "UVAlphaFromY", "SubPrefix", "SubPostfix".
#                             Removed "colors_rgb.avsi" dependancy.
#                             Changed "mShow" to red instead of black.
# Version 3.6  : 2023/01/12.  New conditional: Auto max "Interp" for frames where logo is in ~solid background.
#                             "Optimize" is split to "Optimize1" & "Optimize2".
#                             Burnin version number into ebmp ["Ver-", positive analyze only].
# Version 3.5  : 2022/12/27.  Fixed: Dynamic mask inpainting was broken since v3.4.
# Version 3.4  : 2022/11/24.  New feature: "Greyscale" parameter, affects positive "Analyze", "Deblend", "Inpaint"...
#                                          Up to ~60% speed-up when enabled.
#                                          Prevents chroma changes on the greyscale videos by deblend [side effect of "3.1" fix].
#                             FFT3DFilter replaced by Neo_FFT3D, up to ~20% speed-up.
# Version 3.3  : 2022/11/13.  Corrected a code 'typo' in SubsMask2Img(), introduced in v2.10.
# Version 3.2  : 2022/10/22.  New feature: Conditional optimizations with "Optimize", enabled by default.
#                                          Up to ~1000% speed-up for slow "Inpaint" & "Interp" presets.
#                                          Additional auto "Interp" disabling.
#                             New feature: Negative "dPP"/"oPP", adds denoise, enabled by default [20%-50% slow down].
#                             Very slow inpainting preset: Turbo=-2.
#                             Quick masks dump with clean "outs": DumpMasks=2.
#                             Various other tweaks.
#                             FFT3DFilter plugin is required.
# Version 3.1  : 2022/10/11.  Fixed: "Deblend" with positive "Analyze" was unreliable on the colored logos.
# Version 3.00 : 2022/10/07.  Fixed: A frame selection scan result wasn't saved properly when "Automask=1" and "Inpaint" mode,
#                                    now the deblending masks generation is up to twice faster in this scenario.
#                             New feature: Easy use of the ebmp masks on other videos, you can input them directly with "Mask" parameter.
#                                          Ebmp format is changed, the masks from older versions are not compatible.
#                             New feature: Twice faster subtitles extraction with auto intermediate file.
#                                          It's activated by negative "Extract" values.
#                                          Requirements: LSMASH, TWriteAVI, x264vfw.
#                                          New params: "ReExtract", "FourCC".
#                             New feature: Adjustable subs detection window, useful if video has non-middle subs alignment.
#                                          New params: "DetWinPercW", "DetWinPercH", "DetWinHoPos".
#                                          With "Show=12" you can see the subs detection window and correlation coefficient [CorrTh/Corr].
#                             New: "Turbo=-1", it activates an inpainting preset more suitable for UHD - HD resolutions.
#                             New: "IntSpd=4", similar as above.
#                             Basemask change: Background should be less than full white, logo - full white.
#                             Swapped "Turbo" 1 & 3.
#                             Removed "rSize" parameter.
#                             Reworked "Show=2", alternative to "Show=1" for positive Analyze.
#                             New feature: Various parameters to manipulate the deblending masks from positive analyze [for the experts only]:
#                                          "YAlphaTweak", "UAlphaTweak", "VAlphaTweak",
#                                          "YAlphaSolidIns", "UAlphaSolidIns", "VAlphaSolidIns",
#                                          "YAlphaSolidOuts", "UAlphaSolidOuts", "VAlphaSolidOuts",
#                                          "YColorSolid", "UColorSolid", "VColorSolid",
#                                          "YColorSolidOuts", "UColorSolidOuts", "VColorSolidOuts",
#                                          "YColorSolidIns", "UColorSolidIns", "VColorSolidIns",
#                                          "YOffsetIns", "YOffsetOuts", "UVOffsetIns", "UVOffsetOuts", "ShiftMasksVe", "ShiftMasksHo",
#                                          "YAlphaExternal", "WholeDeblend", "TriggerDynamic", "DumpMasks".
#                             Various other tweaks.
#                             Avisynth+ v3.7.2 or later is required.
#
#---------------------------------------------------------------------------------------------------
#
# Version 2.17 : 2022/06/13.  Option for ranged luma mask with DynMask6.
# Version 2.16 : 2022/06/12.  Higher quality and faster "DynColor" mask when used with "DynLocUp".
#                             Faster "DynColor" alternative if parameter is string, and it supports multiple colors.
#                             TColorMask plugin is required.
# Version 2.15 : 2022/05/29.  Spaces are allowed in "Loc".
# Version 2.14 : 2022/05/22.  SubsMask2Img: New option to extract raw non-binarized images.
#                             Enabled by "Extract=2" in InpaintDelogo() or "Raw" in SubsMask2Img().
#                             New: "Raw", "RawAvr".
# Version 2.13 : 2022/05/21.  SubsMask2Img: Added average luma check to catch non-sub images.
#                             New: "SubMinLuma", "SubSusLuma".
#                             Renamed: "SubSuspect" to "SubSusDur".
# Version 2.12 : 2022/05/14.  Added generation of the dynamic mask by gradient magnitude map (aka "DynMask=7"/"DynTEdge").
#                             New: "DynTEdge", "DynTEdgeThY", "DynTEdgeInf", "DynTuneInf", Show=10, Show=11.
#                             vsTEdgeMask plugin is required.
# Version 2.11 : 2022/05/13.  Rewrite: "DynColor" ~30%-300% faster. New: "DynMask=6/"DynTune". Removed: "Show=10".
# Version 2.10 : 2022/05/02.  Added auto generation of the dynamic mask by color (aka "DynMask=5"/"DynColor").
#                             New: "DynColor", "DynColorTol", "DynColorInf", "Show=10".
#                             This dynamic mask by color can pre-patch video for other "DynMask" methods.
# Version 2.09 : 2022/04/08.  Positive "DynMaskUp" is supported with "DynMask=3".
#                             Improved "KillNoise".
# Version 2.08 : 2022/04/07.  Improved negative "KillBlobs".
# Version 2.07 : 2022/04/06.  Changed defaults of the sub-parameters for "DynMask=3" (no need to set the bunch of parameters anymore).
# Version 2.06 : 2022/04/06.  Fixed: "Show=3" was broken since v1.36.
# Version 2.05 : 2022/04/04.  Masktools2 v2.2.30 or later is required.
#                             Tweaked: "DynMask=4" and positive "DynMaskUp", should be a bit faster and no more glitches.
#                             New: "DynLocUp" [Experimental WIP parameter for tests].
# Version 2.04 : 2022/02/11.  Improved deblend quality with positive "Analyze" when frames quantity to analyze is low.
#                             Tweaked: A/C masks filename from negative "Analyze" ('Deep' goes to the end of the filename).
#                             Tweaked: "iTune", "EdgeWide".
# Version 2.03 : 2021/12/13.  Tweaked "DynTune".
# Version 2.02 : 2021/12/10.  Fixed: "Analyze=1" bug.
#                             +11% deblend speed-up.
#                             Tweaked "aMix". "Analyze=2" is default. Adaptive "AnalyzeTh" default [16 or 30].
#                             Don't search frames for analyse if 'txt' file is present and ReAnalyze=0.
# Version 2.01 : 2021/12/05.  "Analyze" 3 option.
# Version 2.00 : 2021/12/04.  AviSynth+ v3.7.1 or later & FrameSel plugin is required.
#                             New: Old Deblend delogo is superceded by the new superior one.
#                             New: Smart frames selection for analyze using "AnalyzeTh" & "NoBorderAt" parameters.
#                             New: "Automask" adapted to the new stuff and it doesn't reanalyze when "aMix" is adjusted.
#                             New: "Show" 7/8/9.
#                             Note: Old Deblend is saved as negative "Analyze",
#                                   -3/-4 should be same as old, -1/-2 were augmented by the smart frames selection.
#
Requirements:
Code:
#   Core requirements:
#  AviSynth+ v3.7.2 or later ( https://github.com/AviSynth/AviSynthPlus ).
#  AvsInpaint v1.3 or later  ( https://github.com/pinterf/AvsInpaint ).

#   Other requirements:
#  MaskTools2    ( https://github.com/pinterf/masktools ).
#  RgTools       ( https://github.com/pinterf/RgTools ).
#  GRunT         ( https://github.com/pinterf/GRunT ).
#  RequestLinear ( https://github.com/pinterf/TIVTC ).
#  ClipBlend     ( http://avisynth.nl/index.php/ClipBlend ).
#  RT_Stats      ( http://avisynth.nl/index.php/RT_Stats ).
#  FrameSel      ( http://avisynth.nl/index.php/FrameSel ).
#  GrainFactory3 ( http://avisynth.nl/index.php/GrainFactory3 ).
#  vsTEdgeMask   ( https://github.com/Asd-g/AviSynth-vsTEdgeMask ).
#  TColorMask    ( https://github.com/Asd-g/AviSynth-tcolormask ).


#   Requirements for fast subtitles extraction:
#  LSMASH        ( http://avisynth.nl/index.php/LSMASHSource ).
#  TWriteAVI     ( https://github.com/Asd-g/AviSynth-TWriteAVI ).
#  x264vfw       ( https://sourceforge.net/projects/mpxplay/files/x264vfw ).
Notes for AviSynth v2.6 users:
Code:
#  Last compatible version is 1.48
#  Requirement: GScript ( http://avisynth.nl/index.php/GScript ).
#  "InpaintDelogo.avsi" needs to be renamed to "InpaintDelogo.avs",
#  and loaded manually in AviSynth script with: GImport("C:\AviSynth 2.5\plugins\InpaintDelogo.avs"),
#  or use AvsInit for autoloading ( https://forum.doom9.org/showthread.php?t=176749 ).
#  Subs extraction is up to 600% slower than with AviSynth+!
Download link:
Latest version v3.7: https://github.com/Purfview/InpaintDelogo

Last edited by VoodooFX; 11th August 2023 at 16:58.
VoodooFX is offline   Reply With Quote
Old 1st September 2019, 13:19   #2  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 983
Comparisons with rm_logo and InpaintFunc:

Easy logo to deblend:
Original (zoomed in few times):


Deblended: (1-InpaintDelogo, 2-InpaintFunc, 3-rm-delogo)




Inpainted: (1-InpaintDelogo, 2-InpaintFunc, 3-rm-delogo)





Both logo:
1-Original, 2-InpaintDelogo, 3-rm_logo:





Hard logo to deblend:
Deblended:
1-Original, 2-InpaintDelogo, 3-rm_logo/InpaintFunc(they look similar):



Last edited by VoodooFX; 2nd September 2019 at 00:12.
VoodooFX is offline   Reply With Quote
Old 1st September 2019, 15:43   #3  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,685
Interesting work. Thanks for doing that.

I've spent a lot of time using Delogo inside of Virtualdub, and even created a YouTube tutorial for it:

Tutorial on Delogo

I did that tutorial in response to a long thread about how to eliminate a sensor defect from a camera. This is a considerably easier job than logo/bug removal and one that Delogo was able to do with near-perfection.

I have not used any AVISynth logo removal tools, but I have used all the features of Delogo, including training it for removal of semi-transparent bugs, and specifying frame ranges for TV shows where the logo comes and goes, or moves around.

For me, the biggest need in advancing the state of the art is the blending algorithm. When the background is uniform and dark, such as the edges of a stage performance where the talent is brightly lit, but the wings of the stage are dark, the removal can be perfect. However, if the video was shot outdoors in the daylight, and the camera pans, you can get some pretty annoying results. For some videos, I just give up and leave it as is because the artifacts from the removal are worse than looking at the bug.

The problem is that the inpainting is nothing more than a blur function.

I know nothing about the technology of the existing AVISynth DLL you are using because I haven't used it, but the example above of the "Hawe Knho" shows the Inpaint blending looking pretty similar to Delogo. This is not meant as a criticism, but instead as a way to lead to my main question:

Is there a reason why I would want to use this instead of continuing to use Delogo? What are its advantages?

I am always looking for something that works either better or faster. Delogo is plenty fast, and it is also easy to use because it lets me tune the mask parameter interactively using the VD "preview" display. I want something that can make the logo disappear, with almost no residual evidence that it was there.

Is this possible?

I think it might be. If I were going to do development in this area, I'd look at how RemoveDirt does its painting. I just did a restoration of one of the most spectacularly degraded movies I've ever dealt with, a one-of-a-kind 16mm print of a 1963 AFL football game. It had been badly stored, and the emulsion stuck to the backing on the adjacent film in the reel, so once every revolution of the big film reel, there were huge (1/3 of the frame) chunks of mottled image. Where the emulsion had been completely removed, and there was no image, I had to reconstruct by hand from adjacent frames. However, when it was just a big stain, I used a heavily modified version of RemoveDirtMC to fix it, and when it worked, the reconstructed frame was near-perfect.

I haven't posted the results of this work, because it is copyrighted, but I did post a very short before/after of some Polavision restoration. This instant movie film from Polaroid had much of the same problem, because the film was developed in the cassette and then stayed there for 40+ years and, because of the residual chemicals, stuck together and, when unwound after all those years, the emulsion would come off, resulting in a black spot on one frame, and a matching blank spot a few frames later. Here is a few "before/after" frames from that work. You'll need to freeze at a random frame to see the results of what RemoveDirt was able to do. I did no manual work at all; it was all done by RemoveDirt.

Before After Polavision

Whatever inpainting algorithms RemoveDirt uses might provide some ideas for how to do better logo removal.

Last edited by johnmeyer; 1st September 2019 at 19:13. Reason: duplicated words; typos
johnmeyer is offline   Reply With Quote
Old 1st September 2019, 18:00   #4  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
I think that you will find that RemoveDirt uses temporal info from adjacent frames to fix spots/dirt, logo is entirely different being also on adjacent frames.

Looks nice VDX.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 1st September 2019 at 18:02.
StainlessS is offline   Reply With Quote
Old 1st September 2019, 19:19   #5  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,685
Quote:
Originally Posted by StainlessS View Post
I think that you will find that RemoveDirt uses temporal info from adjacent frames to fix spots/dirt, logo is entirely different being also on adjacent frames.
Thanks, StainlessS. I wondered to myself as I was writing that last post whether that might be the case and, if that is the secret, you are right: it would be mostly useless for logo removal.

Having said that, in theory (maybe not in practice) you could use motion estimation from adjacent frames to predict what should be under the logo in the current frame and come up with a better replacement. It might work for my example of what happens when the camera pans. However, in practice, it probably wouldn't be useful, and would be of no help at all unless there was motion going through/under the logo.

P.S. The other area for improvement would be semi-transparent logos. In that case you DO have information on what is behind the logo. My experience, even with Delogo, is that if the logo is really faint, so you can see lots of detail behind it, you can get remarkably good, artifact-free removal.

Last edited by johnmeyer; 1st September 2019 at 19:21. Reason: added P.S.
johnmeyer is offline   Reply With Quote
Old 1st September 2019, 23:55   #6  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 983
Quote:
Originally Posted by johnmeyer View Post
Is there a reason why I would want to use this instead of continuing to use Delogo? What are its advantages?
I am always looking for something that works either better or faster.
Delogo is pretty outdated, there were tools that perform way better, and InpaintDelogo does better than those other ones. Let me know if you find tool/script doing better job than InpaintDelogo.

Quote:
Originally Posted by johnmeyer View Post
The problem is that the inpainting is nothing more than a blur function.
You are mixing up something, it's not a "blur" function or a temporal thing like RemoveDirt.
Here is good starting point to read about it - Inpainting

Quote:
Originally Posted by johnmeyer View Post
Having said that, in theory (maybe not in practice) you could use motion estimation from adjacent frames to predict what should be under the logo in the current frame...
It sounds good only in theory, in practice it would be very complicated task to implement something to fit various cases of motion, actually it was implemented and was called "msu" something.

Last edited by VoodooFX; 1st September 2019 at 23:59.
VoodooFX is offline   Reply With Quote
Old 2nd September 2019, 02:13   #7  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
John, the S_Exlogo() thing I did [ based on DeKafka() ], is purely blurring the logo [using data from spatially outside of the logo], but not the AvsInpaint.dll based scripts [as is this one],
however, S_Exlogo() is easy to set up and goes like the clappers, and so long as you are easily pleased, is quite good [a man on a galloping horse might not notice any remaining logo].

MC based delogo [as with mvtools] is doomed to failure, methinks.
[neural network stuff might at some future date be much better than today, but would likely be a somewhat unstable [although maybe less so if 3D neural networks],
ExInpaint [another dll] uses something along those lines [purely spatial, I think] and is a little temporally unstable but good for single frames (see the demo image in docs)]

EDIT: Think ExInpaint is using the "Exemplar-based image inpainting" in above link, seem to remember the word 'Exemplar' being used in the docs [and source for the plugin name].

from above VDX link
Quote:
Exemplar-based image inpainting attempts to automate the clone tool process. It fills "holes" in the image by searching for similar patches in a nearby source
region of the image, and copying the pixels from the most similar patch into the hole. By performing the fill at the patch level as opposed to the pixel level, the
algorithm reduces blurring artifacts caused by prior techniques.
EDIT:
Quote:
it was implemented and was called "msu" something.
MSU Subtitle and Logo Remover:- http://forum.doom9.org/showthread.php?t=95955
Quote:
Originally Posted by krieger2005 View Post
Use this
Code:
global VDub = "C:\Programme\AviSynth 2.5\VDub\plugins"

LoadVirtualdubPlugin(VDub+"\MSU_DeLogo.vdf",       "_MSUDeLogo")
The open VirtualDub. Add to the filters the MSUDelogo-Filter. Tweak it, so it remove your Logo fine. Go to
FILE ->
SAVE PROCESSING SETTINGS...

and save them to a file. Open The file in a texteditor and look for line like this one:
Code:
VirtualDub.video.filters.Add("MSU Subtitle&Logo Remover");
VirtualDub.video.filters.instance[0].Config(0, 0);
Now copy allparameters in Config and use the to Call the Filter in Avisynth this way:
Code:
ConvertToRGB32._MSUDeLogo(0, 0)
I tried the filter but does not get good results with it. It is also very slow. Have you better results with this filter?
Many MSU Vdub filters do NOT export some of the settings, [described in code above as Config] and so cannot be used properley in Avisynth, [settings only exist when set up within VDub, and
cannot be saved and reused at a later date, even within VDub], dont know if MSU_Delogo is one of those which do not save ALL settings.

EDIT: Dont know/recall what method AvsInpaint dll is using [the one used by this script].
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 2nd September 2019 at 03:14.
StainlessS is offline   Reply With Quote
Old 3rd September 2019, 17:34   #8  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 983
Quote:
Originally Posted by StainlessS View Post
the S_Exlogo() thing I did [ based on DeKafka() ], is purely blurring the logo...
I was thinking to add Very Fast mode where s_Exlogo could do post-processing, could be useful for big logos where there is no point to use slow inpainting. But forgot about it as I didn't wrote that to todo list .
I strikethrough that list today, only one line left - "moving logo", it should be doable in theory but could be over my head, maybe I'll replace it with "very fast mode".

Quote:
Originally Posted by StainlessS View Post
MSU Subtitle and Logo Remover...
I looked at MSU site, it is called MSU Logo Remover 2.xx, MC implementation is broken, no open source...

Quote:
Originally Posted by StainlessS View Post
Dont know/recall what method AvsInpaint dll is using [the one used by this script].
Ideas are implemented from these papers:

Folkmar Bornemann, Tom März: Fast Image Inpainting Based on Coherence Transport.
Joachim Weickert: Coherence-Enhancing Shock Filters.
Alexandru Telea: An Image Inpainting Technique Based on the Fast Marching Method.
James Sethian: Fast Marching Methods.
VoodooFX is offline   Reply With Quote
Old 3rd September 2019, 18:07   #9  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
I should go back to my current mod for s_Exlogo(), It stalled a bit when I bumped into a bug in r2772, fixed now in bugfix avs+ test build (r2915), but been a bit busy of late.

I've seen some delogo stuff that was somewhat like s_ExLogo(), but seems to take most data from mostly one side (inner most long side), but partially mixed with other sides,
it in some cases was way better than s_ExLogo, I could not figure out how it worked. [sending you a link, not suitable clip for general viewing].
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 4th September 2019, 22:56   #10  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 983
Quote:
Originally Posted by StainlessS View Post
I've seen some delogo stuff that was somewhat like s_ExLogo(), but seems to take most data from mostly one side (inner most long side), but partially mixed with other sides,
it in some cases was way better than s_ExLogo, I could not figure out how it worked. [sending you a link, not suitable clip for general viewing].
That looks pretty simple, take 2 pixels at the top resize them to the size of the hole. I don't see any interpolation from other sides.
VoodooFX is offline   Reply With Quote
Old 4th September 2019, 23:47   #11  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Oh, simple as that, I guess I was seeing stuff that wern't there.
Thanks awfully

EDIT: sometimes less is more.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 5th September 2019, 00:29   #12  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 983
I just tested it to be sure. Sometimes in original I see some discrepancies, but I don't have any logical explanation, maybe some compression/resize artifacts maybe broken delogo code. Like this one:

2x Size
1) original (SD), arrows to some artifacts, they appear and disappear without any apparent reason, but mostly it looks same as "3".
2) s_exLogo, delogo of "original", sides and bottom is blocked from interpolation, 4px left at top, "Amount=256".
3) 2px from the top resized.


Last edited by VoodooFX; 5th September 2019 at 00:42.
VoodooFX is offline   Reply With Quote
Old 5th September 2019, 01:07   #13  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
You guys made me curious so I did some tests comparing s_ExLogo to the old LogoAway plugin by Krzysztof Wojdon. I did not test InpaintDelogo for several reasons (too complicated, I hate plugins with dozens of params, have to select frames and create masks manually, requires AVS+, no option for logos over black borders). Here are the results:
https://www.sendspace.com/file/8nvhi6

For s_ExLogo I used the default parameters, for LogoAway the UGLARM method was used with the blur slider set to max (all the way to the right).



LogoAway also has a much faster XYBlur mode which creates results very similar to s_ExLogo. But UGLARM does look so much better in almost every situation that I have been using this mode exclusively over the last couple of years.

Now I would like to challenge VooDooFX if his script can create a better looking result. My requirements are pretty simple:

1. Just 1 mode for opaque logos. I do not care for semi-transparent logos.
2. No manual mask creation. All I want to provide to the plugin are the logo coordinates.
3. I do not mind if the logo area gets blurred strongly. All I want is that my attention is not taken away from the movie itself, so the delogo'd area should be as unobtrusive as possible, mainly I hate when this area shows strong flickering.
4. Easy to use and reasonably fast.

Tough challenge, I know. For now I will stick with LogoAway, s_ExLogo is no serious contender IMO.


Cheers
manolito

Last edited by manolito; 5th September 2019 at 14:19.
manolito is offline   Reply With Quote
Old 5th September 2019, 14:22   #14  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Mani, for s_ExLogo, sPow=1.0 (linear) should be about same as your XYBlur mode [I think].
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 5th September 2019, 20:26   #15  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 983
Quote:
Originally Posted by manolito View Post
Now I would like to challenge VooDooFX...
Do you want some fast preset? I'll look what can be done. Can you PM link to that unresized logo?
VoodooFX is offline   Reply With Quote
Old 5th September 2019, 20:46   #16  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
Quote:
Originally Posted by VoodooFX View Post
Do you want some fast preset? I'll look what can be done. Can you PM link to that unresized logo?
Of course faster is better, if the result does not suffer too much.

For the "unresized logo" I don't know what you mean. The original source is a German DVB-T2 capture which means 1080p @ 50fps. Applying logo removal at this resolution is forbiddingly slow, and since my target format is SD (704 x 396) I perform my logo removal after resizing which is way faster.

So you need to use the "Source.mkv" file in my upload as your source for the logo removal.
manolito is offline   Reply With Quote
Old 5th September 2019, 21:07   #17  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 983
It's just for personal tests, logo is "both" and I don't have much logos to test that mode on. If you have source then I would be happy with just the logo cut with surrounding of ~80 px (no need black bar), ~5-10 mins, ~Lagarith YV12, should include frame where logo is in a black background.
VoodooFX is offline   Reply With Quote
Old 6th September 2019, 23:41   #18  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 983
New version 1.12 attached at original post.
Various tweaks for speed and quality. Changed "Inflate", "Deep" now is not re-analyzed on every load, selectable number of passes for "Deep".
New "Turbo" presets parameter for fast and blurry logo removal, few other parameters.

v1.12 Deblend, 2x zoom:


v1.11 Deblend, 2x zoom:





Quote:
Originally Posted by manolito View Post
You guys made me curious so I did some tests comparing s_ExLogo to the old LogoAway plugin by Krzysztof Wojdon. I did not test InpaintDelogo for several reasons (too complicated, I hate plugins with dozens of params, have to select frames and create masks manually, requires AVS+, no option for logos over black borders). Here are the results:
https://www.sendspace.com/file/8nvhi6

For s_ExLogo I used the default parameters, for LogoAway the UGLARM method was used with the blur slider set to max (all the way to the right).

[url=https://i.postimg.cc/9fFcJcFF/LogoAway.png[/url]

LogoAway also has a much faster XYBlur mode which creates results very similar to s_ExLogo. But UGLARM does look so much better in almost every situation that I have been using this mode exclusively over the last couple of years.

Now I would like to challenge VooDooFX if his script can create a better looking result. My requirements are pretty simple:

1. Just 1 mode for opaque logos. I do not care for semi-transparent logos.
2. No manual mask creation. All I want to provide to the plugin are the logo coordinates.
3. I do not mind if the logo area gets blurred strongly. All I want is that my attention is not taken away from the movie itself, so the delogo'd area should be as unobtrusive as possible, mainly I hate when this area shows strong flickering.
4. Easy to use and reasonably fast.

Tough challenge, I know. For now I will stick with LogoAway, s_ExLogo is no serious contender IMO.


Cheers
manolito
a) "too complicated" - It's relatively simple.
b) "dozens of params" - It's not mandatory to use them all, you can use only 2 parameters if you want. LogoAway has dozens parameters too...
c) "have to select frames and create masks manually" - Not mandatory. Quote from op - "can save your time by generating a logo mask automatically".
d) "requires AVS+" - Not mandatory.
e) "no option for logos over black borders" - Does it prevent you to delogo? You said it has too many params already.

1) There is already such mode.
2) Mask generation is automatic already.
3) You can do that already. Why you don't want to use deblend? It would remove your logo almost without a trace.
4) It is easy already. Added new fast "Turbo" presets parameter in v1.12.



Whole comparison video: https://we.tl/t-kcAI66C8GQ

Last edited by VoodooFX; 7th September 2019 at 00:49.
VoodooFX is offline   Reply With Quote
Old 7th September 2019, 02:08   #19  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
Thanks for these comparisons...

Especially the "Turbo=1" mode impresses me. In most cases it looks just as good or even better than the slower "Turbo=3" mode. This mode is something I would really be interested in...

The speed comparison with LogoAway is a little unfair. I use an "Active Area" approach where VDub just processes the actual logo. It was inspired by Didées DeLogo script, but a little bit expanded and added exception handling with the help of gavino. Makes it much faster.

Your new version is not approved yet by a mod, please upload it somewhere else.

For the AVS+ requirement this is what you say in the first post of this thread:
Quote:
Requirement:
Avisynth+ r2915 or newer ( https://github.com/pinterf/AviSynthPlus )
Please tell me what I have to change under classic AVS 2.60.

And then I would like to know how you can preview your results. For LogoAway it is easy: In VDub you can visually see the different results when you change any of the parameters. In AviSynth would I have to use AVSP(mod) to interactively see the results when changing parameters?

And for treating logos which are partly over letterboxed (or pillarboxed) areas do you have any special treatment for such logos? LogoAway and s_ExLogo do have provisions for such logos.
manolito is offline   Reply With Quote
Old 7th September 2019, 03:13   #20  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
Quote:
Originally Posted by manolito View Post
Your new version is not approved yet by a mod...
I'll do it immediately.

Quote:
Please tell me what I have to change under classic AVS 2.60.
Me too. I have no interest in AviSynth+ yet and do a lot of logo removal using InPaintFunc.

Last edited by manono; 7th September 2019 at 03:16.
manono is offline   Reply With Quote
Reply

Tags
delogo, hardsubs, ocr, remove, watermark

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:36.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.