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.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage
Register FAQ Today's Posts Search

Reply
 
Thread Tools Search this Thread
Old 13th April 2005, 18:04   #21  |  Link
trevlac
budala
 
Join Date: Oct 2003
Location: U.S.
Posts: 545
Quote:
Originally posted by Malcolm
interesting filter!
but if you compare the 2 pictures of the woman (unfiltered and filtered) by switching back- and forth, you can see that in all corners of the picture some slight diagonal bars are introduced. (exactly like the ones that are removed in the middle of the picture).
looks like an 'overcompensation' effect.

Greetings,
Malcolm
Hi,

I assume you are talking about my try. Because I can't see any lines in VC's filter result. I did another pic for you. I just didn't process the top and bottom 100 lines. Looking at the problem in the origninal, it looks like the pattern is only in the middle. Not sure why this is. Maybe just this frame. I do want to repeat that I am goofing with this frequency stuff ... which is farily cool ... and VC is the one with the practical filter. Also, I believe I am doing the basic same thing that Fizick was doing. It might be that the parameters were not set well when defreq was used.


@VC,

Please feel honored that Wilbert is pestering you about the source code. I've been trying to get him to look at mine for months.
trevlac is offline   Reply With Quote
Old 18th April 2005, 04:58   #22  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 916
I thought that the interference frequencies being much smaller than the TV signal or scan line frequencies one will invariably notice the interference as being oriented vertical to diagonal. I calculated that the freq of interference in the example above to be around 40khz. I thought that a similar interference appearing horizontal was impossible.
Yesterday I was watching the History channel wherein in some scenes (flash backs) pure horizontally oriented interference is seen. May be they are deliberately done to give flash back impression.

I am curious to know whether any one experienced a horizontal interference noise. What explanation will it have. May be the 40khz is a beat frequency?
In any case I will make a function to deal with this type of interference also for possible use.
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 18th April 2005, 17:09   #23  |  Link
Poutnik
Useless idea generator
 
Poutnik's Avatar
 
Join Date: Apr 2004
Location: Europe, Czech Republic, Brno
Posts: 332
Quote:
Originally posted by vcmohan
....a plugin FanFilter (The name is due to my assosiation with Seismic data processing for Oil and Gas).
the name could also be according to bad fans ( ventilators),
causing heavy electric regular noise/interference on power lines
__________________
Vista64 Premium SP2 / C2D E4700 2.6GHz/ 6GB RAM/ Intel GMA 3100 / DTV Leadtek DONGLE GOLD USB2 /
focused to DVB-T MPEG2 PS capture -> ProjectX -> M2V/MP2 -> MeGUI/AVS -> MP4[AVC/AAC]
Poutnik is offline   Reply With Quote
Old 19th April 2005, 13:05   #24  |  Link
trevlac
budala
 
Join Date: Oct 2003
Location: U.S.
Posts: 545
@vcmohan

Here is a 'nice' sample i grabbed from a post on the vdub area. What do you think of this one? It's from VHS. Not sure what stage the interference got there.

trevlac is offline   Reply With Quote
Old 21st April 2005, 03:46   #25  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 916
Well thats a tough one. Can you give me the url for that virtualdub forum thread where it was posted?
I tried my FanFilter and found that it can hardly do any thing.
Then I examined the pixelvalues using PixelValues plugin (incidentally for some image sizes this plugin gives access violation errors. I did not go deep into that.) I found that the interference amplitude is about 60 i.e. it swings from +60 to -60. Some places it is more.

I realised that I need to formulate a filter on opposite princeples (opposite to my FanFilter). I also expect that in the process of removing such large value noise I will lose quite a bit of signal also.

I changed my FanFilter into VFanFilter, HFanFilter to be effective in vertical and horizontal (these are seemingly Vertical and Horizontal but in reality they are reverse) directions. I also added to this plugin family of functions VFanPass and HFanPass functions. I also had to liberalise restrictions of values for parameters to be able to use in extreme cases but leave it to the user to use his judgement. The Filter is ready and I tested on the image above.
After VFanPass I had to cleanup image of horizontal streaks with HFanFilter.
The resulting image is :


