Log in

View Full Version : Using Vdub DeLogo filter in AVS


PlazzTT
30th December 2004, 12:21
Hi,

I want to remove an alpha-blended logo from a TV capture I made. I've been reading this thread: http://forum.doom9.org/showthread.php?s=&threadid=27256 about how to use the DeLogo VDub filter in AviSynth.

The thread is two and a half years old, have any better delogo methods come about since then?

I'm using DeLogo 1.3.2, which is newer than the versions mentioned in that thread. When I go to Save processing settings, I get an error from the filter saying that the masks for the repair and deblend functions are not saved, meaning the DeLogo filter will have no function.

None of the DeLogo settings are saved in the .vcf file, so I don't have any settings to use in the AVS file.

Any suggestions on how I can get this to work?

Wilbert
30th December 2004, 14:27
The thread is two and a half years old, have any better delogo methods come about since then?
You could try Xlogo.

Didée
30th December 2004, 17:25
Personally I never have tried Xlogo. DeLogo works superb for me in AviSynth. My usage style might be old-school, but it works ;)

Import DeLogo.vdf as avisynth filter:
(from Wilbert's big import script for VirtualDub filters)
function VD_DeLogo(clip clip, bool "on_frames", string "range", string "file_deblend", string "file_alpha",
\ string "file_color", string "file_repair", float "depth", float "power", int "par_X", int "par_Y", bool "interlaced")
{
LoadVirtualdubPlugin("F:\Video\VirtualDub\plugins\delogo.vdf", "_VD_DeLogo")
X = round(10*depth)
Y = round(10*power)
# theoretically: z = 100*log10(par_X/par_Y), as approximation I took a minimax-approximation (calculated with Maple):
v = - 48.96556825 + 63.18825967*par_X - 16.00966389*par_X*par_X + 2.473556539*par_X*par_X*par_X - .2133268695*par_X*par_X*par_X*par_X
\ + .009456579673*par_X*par_X*par_X*par_X*par_X - .0001675297934*par_X*par_X*par_X*par_X*par_X*par_X
w = - 48.96556825 + 63.18825967*par_X - 16.00966389*par_X*par_X + 2.473556539*par_X*par_X*par_X - .2133268695*par_X*par_X*par_X*par_X
\ + .009456579673*par_X*par_X*par_X*par_X*par_X - .0001675297934*par_X*par_X*par_X*par_X*par_X*par_X
z = round(v) - round(w)
return clip._VD_DeLogo(default(on_frames,false)?1:0, default(range,""), default(file_deblend,""), default(file_alpha,""),
\ default(file_color,""), default(file_repair,""), default(X,15), default(Y,40), default(interlaced,false)?1:0, z)
}
By this, the DeLogo.vdf filter can directly be used in avisynth - but of course the bitmaps for alpha, deblend, color & repair still must be prepared and saved in VirtualDub prior to that.

Once the bitmaps are saved, I use the following base function to remove logos:

function delogo (clip clp) {
logo=clp.crop(0,0,104,64)
bottom=clp.crop(0,64,-0,-0)
right=clp.crop(104,0,-0,64)
ConvertToRGB(logo)
log1=VD_DeLogo(false, "", "ZDF_deblend.bmp", "ZDF_alpha.bmp", "ZDF_color.bmp", "ZDF_repair-t.bmp", 2.0, 4.0, 1, 1, false).ConvertToYV12()
log2=VD_DeLogo(false, "", "ZDF_deblend.bmp", "ZDF_alpha.bmp", "ZDF_color.bmp", "ZDF_repair-o.bmp", 2.0, 4.0, 1, 1, false).ConvertToYV12()
mergeluma(log2,log1,1.0)
top=stackhorizontal(last,right)
return ( stackvertical(top,bottom) )
}

Notes:

- I only work on the small frame snipplet that contains the logo (works faster, and no yuv->rgb->yuv conversion for the big rest of the frame).

- Most times I work with 2 different repair masks, one that is pure black or contains only small opaque logo areas that must be repaired, and one that covers all of the actual logo. Then two different DeLogos are done - one for luma with the minimal repair mask, one for chroma with the bigger repair mask. This way, the result usually is waaay better than with a single filter instance. Processing time is no issue, since the actually processed frame area is only so small.

- For very nasty cases, the first (luma) DeLogo'ed clip may be further processed (additional denoising and/or blurring+noise-adding, and/or lowering the MergeLuma value down from 1.0)

- the 2nd function could be made much more customized ... but I don't want to put twenty-five arguments into the DeLogo function call. So I prefer to copy and adjust the function for each new case.

- TIP: when doing the logo analysis in VirtualDub, feed a shortened (comp.-test alike) clip like crop(LogoArea).SelectRangeEvery(500,5). This way, one can do a fast analysis over the whole clip's range, AND there is no danger of false "metrics burn-in" e.g. in cases when a logo stands for two minutes above a hard contrast, like a bright lamp on a dark background.

Case examples of the result are shown in this post (http://forum.doom9.org/showthread.php?s=&postid=518035#post518035) of the iiP thread. One might use other methods, but I doubt the results will be better than those shown ;)