Rm logo
Abstract | |
---|---|
Author | Spuds |
Version | 0.5 |
Download | rm_logo.avs |
Category | Logo removal |
License | |
Discussion | Doom9 Thread |
Contents |
Description
A logo removal filter using Inpaint technology, plus additional post processing for a more complete removal.
Requirements
Required Plugins
Latest versions of the following filters are recommended unless stated otherwise.
- AvsInpaint
- ExInpaint
- FFT3DFilter
- MedianBlur or MedianBlur2
RemoveGrain - part of the RemoveGrain v1.0b package.- RgTools - recommended drop-in replacement for RemoveGrain!
- TTempSmooth
How To
1) Get a clip with a logo that you want removed.
Prepare the clip for the analysis pass, its very important the logo be present in every frame that you analyze. Check to see that the logo is present from the beginning to the end, often it appears first after a few seconds or even minutes after the movie/series has started. Sometimes the logo disappears due to commercial cuts. You have to trim out the sections with no logo to get optimal results for the analysis pass. You can also exclude the credits to save time, because they won't improve the analysis pass. A black background is not very useful to get any alpha information.
2) Save a frame from the above clip and edit it in your favorite graphics program, paint the logo pure white and everything else black. Save it as a logo.bmp (any name you want). To make it easy for yourself you should choose a frame from the credits, or where the logo has a dark background. That helps with the painting if you're not so experienced with image processing.
3) Make a avs script such as:
rm_logo(last, logomask="logo.bmp", loc="br", par=4.0/3.0, mode="both", percent=20, pp=1)
4) After the analysis pass is finished you can remove the trim command(s) and optimize your script with deblocking, denoising, resizing, sharpening or whatever you want to apply, put the filters after the rm_logo call, since this is now your source.
NOTE: The first time the script runs expect it to take a little time, it has to compute the color and alpha masks so it will appear to lock up on you while its doing this. Depending on the size of your clip and the percentage of analysis you set, it can take some time. Up to 2 hours or more for 1080p footage on a C2D!
Syntax and Parameters
- rm_logo( clip clp, string "logomask", string "loc",float "par", string "mode",int "percent",int "deblendfalloff", int "AlphaToRepair", int "RepairRadius", float "InpaintRadius", float "InpaintSharpness", float "InpaintPreBlur", float "InpaintPostBlur", string "cutsize", bool "lmask", int "pp", int "cutwidth", int "cutheight")
- clip clp = last
- The clip to be "delogo-ed".
- clip clp = last
- string logomask = null
- The name of the black and white bmp you created.
- string logomask = null
- string loc = null
- TR, TL, BR, BL this is the location of the logo on the video, top right, top left, bottom right, bottom left. There is also a tweak you can supply here called cutsize set it to small medium or large. It refines the size of the corner cut somewhat. If you have too much video and not enough logo in a cut you can get less optimal results, you want the logo to fill the cut (within reason).
- string loc = null
- string cutsize = "small"
- How big of a cut to make, small, medium, large.
- string cutsize = "small"
- int cutwidth = 0
- How wide is the logo? 0 will use a the default size as defined by "cutsize" (small, medium, large). This is generally sufficient for most logo types. Set it to -1 for a full width cut or to a specific number (in pixels) if you find part of the logo is being truncated (use debug=true to tune).
- int cutwidth = 0
- int cutheight = 0
- How tall is the logo? 0 will use a the default size as defined by "cutsize" (small, medium, large). This is generally sufficient for most logo types. Set it to -1 for a full height cut or to a specific number (in pixels) if you find part of the logo is being truncated (use debug=true to tune).
- int cutheight = 0
- float par = 1.0
- Pixel Aspect Ratio. No harm if you don't specify it, it just helps grow masks correctly in all directions.
- float par = 1.0
- string mode = "both"
- How to remove the logo: deblend for purely transparent logos, inpaint for purely solid logos and both for logos with both.
- string mode = "both"
- int percent = 25
- The percent of total frames to use in computing the masks, the more the better and the slower.
- int percent = 25
- int deblendfalloff = 5
- Gradient fallout from logo mask.
- int deblendfalloff = 5
- int AlphaToRepair = 130
- What is the luma value of the solid part of the logo.
- int AlphaToRepair = 130
- int RepairRadius = 1
- Used to expand the mask for none alpha ie solid areas.
- int RepairRadius = 1
- float InpaintRadius = 6.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 InpaintRadius = 6.0
- float InpaintSharpness = 25.0
- Higher values can prevent blurring caused by high Radius values.
- float InpaintSharpness = 25.0
- float InpaintPreBlur = 1.5
- 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 InpaintPreBlur = 1.5
- float InpaintPostBlur = 5.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 InpaintPostBlur = 5.0
- boolean lmask = true
- Apply post processing through a repair mask.
- boolean lmask = true
- int PP = 1
- Post Process, 1,2 or 3. Apply some additional post processing of the removed area to further hide the logo and artifacts.
- int PP = 1
Examples
LoadCPlugin("AVSInpaint.dll") Import("rm_logo.avs") AviSource("videowithlogo.avi") rm_logo(last, logomask="logo.bmp", loc="br", par=4.0/3.0, mode="both", percent=20, pp=1)
External Links
- Doom9 Forum - rm_logo discussion.
Back to External Filters ←