digitalFAQ.com Forums [Archives]

digitalFAQ.com Forums [Archives] (http://www.digitalfaq.com/archives/)
-   Avisynth Scripting (http://www.digitalfaq.com/archives/avisynth/)
-   -   Help with programming an Avisynth filter (http://www.digitalfaq.com/archives/avisynth/3001-programming-avisynth-filter.html)

MrTibs 03-16-2003 12:45 PM

Help with programming an Avisynth filter
 
I'm writing an Avisynth filter to remove translucent station logos. Here is my problem: I want to pass a single frame to my filter as a template for the logo (no need to create a bmp template) and I was wondering what is the best (fastest) way that I can cache a single frame that I'll need to compare when removing the logo?

Anyone know of some example code for Avisynth 2.0x?

kwag 03-16-2003 01:08 PM

Hi MrTibs,

Maybe the sources for "LogoAway" ( I think it's called :roll: ) used in Vdub might give you a hint :idea:

-kwag

muaddib 03-16-2003 10:18 PM

I saw one that is called DeLogo.

sh0dan 03-21-2003 08:17 AM

Depends on how you want to sample the images.

Your filter can request any frame from the source it wants at any time. This is much different from vdub, so it may take some time getting used to.

The PClip->GetFrame(int frame, env) is what is used to fetch frames. The frame number can be anything from 0 to nframes-1. So you can request any number of frames within one GetFrame call to your own filter.

There is automatic caching of source frames, so you should not have any problems retrieving the same frame twice. Look in the FilterSDK for more info.

MrTibs 03-21-2003 11:14 AM

Thanks for the reply. I've hacked some code together that is working for fetching the frame that I want. The biggest problem I am having is how to remove the logo. It seems I can't figure out just how the logo was added. (i.e. the brightness change varies based on the "underlying pixels".) I have even hacked together a filter that graphs the brightness values of a specific line [of the frame] so that I ccould "see" the logo brightness values.

Although the VDub de-logo filters are plentiful and very good, I want one that operates in the YUV colour space. Also, it would be great to be able to contol the filter completely from within Avisynth. (ie. no need to export frames into a graphic editor.)

Anyone who has some example code on how to remove a transparent logo, please post it here.

morsa 03-26-2003 03:30 AM

Hi, if you are interested about removing logos (or hardcoded subtitles!!) you could give a try to Restoreinpaint. www.sourceforge.net/projects/restoreinpaint
It is a very powerfull piece of software that performs something called inpainting with very advanced techniques.
One idea I've been discussing with its author is this:
The user selects an area where the logo or subtitle appears, the filter maps automatically to black or white ( so in most cases you will end with a mask of the logo to be removed).After detecting the figure to remove you give the mask a safe area adding some pixels around it.
After this it is time for inpainting!!!
Bernard De Cuyper told me it is posible to achieve this using his source code.

kwag 03-26-2003 09:14 AM

Hi morsa,

Quote:

Originally Posted by morsa
Hi, if you are interested about removing logos (or hardcoded subtitles!!)

No way 8O. Hardcoded subtitles are encoded in the mpeg file. It's not the same as a superimposed logo. There's no way to reconstruct what's under a subtitle that's part of a movie.
Quote:

you could give a try to Restoreinpaint. www.sourceforge.net/projects/restoreinpaint
It's a great software, but it's target is still images.

-kwag

morsa 03-26-2003 04:00 PM

Before saying there is no way try investigating.
I know the information behind the subtitle is not there anymore that is way i say INPAINTING.
Of course it is meant for still images, any spatial filter is meant for still images too, and nobody complains about that fact.
Okay, there is no problem, I do not want to begin a discussion.
If you do not like it, is okay for me.
But please don not make statements like : it is imposible, there is no way, etc.
It is posible, and there are many ways.If it wasn't posible, there wouldn't
be soft to restore damaged film, etc with lost portions of the image on several frames.

kwag 03-26-2003 04:26 PM

morsa,

It's not the same removing a "Logo" from a film, than removing a "Permanent Subtitle" :!:
While it is possible to remove the subtitle, it is impossible to reconstruct what is not there.
On logos, you have the original image under it. On permanent subtitles, you don't :!:
You cannot reconstruct (INPAINT, repaint, whatever) what is not phisically there. Retouching, sure, by averaging the near pixels and merging the scratched portion. But the larger the scratch, the worse the result. So on a huge area like permanent subtitles, I'm sorry to say that it is impossible to reconstruct. There's no need to further investigate what is not present :wink:

-kwag

GFR 03-27-2003 07:35 AM

Well, if you use some of the many error concealment techniques for video that are under research today, you may get some nice results at removing permanent subtitles.

These techniques use spatial and temporal clues and some weird math I can't understand :) to "recreate" complex textures in areas of the video that are lost. The typical application is recovering broken or lost mpeg blocks but if the technique can handle artifacts with arbitrary shapes it should work for subtitle removing. This is not smoothing or stamping nearby pixels, the lost pixels are "rendered" from a model estimated from the rest of the video.

If you do a google search on "error concealment" you'll find many articles with the most amazing results.

nicksteel 10-15-2003 09:53 AM

Is anyone using logo removal?
 
I capture TV as MPEG2 720x480 files
I create d2v with DVD2AVI
I trim commercials with VDUB-MPEG2 and save trim statements to paste into avs
I process avs with TMPGEnc

I would like to remove the continuous station logo.

I do not process as avi files.

Is anyone else doing this, and if so, how?


All times are GMT -5. The time now is 02:19 AM  —  vBulletin © Jelsoft Enterprises Ltd

Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.