using subtract.levels the noise removed is below:


As expected the image after processing is not as good as one likes it to be. Also I did not experiment with the filter params. This is a first cut. After updating the documentation, I plan to release this newer version of FanFilter Plugin shortly hopefully before my 71st birthday.
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 21st April 2005, 04:26   #26  |  Link
trevlac
budala
 
Join Date: Oct 2003
Location: U.S.
Posts: 545
I thought you'd like that one.

I think it was here.
http://forum.doom9.org/showthread.php?s=&threadid=91098

Not much was said ... and he removed the pictures. I had just saved that one because I thought it was nice.

Your filter did well. Although from looking at the subtract, I see a few of the edges gone.

I've recently been working on an image spectrum analyzer vdub plugin. Really just for learning purposes. It displays the 2D power spectrum. I did a small write up. Maybe you'd like to take a look?

[edit] Updated url
http://www.trevlac.us/FilterDocs/Filters.htm

-------------------
70 and learning new things every day? Well ... I've still got a few years to catch up. I'm 38.

Last edited by trevlac; 22nd April 2005 at 19:07.
trevlac is offline   Reply With Quote
Old 22nd April 2005, 04:27   #27  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 916
Thanks very much for the info. Infact I am looking to get hold of a fft plugin source, an inverse fft plugin source, from which i can get the coefficients to design some filters. Having a bit of aversion to all those mathematical symbols curls, matrix notations etc I can hardly understand those published software to be able to port to avisynth as a plugin for my use. I will study your source try understand.

Your plugin thru freq domain route did remove those noise freq except for a horizontal streak. Theoritically your approach is sounder than mine.Probably looks cleaner in result. But mine working in time domain works faster and does not require too much understanding of 2D fft. Very sharp edges are difficult to remove in freq domain. A short operator in time domain has a long spectrum in freq and vice versa. Please see the thread http://forum.doom9.org/showthread.php?s=&threadid=93229 . Freq domain filtering in this case may not work, I think.

I have been trying to do a notch filter in time domain but got stuck as I could not get hold of the impulse response of a notch filter. These we were using in oil exploration to remove power line interference.

I urge you to please devout some time on this plugin of yours and finish it early.
__________________
mohan
my plugins are now hosted here

Last edited by vcmohan; 22nd April 2005 at 04:31.
vcmohan is offline   Reply With Quote
Old 22nd April 2005, 11:37   #28  |  Link
tsp
Registered User
 
tsp's Avatar
 
