Quantcast Help with Programming an Avisynth Filter - digitalFAQ.com Forums [Archives]
Go Back    digitalFAQ.com Forums [Archives] > Video Production Forums > Avisynth Scripting

Reply
 
LinkBack Thread Tools
  #1  
03-16-2003, 12:45 PM
MrTibs MrTibs is offline
Free Member
 
Join Date: Aug 2002
Location: Canada
Posts: 200
Thanks: 0
Thanked 0 Times in 0 Posts
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?
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Site Staff / Ad Manager
 
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
03-16-2003, 01:08 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Hi MrTibs,

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

-kwag
Reply With Quote
  #3  
03-16-2003, 10:18 PM
muaddib muaddib is offline
Free Member
 
Join Date: Jun 2002
Location: São Paulo - Brasil
Posts: 879
Thanks: 0
Thanked 0 Times in 0 Posts
I saw one that is called DeLogo.
Reply With Quote
  #4  
03-21-2003, 08:17 AM
sh0dan sh0dan is offline
Free Member
 
Join Date: Mar 2003
Posts: 89
Thanks: 0
Thanked 0 Times in 0 Posts
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.
__________________
Regards, sh0dan // VoxPod
Reply With Quote
  #5  
03-21-2003, 11:14 AM
MrTibs MrTibs is offline
Free Member
 
Join Date: Aug 2002
Location: Canada
Posts: 200
Thanks: 0
Thanked 0 Times in 0 Posts
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.
Reply With Quote
  #6  
03-26-2003, 03:30 AM
morsa morsa is offline
Free Member
 
Join Date: Mar 2003
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
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.
Reply With Quote
  #7  
03-26-2003, 09:14 AM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Hi morsa,

Quote:
Originally Posted by morsa
Hi, if you are interested about removing logos (or hardcoded subtitles!!)
No way . 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
Reply With Quote
  #8  
03-26-2003, 04:00 PM
morsa morsa is offline
Free Member
 
Join Date: Mar 2003
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
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.
Reply With Quote
  #9  
03-26-2003, 04:26 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
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

-kwag
Reply With Quote
  #10  
03-27-2003, 07:35 AM
GFR GFR is offline
Free Member
 
Join Date: May 2002
Posts: 438
Thanks: 0
Thanked 0 Times in 0 Posts
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.
Reply With Quote
  #11  
10-15-2003, 09:53 AM
nicksteel nicksteel is offline
Free Member
 
Join Date: Nov 2002
Posts: 863
Thanks: 0
Thanked 0 Times in 0 Posts
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?
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming: PureBasic port of avisynth incredible Avisynth Scripting 8 06-30-2007 03:06 AM
Avisynth: ffdshow preprocessing filter for avisynth incredible Avisynth Scripting 4 12-10-2004 06:53 PM
Avisynth: HQdn3d - mplayer filter ported to avisynth incredible Avisynth Scripting 1 10-25-2004 09:51 AM
Avisynth: Need clip filter & dust filters for avisynth nighthawk Avisynth Scripting 3 01-31-2004 12:24 PM
Avisynth: Auto crop using avisynth filter beta? black prince Avisynth Scripting 6 11-28-2002 08:51 AM




 
All times are GMT -5. The time now is 07:08 PM  —  vBulletin © Jelsoft Enterprises Ltd