Rm logo

From Avisynth wiki
Revision as of 23:23, 18 May 2013 by Wilbert (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Abstract
Author Spuds
Version 0.5
Download rm_logo.avs
Category Logo removal
Requirements
  • YV12
License
Discussion

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

Contents

Abstract

Script to help in the removal of channel logos or other distracting objects.

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!

Requires Filters

Description

A logo removal filter using Inpaint technology, plus additional post processing for a more complete removal.

clp clip = last
The clip to be "delogo-ed".

logomask string = null
The name of the black and white bmp you created.

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

cutsize string = "small"
How big of a cut to make, small, medium, large.

cutwidth int = 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).

cutheight int = 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).

par float = 1.0
Pixel Aspect Ratio. No harm if you don't specify it, it just helps grow masks correctly in all directions.

mode string = "both"
How to remove the logo: deblend for purely transparent logos, inpaint for purely solid logos and both for logos with both.

percent int = 25
The percent of total frames to use in computing the masks, the more the better and the slower.

deblendfalloff int = 5
Gradient fallout from logo mask.

AlphaToRepair int = 130
What is the luma value of the solid part of the logo.

RepairRadius int = 1
Used to expand the mask for none alpha ie solid areas.

InpaintRadius float = 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.

InpaintSharpness float = 25.0
Higher values can prevent blurring caused by high Radius values.

InpaintPreBlur float = 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.

InpaintPostBlur float = 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.

lmask boolean = true
Apply post processing through a repair mask.

PP int = 1
Post Process, 1,2 or 3. Apply some additional post processing of the removed area to further hide the logo and artifacts.

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)

Links

Download rm_logo.avs Current version (recommended).

Personal tools