DarkZeros
29th January 2009, 01:54
I wrote this small avs script based on masktools functions, to remove translucent logos from videos.
#LoadPlugin("mt_masktools.dll")
function AlphaDeLogo(clip original,string blacklogo_path,string whitelogo_path, float adjust, float blackadjust, float whiteadjust)
{
logo_black = ImageSource(blacklogo_path,0, FrameCount(original), FrameRate(original)).ConvertToYV12()
logo_white = ImageSource(whitelogo_path,0, FrameCount(original), FrameRate(original)).ConvertToYV12()
mediumlevel = mt_lutxy(logo_black,logo_white,expr="x "+string(blackadjust)+" * y "+string(whiteadjust)+" * + 2 /")
diff = mt_lutxy(logo_black,logo_white,expr="y "+string(whiteadjust)+" * x "+string(blackadjust)+" * - "+string(adjust)+" *")
normalized = mt_lutxy(original,mediumlevel,expr="x y - 128 +")
corrected = mt_lutxy(normalized,diff,expr="x 128 - y 256 / / 128 +")
return corrected
}
Its use is simple.
-Create a black image with the logo, and another one white.
Just pick them from the video and delete any other non-black or non-white object. (You can use "paint" for it)
Here there is an example of how should it look like:
http://forum.doom9.org/attachment.php?attachmentid=9356&stc=1&d=1233189870
Of corse, the files MUST be the same size as the video.
Then call the avs function:
AlphaDeLogo(last,"b.bmp","w.bmp",1,1,1)
The 3 values:
adjust, blackadjust and whiteadjust are to fine adjust the filter intensity. I recomed to let black and white adjust at 1, and only touch the adjust level [range 1-1.5]
Here some examples with a bad catched logo ("blocked" input):
http://forum.doom9.org/attachment.php?attachmentid=9358&stc=1&d=1233189897
And here some more, this time with a better logo input to the filter, and with some "delogo" repair in the borders:
http://forum.doom9.org/attachment.php?attachmentid=9357&stc=1&d=1233189897
I hope someone find it usefull.
#LoadPlugin("mt_masktools.dll")
function AlphaDeLogo(clip original,string blacklogo_path,string whitelogo_path, float adjust, float blackadjust, float whiteadjust)
{
logo_black = ImageSource(blacklogo_path,0, FrameCount(original), FrameRate(original)).ConvertToYV12()
logo_white = ImageSource(whitelogo_path,0, FrameCount(original), FrameRate(original)).ConvertToYV12()
mediumlevel = mt_lutxy(logo_black,logo_white,expr="x "+string(blackadjust)+" * y "+string(whiteadjust)+" * + 2 /")
diff = mt_lutxy(logo_black,logo_white,expr="y "+string(whiteadjust)+" * x "+string(blackadjust)+" * - "+string(adjust)+" *")
normalized = mt_lutxy(original,mediumlevel,expr="x y - 128 +")
corrected = mt_lutxy(normalized,diff,expr="x 128 - y 256 / / 128 +")
return corrected
}
Its use is simple.
-Create a black image with the logo, and another one white.
Just pick them from the video and delete any other non-black or non-white object. (You can use "paint" for it)
Here there is an example of how should it look like:
http://forum.doom9.org/attachment.php?attachmentid=9356&stc=1&d=1233189870
Of corse, the files MUST be the same size as the video.
Then call the avs function:
AlphaDeLogo(last,"b.bmp","w.bmp",1,1,1)
The 3 values:
adjust, blackadjust and whiteadjust are to fine adjust the filter intensity. I recomed to let black and white adjust at 1, and only touch the adjust level [range 1-1.5]
Here some examples with a bad catched logo ("blocked" input):
http://forum.doom9.org/attachment.php?attachmentid=9358&stc=1&d=1233189897
And here some more, this time with a better logo input to the filter, and with some "delogo" repair in the borders:
http://forum.doom9.org/attachment.php?attachmentid=9357&stc=1&d=1233189897
I hope someone find it usefull.