Log in

View Full Version : Didee's DeLogo filter


Daodan
17th November 2006, 18:59
After finally convincing someone to partly translate the manual and therefore getting this filter to work...I have a problem.
All works pretty well while doing the steps in virtualdub, the logo removal is almost great, I save the bmps as instructed (with the correct names and path)...and now the error when I try to load the script in VD:

http://upload.georgeownsme.com/thumbs.php/13847.jpg (http://upload.georgeownsme.com/image.php/13847.jpg)

What's the problem and how can i make it work? Thank you.

Wilbert
17th November 2006, 23:06
Could you post the two lines?

Daodan
17th November 2006, 23:18
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("C:\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)
}

### ### ###

function DeLogo( clip clp, int Lwidth, int Lheight, string loc, string name,
\ float "Cmix", float "Lmix")
{
# logomask=(name2=="")?clp:imagereader(name2).loop().trim(0,framecount(clp)).converttoyv12(matrix="PC.601")
Lmix=default(Lmix,0.0)
Cmix=default(Cmix,0.0)
ox=clp.width
oy=clp.height
x1 = (LeftStr(loc,1)=="L") ? 0 : ox-Lwidth
y1 = (RightStr(loc,1)=="O") ? 0 : oy-Lheight
logo = clp.crop(x1,y1,Lwidth,Lheight)
row = (x1==0) ? (y1==0) ? clp.crop(Lwidth,0,-0,Lheight) : clp.crop(Lwidth,oy-Lheight,-0,-0)
\ : (y1==0) ? clp.crop(0,0,x1,Lheight) : clp.crop(0,oy-Lheight,x1,-0)
rest = (y1==0) ? clp.crop(0,Lheight,-0,-0): clp.crop(0,0,-0,oy-Lheight)
ConvertToRGB(logo)
log1=VD_DeLogo(false, "", name+"_deblend.bmp", name+"_alpha.bmp", name+"_color.bmp", name+"_repair.bmp", 1.5, 3.0, 1, 1, false).ConvertToYV12()
log2 = (Cmix==0.0 && Lmix==0.0)
\ ? log1 : VD_DeLogo(false, "", name+"_deblend.bmp", name+"_alpha.bmp", name+"_color.bmp", name+"_repair_c.bmp", 2.5, 3.0, 1, 1, false).ConvertToYV12()

Cmix==0.0 ? log1 : MergeChroma(log1,log2,Cmix)
Lmix==0.0 ? last : MergeLuma(last,log2,Lmix)

# Removegrain(2).temporalsoften(2,7,7,23,2).AddGrain(5,.0,.0)
# name2==""?NOP:maskedmerge(logo,last,logomask.FitY2UV(),Y=3,U=3,V=3)
row2 = (x1==0) ? stackhorizontal(last,row) : stackhorizontal(row,last)
y1==0 ? stackvertical( row2,rest) : stackvertical( rest,row2)
return last
}

### ### ###

function ServeLogo( clip clp, int Lwidth, int Lheight, string loc, int "SnipSize", int "avg" )
{ SnipSize = default( SnipSize, 56 )
avg = default( avg, 3 )
x1 = (LeftStr(loc,1)=="L") ? 0 : clp.width-Lwidth
y1 = (RightStr(loc,1)=="O") ? 0 : clp.height-Lheight
clp.crop(x1,y1,Lwidth,Lheight)
SelectRangeEvery( SnipSize, 1 )
return TemporalSoften( avg,255,255,255,2 )
}



The bold lines...

Didée
18th November 2006, 00:56
- What are the exact names you're saving the bitmaps with
- what are the exact locations you're saving the bitmaps to
- what's the exact syntax you're calling the filter with

Note that:

- from within Vdub, you have to save the BMPs to the same folder in which your main avs script is located
- you have to save those bitmaps as "XYZ_alpha.bmp", "XYZ_deblend.bmp", etc. pp., where "XYZ" is any name of your choice

Also, if you're going to use Cmix other than 0.0 (which is recommended, values of 0.4 to 1.0 for Cmix improve the result noticeably most times), then

- you have to save a 2nd "repair" mask from within Vdub, which has to be named "XYZ_repair_c.bmp". For this one, the area to be repaired should cover all of the problematic areas (in case of doubt, the complete logo).


The script is a bit uncomfortable in regards to pathnames, that's true ... safest way is to have [main script] and [delogo script] and [all logo bitmaps] in the very same folder.


edit: including edit-of-edit...

BTW, the latest version of the delogo script function is the one attached to this post (http://forum.gleitz.info/showthread.php?p=172450#post172450). (Actually, the script is awkward, an incredible mess ... noone look at it, please).
It offers the following additional properties:

"i" variable (true/false) - switch for interlaced footage

"PP" variable (true/false) - activates some fixed postprocessing, rather crude. Use only if result can't be made stable by other means.

"name2" variable - possibility to deliver an additional mask, which is used to MaskedMerge() the filter's end result over the logo snip area ... i.e. useful for hiding possible color changes from the RGB<-->YV12 conversion. (For this case, use a mask covering all of the logo, with a soft feathered edge beyond the logo.)
To use this 2nd masking, the variable "name2" must contain the "fullnameofmask.bmp". The "XYZ_" prefix is not used.

"Lmix" now may be bigger than 1.0. If Lmix>1.0, a different way of mixing will be used. The old script would just copy a percentage of the full-repaired logo, according to Lmix=0.0~1.0.
The new script will, for Lmix>1.0 values, do an offset of the pixel value in direction of the full-repaired version.
In most cases, I'd not recommend using the 0.0~1.0 value range for Lmix anymore. A value of 1.0~2.0 [good source] to 4.0~5.0 [poor source] for Lmix is preferred.

Daodan
18th November 2006, 07:46
It seemed to me it had to do with names of the bmps, they were all correct and all that, but..you guessed it: the path. The translation said they should be in the same folder as the function script, moving my avs script in the same dir with that one solved the problem.
Thanks.