Join Date: Aug 2004
Location: Denmark
Posts: 807
vcmohan: you can use fftw for the conversion to and from the frequency domain. Also take a look on this page also my filter fft3dgpu has the fft code include(although in a perverted form to be used on a graphics card. The source is based on the fft algorithm in "Numerical recipes in C" (good book)
tsp is offline   Reply With Quote
Old 22nd April 2005, 14:12   #29  |  Link
Arachnotron
Alias fragger
 
Arachnotron's Avatar
 
Join Date: Jul 2003
Location: the Netherlands
Posts: 863
Quote:
The source is based on the fft algorithm in "Numerical recipes in C" (good book)
Be carefull with that book. The licence prohibits you from distributing the source of your programs if you include routines from it (or even the executable itself depending on which licence you have) so using stuff from it in opensource projects can lead to problems.
See here especially the second bullit.

I wonder in how far they can enforce the license (how many ways are there to program a bubble sort ?) but I thought I mention it anyway.
Arachnotron is offline   Reply With Quote
Old 22nd April 2005, 19:26   #30  |  Link
trevlac
budala
 
Join Date: Oct 2003
Location: U.S.
Posts: 545
Quote:
Originally posted by vcmohan
Infact I am looking to get hold of a fft plugin source, an inverse fft plugin source, from which i can get the coefficients to design some filters. Having a bit of aversion to all those mathematical symbols curls, matrix notations etc I can hardly understand those published software to be able to port to avisynth as a plugin for my use. I will study your source try understand.
I too can't really read the math. But I'm working on it. Differential Equations ... yummy. As tsp pointed out. There are certainly better sources for DFT and IDFT. In fact, I just used the FFTW api. They have great doc. It's quite easy.


Quote:
But mine working in time domain works faster
Probably ... but FFTW is quite fast. Given that and no need to convert to YCbCr ... an avs filter in the freq domain only needs to work on a small set of frequencies to filter them. Not all the pixels. I've got sqrt() and such in my code. There is a lot of room for improvement.

Quote:
Please see the thread http://forum.doom9.org/showthread.php?s=&threadid=93229 . Freq domain filtering in this case may not work, I think.
I tried and it did not work. The scratches cover too large of a frequency range. It is difficult to isolate them from other parts of the picture. They can be dampened, but your filters do a much better job at removal.

Quote:
I urge you to please devout some time on this plugin of yours and finish it early.
Thanks for the encouragement. I think I need to play with it for a while to get a better understanding of the Freq domain. I have come a long way .. AVS is probably a better place for a real (and fast) FFT filter. Of course Fizick and tsp have really already done that.

PS: I've recently been trying to figure out (phase) cross-correlation. I think they use this in the various deshake/depan plugins. The interesting area being motion estimation.
trevlac is offline   Reply With Quote
Old 23rd April 2005, 03:32   #31  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 916
Quote:
Originally posted by trevlac

Probably ... but FFTW is quite fast. Given that and no need to convert to YCbCr ... an avs filter in the freq domain only needs to work on a small set of frequencies to filter them. Not all the pixels. I've got sqrt() and such in my code. There is a lot of room for improvement.
One thing that comes to my mind if You have not already implemented it is the one dimensional FFT is Symmetric and so only half the coefficients need to be computed. Similarly carrting this further when you take this to 2D FFT probably only a quadrant need to be computed. If FFT or IFFT algorithm requires the other half they just can be copied. It can increase speed.
Can you give a url for a place where I can get a 1D FFT routine that gives me coefficients.


Quote:
I've recently been trying to figure out (phase) cross-correlation.
Cross correlation is used extensively in seismic data processing. Depending on the cross correlation matrix filters are designed. Autocorrelation gives a great info on the frequencies present. FFT of a autocorrelation is still less work as all coefficients are real, complex part being zero. Decovolution (or Refocus) is designed using autocorrelation matrix.
I tried cross correlation on the first image in this thread to determine whether I can extract noise wavelength and its amplitude.I could get the wavelength to be between say 11 and 12. But could not proceed further when I realised that this much accuracy is not good enough unless I do a cross correlation continuously to determine best filtering position for each pixel. So I gave up.
__________________
mohan
my plugins are now hosted here

Last edited by vcmohan; 23rd April 2005 at 03:52.
vcmohan is offline   Reply With Quote
Old 24th April 2005, 02:06   #32  |  Link
trevlac
budala
 
Join Date: Oct 2003
Location: U.S.
Posts: 545
@VC

You know much more than I, my friend.

But on the symmetrical bit ... yes. That helps quite a bit. To be specific on speed using FFTW ... and doing that bad pic takes ..

- Copy all input luma to an array of doubles ... 640x480 values
- FFT
- Now you have an array of pairs (sin & cos) but only 1/2 the input 320x480x2
- process about a 20 pixel wide band 20x480x2 setting the doubles to zero
- IFFT
- Copy the luma back ... unfortunately you have to scale and clamp these values before you really have luma

- done

------------------
www.fftw.org is the main place.
http://www.fftw.org/#documentation is the doc.


I used version 2 because I could not get a library for v3 nor could I compile it. It says 3 is faster.

Here is v2 Doc and library / .h file info.
http://www.fftw.org/fftw2_doc/
http://claymore.engineer.gvsu.edu/~s.../software.html

1D transform giving the power specturm ... basicly what I show. 2D has a little different format. Not really much code to do this.

http://www.fftw.org/fftw2_doc/fftw_2.html#SEC5
Code:
#include <rfftw.h>
...
{
     fftw_real in[N], out[N], power_spectrum[N/2+1];
     rfftw_plan p;
     int k;
     ...
     p = rfftw_create_plan(N, FFTW_REAL_TO_COMPLEX, FFTW_ESTIMATE);
     ...
     rfftw_one(p, in, out);
     power_spectrum[0] = out[0]*out[0];  /* DC component */
     for (k = 1; k < (N+1)/2; ++k)  /* (k < N/2 rounded up) */
          power_spectrum[k] = out[k]*out[k] + out[N-k]*out[N-k];
     if (N % 2 == 0) /* N is even */
          power_spectrum[N/2] = out[N/2]*out[N/2];  /* Nyquist freq. */
     ...
     rfftw_destroy_plan(p);
}
Enjoy
trevlac is offline   Reply With Quote
Old 24th April 2005, 20:35   #33  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,182
trevlac,
Why
Quote:
used version 2 because I could not get a library for v3 nor could I compile it.
?

Do you see Defreq source? it used all needed parts of FFTW3 library. The lilrary is dll + def + include file.
I did not use any fftw source.
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 25th April 2005, 00:55   #34  |  Link
trevlac
budala
 
Join Date: Oct 2003
Location: U.S.
Posts: 545
Fizick,

I did want to thank you. I don't know if you recall, but in a thread a while back ... I was interested in doing a full frame FFT and quite a few said it could not be done and was not worth it. You offered to help and pointed me in the right direction.

I never did really look at your source. I didn't realize it was in the zip files. Once I saw you used FFTW, I just read their doc. It made getting one working quite easy. Understanding what I am looking at ... that's not as easy.

I could not find the lib or def files for v3. I guess I should upgrade when ever I clean up my vdub filter. The format is a little different from v2 to v3. Thanks for the tip.
trevlac is offline   Reply With Quote
Old 2nd June 2005, 04:43   #35  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 916
Quote:
Originally Posted by Wilbert
2. Most of them have the source included (the ones who haven't can be counted on two hands; or one hand if you exclude your plugins .
Well I reduced those number of fingers. I just posted the FanFilter, Reform and Grid plugins along with the Source codes.
As most of the plugins did not carry the src tag I thought they do not have the source code. That was my mistake.

About EffectsMany and TransAll the source code is large and I find that each time I update a small bit of a function code, I need to not only upload the full dll and documentation, now the source code also which adds to my metered time on net. The documentation for these two dlls is large due to examples which are necessary to get an idea as to what it does. I have to find a solution for it which does not force an user to be on net.
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 2nd June 2005, 05:32   #36  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,182
So, now the most of rest fingers is my ...
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 2nd June 2005, 20:32   #37  |  Link
Wilbert
Super Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,390
Quote:
Well I reduced those number of fingers. I just posted the FanFilter, Reform and Grid plugins along with the Source codes.
Great! I really appreciate it.

Quote:
As most of the plugins did not carry the src tag I thought they do not have the source code. That was my mistake.

About EffectsMany and TransAll the source code is large and I find that each time I update a small bit of a function code, I need to not only upload the full dll and documentation, now the source code also which adds to my metered time on net. The documentation for these two dlls is large due to examples which are necessary to get an idea as to what it does. I have to find a solution for it which does not force an user to be on net.
Why don't you put the source in a separate file? Btw, how large and what format are your pics in the help docs?
Wilbert is offline   Reply With Quote
Old 3rd June 2005, 04:01   #38  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 916
Quote:
Originally Posted by Wilbert
Why don't you put the source in a separate file? Btw, how large and what format are your pics in the help docs?
Yes I have yesterday put the sources of TransAll and EffectsMany into seperate zip files and will post these files seperately. I may update them only occassionally.

The examples are jpeg format. I resized them to about 250 X 200 but I lose some detail. For each of a transition function I need 3 or 4 of such pics. There are over 25 functions. In EffectsMany Plugin I have about 30 functions.
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 3rd June 2005, 05:29   #39  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,182
vcmohan,
I think you must create your own simple website (webpages).
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Reply


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 18:35.


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