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. |
|
|
Thread Tools | Search this Thread | Display Modes |
31st August 2019, 21:57 | #1 | Link | |
Banana User
Join Date: Sep 2008
Posts: 989
|
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. ##================================================================================================## 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). 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:
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. # 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 ). 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+! Latest version v3.7: https://github.com/Purfview/InpaintDelogo Last edited by VoodooFX; 11th August 2023 at 16:58. |
|
Tags |
delogo, hardsubs, ocr, remove, watermark |
Thread Tools | Search this Thread |
Display Modes | |
|
|