Log in

View Full Version : Yet another unlogo script - simple usage


ppera2
19th May 2005, 21:14
It is based on Dekafka AVS script. I changed it, so no need to colorspace conversion to RGB32 by usual YUY2 capture.
There is no need to make mask bitmap too. Blurring is dropped out,
because it makes some green artifacts at right edge, and no really need for it, because bilinear upsize blurs well.

Plus: Works with YUY2 colorspace, no conversion to RGB
Fast
No need to make mask

Minus: It covers bigger area than masked delogo solutions

However, by covering original logo with reactangle it is totally masked, so hard to guess what whas there, what may be good in some cases.


Here is function, and example how to call it:



function delogo(clip)
{

#TV BBC15, Res 576x560 (crop top & bot. by 8) - memo, optional

#Position & size & Opacity - enter here values by logo position and size

Xp = 488
Yp = 18
X = 48 #Must be dividable by 4
Y = 66
Op = 255

#By need:
#clip = clip.ConvertToYUY2()

top = clip.Crop(Xp, Yp-2, X, 2)
bot = clip.Crop(Xp, Yp+Y, X, 2)
left = clip.Crop(Xp-4, Yp, 4, Y)
right = clip.Crop(Xp+X, Yp, 4, Y)

logoh = StackVertical(top, bot).BilinearResize(X, Y)
logov = StackHorizontal(left, right).BilinearResize(X, Y)
logob = Layer(logoh, logov, "fast" )
clip = clip.Layer(logob, "add", Op, Xp, Yp)
return clip
}

# SOURCE
clip=SegmentedAvisource("J:\Capture1.avi",pixel_type="yuy2")

#Crop by need...

clip=clip.delogo()

#Resize, filters....
clip=clip.BilinearResize(Width,Height)

return clip




Btw: when use blur in AVS with narrow clips, it results with some green artefacts at right side. Is it because of small dimensions or general bug? It is best viewable by B/W clips.

ppera2
20th May 2005, 14:24
Here is a new version, with masking. It uses new AVS function overlay (from Ver 2.54), where masking with
YUV colorspaces is also possible. It's almost same as delogo script, just uses B/W mask for blending only area where logo is, by any shape. Mask preparation is same as by DeKafka, but it is best to save it as 1 frame long, YUY2 AVI.
Use Mpeg2dec.dll (and 'old' DVD2AVI)instead DGDecode if want right YUY2 from Mpeg2...


Plus: No conversion to RGB, works with YUY2
Fast

Minus: ???


The script:


function delogom(clip, masklogo)
{

#Position & size & Opacity - ENTER HERE values by logo position and size

#BBC18 , Logo right, res 720x576

Xp = 560
Yp = 24
X = 122 #must be dividable by 4
Y = 82
Op = 1 # 0 - 1 ! (Overlay of AVS)

#By need:
clip = clip.ConvertToYUY2()

top = clip.Crop(Xp, Yp-2, X, 2)
bot = clip.Crop(Xp, Yp+Y, X, 2)
left = clip.Crop(Xp-4, Yp, 4, Y)
right = clip.Crop(Xp+X, Yp, 4, Y)

logoh = StackVertical(top, bot).BilinearResize(X, Y )
logov = StackHorizontal(left, right).BilinearResize(X, Y)
logob = Layer(logoh, logov, "fast" )

#Only when clip is resized...
#masklogo = masklogo.BilinearResize(X, Y)

clip = Overlay(clip, logob, mode = "blend", opacity = Op, x = Xp, y = Yp, mask = masklogo)
return clip
}

# PLUGINS
LoadPlugin("C:\PROGRA~1\GORDIA~1\DGMPGDec\DGDecode.dll")

# SOURCE
clip=mpeg2source("E:\Mex.d2v")

masklogo=AVISource("E:\PM720.avi")

# CROPPING
clip=clip.crop(14,2,704,572)

clip=clip.delogom(masklogo)

# RESIZING
#clip=clip.BilinearResize(544,400)

return clip


I will try blurring with UnFilter later...

ppera2
24th May 2005, 18:49
Here is how 'blur bug' looks:

http://piters.tripod.com/pics/