Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 12th July 2019, 19:52   #1  |  Link
MeteorRain
結城有紀
 
Join Date: Dec 2003
Location: NJ; OR; Shanghai
Posts: 528
DelogoHD

DelogoHD is an overhaul of the original delogo filter, which was originally written by MakKi many years ago. It also deprecates my previous porting project VapourSynth-DeLogo.

Legacy parameters are removed due to analog TV signal being deprecated years ago.

This filter provides both AviSynth+ and VapourSynth interfaces. It compiles under both MSVC and GCC.

It requires at least a SSE4.1 compatible CPU to run.



Usage

Code:
# AviSynth+
DelogoHD(clip, "CCAV 3840x2160.lgd", start = 5, end = 95, fadein = 2, mono = true, cutoff = 5)
AddlogoHD(clip, "CCAV 3840x2160.lgd", start = 5, end = 95, fadein = 2, mono = true, cutoff = 5)

# VapourSynth
delogohd.DelogoHD(clip, "CCAV 3840x2160.lgd", start = 5, end = 95, fadein = 2, mono = True, cutoff = 5)
delogohd.AddlogoHD(clip, "CCAV 3840x2160.lgd", start = 5, end = 95, fadein = 2, mono = True, cutoff = 5)

Parameters

- clip

A clip to process. It must have constant format and it must be YUV 8..16 bit with integer samples.

YUV420P8/10/12/14/16, YUV422P8/10/12/14/16, YUV444P8/10/12/14/16.

- logofile

Logo file in lgd format.

- logoname

Logo name to be selected from logo file.

Default: `NULL`, selecting the first one.

- start, end

First and last frame that has the logo.

Default: From 0 to Max

- fadein, fadeout

Number of fading frames.

Default: 0

- left, top

Number of pixels in adjusting logo position.

For example, `left = -5` results logo being 5 pixels left to its original position.

Default: 0

- mono

Force mono logo, wiping chroma part of the logo.

Default: false

- cutoff

Wiping near-transparent part of the logo, if its depth is lower than cutoff. Should be less than 1000 (Max logo depth).

Default: 0

Last edited by MeteorRain; 14th July 2019 at 03:47.
MeteorRain is offline   Reply With Quote
Old 12th July 2019, 22:39   #2  |  Link
Natty
Noob
 
Join Date: Mar 2017
Posts: 147
Natty is offline   Reply With Quote
Old 13th July 2019, 10:28   #3  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 5,527
Quote:
Originally Posted by MeteorRain View Post
...
- logofile

Logo file in lgd format.
Please, some info about lgd format and how create it.
__________________
BeHappy, AviSynth audio transcoder, in Doom9 forums. NicAudio, BassAudio, audio decoders.
tebasuna51 is offline   Reply With Quote
Old 14th July 2019, 04:01   #4  |  Link
MeteorRain
結城有紀
 
Join Date: Dec 2003
Location: NJ; OR; Shanghai
Posts: 528
Quote:
Originally Posted by tebasuna51 View Post
Please, some info about lgd format and how create it.
The original tool was built by MakKi back in 2003.

The tool was originally made for AviUtl, being only used within Japan, and is all in Japanese language. It was used to remove the half-transparent TV station logo from captured analog or digital TV programs. But it should also work with other logos as long as they are static and half-transparent. I've tested against Pilot's Eye Bluray Disc and it worked very well. Some porn video that comes with half-transparent logos from their publisher can also benefit, but I never tried.

I have translated the logo header file so you may check that for detailed structure.
Basically a LGD consists of a magic, a name, meta like w h posx posy etc, and the body which is array of actual logo image.
The image was in 12bit Y/Cb/Cr format, which is sometimes called as AviUtl YC colorspace. Alpha channel is recorded for each channel, so it's actually Y/A/Cb/A/Cr/A format. The YCbCr color space is different than what we use as YUV, and during computing, the original Delogo AVS plugin has to convert pixels to AU-YC, remove the logo, then convert them back to YV12. I have re-written the algorithm and it no longer converts data back and forth.

To create a LGD file, the only possible way is to use AviUtl (in Japanese). A Chinese tutorial about how to use the Japanese plugin is available here. Knowing both Chinese and Japanese is recommended to read the tutorial. I've also built a website for my collections of LGD logos these years so far.

Last edited by MeteorRain; 14th July 2019 at 04:16. Reason: typo
MeteorRain is offline   Reply With Quote
Old 14th July 2019, 10:03   #5  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 5,527
Then to create a .lgd of the logo we need install AviUtl, maybe from https://www.videohelp.com/software/AviUtl

Add the logoscan plugin, maybe from http://blog.livedoor.jp/swing26/logoscan_007.zip.zip

And learn chinese and japanese to know how to do.

Too complicated for me, sorry.
__________________
BeHappy, AviSynth audio transcoder, in Doom9 forums. NicAudio, BassAudio, audio decoders.
tebasuna51 is offline   Reply With Quote
Old 14th July 2019, 11:46   #6  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,765
Quote:
Originally Posted by tebasuna51 View Post
Too complicated for me, sorry.
Yes, the ability to accept the logo from another video clip would make a lot more sense, especially as clean logos can often be found in black sections of video. To speed up processing it could be cropped, and an offset passed as parameters to the filter.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 14th July 2019, 19:59   #7  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,129
Quote:
Originally Posted by tebasuna51 View Post
Then to create a .lgd of the logo we need install AviUtl, maybe from https://www.videohelp.com/software/AviUtl

Add the logoscan plugin, maybe from http://blog.livedoor.jp/swing26/logoscan_007.zip.zip

And learn chinese and japanese to know how to do.

Too complicated for me, sorry.
Well the logo database is getting really huge now, to a point that we don't need to make on our own. Just grab the one you need and use it. And in case you have a newer one, just post a request and I'm sure others can help make it for you.
lansing is offline   Reply With Quote
Old Yesterday, 20:22   #8  |  Link
MeteorRain
結城有紀
 
Join Date: Dec 2003
Location: NJ; OR; Shanghai
Posts: 528
Quote:
Originally Posted by wonkey_monkey View Post
Yes, the ability to accept the logo from another video clip would make a lot more sense, especially as clean logos can often be found in black sections of video. To speed up processing it could be cropped, and an offset passed as parameters to the filter.
It would be impossible. A half-transparent logo has alpha channel information, and must be computed from multiple solid color samples.

The logoscan tool filters logo images by checking the color on the edge. If all pixels on the edge are colors within threshold, it's considered as a solid color. Blue sky and solid color wall are good background for making those samples.

Now suppose you have logos on solid purple / red / black / white / blue, etc, next step is linear regression. It figures out the parameters of the linear function, Y' = Y * (d / MAX_DP) + c, where d and c are parameters to be computed. Once you get d and c for all 3 channels of all pixels, you can add or remove the logo from the image.

Transplanting a logo from a pure black image won't give you the linear function parameters and thus is not possible to remove logos in this way.
MeteorRain is offline   Reply With Quote
Old Yesterday, 22:27   #9  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,765
It can be done if the logo can be considered to be white (or, slightly more complex, any solid colour if you can determine what it is), as the three examples posted all seem to be, and as many logos are:


It's not perfect, but it was a rush job and it's a more solid logo than the three examples.
__________________
My AviSynth filters / I'm the Doctor

Last edited by wonkey_monkey; Yesterday at 23:30.
wonkey_monkey is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 22:20.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.