View Full Version : DeFreq plugin - Interference frequency remover
Fizick
25th January 2005, 21:48
EpheMeroN,
I wonder why you interpret the filter manual by so strange way :)
Really, the angle (slope) of stripes is defined by (but not equal to) the fy/fx ratio.
(by cotangent).
The stripes period is defined by inverse absolute length of (fx,fy) vector, i.e. period is about 100/sqrt(fx*fx+fy*fy).
So, if your stripes is near vertical, set small fy<fx.
You must try and watch stripes in show mode).
"Thickness" the noise is controlled by dx, dy parameters.
BTW, it will be great if somebody (not me) write a short article about Defreq to Analog Capture Guide.
Wilbert
25th January 2005, 21:56
BTW, it will be great if somebody (not me) write a short article about Defreq to Analog Capture Guide.
We will some day (in version 4.3 I think ...) :)
EpheMeroN
26th January 2005, 02:40
Mind putting that in Laman's Terms w/ a sample to get me started?
somail
17th March 2005, 09:37
So basically the idea is to get the Stripes (upper right window when show=true )to match the actual interference that you see in the video. To do this you adjust the x,y and place the search window over hot spots untill the right pattern/slope shows in the upper right hand window. Then make show=false, info=false and encode.
Is this correct?
Fizick
17th March 2005, 20:47
Yes,
and you must see some peak (light) near search window center in show mode.
Morpheus_xx
4th April 2005, 15:42
@Fizick:
DeFreq looks very promising to me. Can it help with this problem?
http://forum.doom9.org/showthread.php?s=&threadid=92478
Greetinx
Morpheus
Mug Funky
7th April 2005, 08:59
yay! thread resurrection!
i was watching a particularly bad source on "blue only" mode, and realised that rainbows could be described as a specific frequency of interference that exists only on edges and mainly on the chroma channels (though in bad cases, like the Fawlty Towers DVDs, it spreads to the luma and borks diagonal edges).
so:
could it be possible to use DeFreq with (or without) some masking to nicely get rid of rainbows?
i'll grab a high-bitrate NTSC sample as soon as i finish the current encode i'm on... don't know when i'll be able to host it though (when i get home?).
i thought i'd post here rather than spend all night on it myself because i figured Fizick would know best how to configure his plugin for the desired effect (i find configuring DeFreq rather like playing the theremin with tongs, while wearing earplugs).
[edit]
btw, don't you believe it they say Project A-Ko was digitally remastered... all it is is the old shitty source with a smidge of denoising and some colour correction. grrrrr.
Hi Fizick,
because I know that you enjoy happy and thankful users so much ... I'd like to forward thanks of another user of the german board, who successfully enhanced his captures using DeFreq:
http://forum.gleitz.info/showpost.php?p=195848&postcount=7
This thread contains some before/after pictures; although they don't show exactly the same frame, they still show the success clearly.
Fizick
10th May 2005, 22:51
Thanks for info!
vcmohan
11th May 2005, 04:54
I think that the type of noise shown in Ephemeron can be effectively removed by fanfilter (http://www.avisynth.org/warpenterprises) plugin and is being discussed in seperate threads of How to remove diagonal bars etc.
hartford
19th May 2005, 04:10
I must thank you for your filter, ie "fanfilter."
I used it after applying DeFreq and it performed well.
I'm not disparaging Fizick's filter. I simply found that
your filter AFTER Fizick's filter gave me the result for which I searched.
loba
27th June 2005, 19:18
Sorry if I'm asking a question in a wrong place, but how to interpret this spectrum surface?
I know that FFT computes sin (or cos) components (amplitude, frequency, phase) of a continuous signal, but cannot interpret the spectrum image that DeFreq shows. In this case what is the signal: separate lines, or the whole datastream (luma, chroma?), what is the x-axiys and y-axis, and the intensity value of the spectrum?
I tried to play with this filter, but cannot get any result. I cannot use what I cannot understand:) Ok, I could live without the math of this FFT thing if I would know what to look for. I know that I should look for peaks in the spectrum, but I have several, are there "good" and "bad" peaks? I also see that I could just use the stripes showing on the right, but should I align the white or the black bars to the noise? I cannot seem to control the width of these bars differently (I have a clip where there are thin vertical noise bars).
Please, provide some hints for a less educated one. Thanks in advance.
Fizick
27th June 2005, 20:25
I am not a teacher, but plugin writer :)
So, please use some book or article.
Shortly, defreq use not 1D, but 2D transform. X and Y are dimension (frequency).
Only spectrum amplitide is shown as image intensity.
trevlac
28th June 2005, 02:53
@loba,
I've never used Fizick's wonderful filter. I really only use digital source. However, I felt compelled to respond. :) This stuff has been a topic of interest for me.
Unfortunately ... the interference pattern is not self evident to the filter. So Fizick has provided 3 ways to help identify the place in the frequency spectrum that contains the noise.
A quick guide to frequency analysis: It's just like the audio spectrum you see on an audio equalizer. Audio breaks up the highs and lows. Video breaks up the sharp details and the smooth planes.
Way #1: Frequency image
Audio is shown in 2D as frequency of bar and height of bar. Video is in 3D. X & Y show the orientation and wave length of the frequency (Think of an X,Y graph. If Y is zero and you move across the X's, you are covering the horizontal frequencies where the vertical ones are zero. If you go to a spot where X and Y are not zero, you are talking about a frequency that runs at a diagional angle.) Unfortunately .... the the frequency image is hard to read, especially if you want to know the exact frequency in question (like 3MHz). The 'zero points' are the top left and bottom left.
I believe the top half of the image may represent frequencies (stripes) that go from bottom left to top right. The bottom half represents stripes that go from top left to bottom right (like Fizick's example).
Way #2: Bright spots in the image
The 3D part of the image spectrum analysis is that the brightness of the spots represent the amount of the given frequency in the image. Picture the image 'from the side'. I would look like a 3D mountain range. The bright spots are the highest peaks and a good candidate for a repeating pattern in the regular image.
Trial and error on blocking out the spots is a good way to narrow down. You can also try some big windows to see if you are even looking in the right area.
Way #3: Sample stripes
The angle (orientation) and thickness of the stripes matter. What is black and what is white do not. These are a great way to see if you are close. The stripes are not a 'frequency image', but a regular image of the chosen frequencies. Their black/white starting point doesn't matter because that is actually not a factor of their frequency, but a factor of their phase.
Hope I got it at least reasonably correct .... :)
hartford
28th June 2005, 03:13
My silly take on this filter.
There are infinite numbers that represent 45 degrees. What is the width of 45 degrees? That is the problem.
If the interference is 45 degrees the "width" is generally unknown. That is where "ratios" take effect, and that is what is the difficulty in applying this filter.
If I can see that the the interference is at a particular "angle" but I don't know the "thickness" then I must do trial and error. It would help if there was some way to determine the "thickness."
Sounds silly, but that's my experience.
trevlac
28th June 2005, 18:23
hartford
If you know the interference is 45% and which way it runs ... bottom left to top right for example ... there are actually not too many spots to look. If the 'width' of the interference is a 1 pixel wide line, this coresponds to some frequency at the right edge of the image. If the 'width' is so wide that it covers the entire image, the frequency is at the left edge. The width of the interference bars is related to the spot in the frequency image by imgWidth/2 - barWidth. Count over that many pixels and that is where your frequency is. Um ... at the angel you are looking for.
-------
Anyway ... I've been playing with this stuff a little, and I made a virtualdub filter that might help. Might not.
Load your video and the filter. Click the db (log) radio button, and the 'All' button options. Then click show preview. This will show a frequency image much like Fizick's. You can draw little squares (with your mouse) on the right half of the preview window. This will mask out little bits of frequency. Toggle back and forth between the "Filtered Image" and "Frequency Image" radio buttons to see if you have the right spot.
BUT there are a number of differences in my image vs Fizicks. Mine is twice as wide and duplicated across the center. So ignore the left side of mine. Mine is also oriented where the upper left and lower left corners of Fizick's image are flipped to the center.
http://www.trevlac.us/pics/Orientation.GIF
This may help find the right spots. I hope it does not cause more confusion.
My 'experimental' filter can be had here.
http://www.trevlac.us/FilterDocs/Filters.htm
Fizick
28th June 2005, 18:30
Trevlac,
good guide!
Hartford,
There are infinite numbers that represent ANY angle (not only 45 degrees).
Yes, if you found approriate fx,fy values to represent right angle (as shown),
then you must change BOTH fx, fy (with constant ratio) to set approroate "width" (step).
I do not want change this.
But you can use some script variables. It is not very advanced math, similar to:
frx=30
ratio=-1.5
fry=frx*ratio
defreq(clip, fx=frx,fy=fry)
Anyway ... I've been playing with this stuff a little, and I made a virtualdub filter that might help. Might not.
trevlac,
Great work! I almost understood this whole thing from your webpage. But what's more important, I was able to get some interesting result with your Virtualdub filter (removing vertical bars) using the horizontal lowpass option. Now I wonder if such an option exists in Fizick's DeFreq plugin (for using Avisynth only) or should I remove those bars in Virtualdub and make other filtering in Avisynth... I see that there are cutx and cuty parameters, but there is no option for slope (this parameter did the trick in trevlac's filter, using low freq and a moderate slope). Maybe next version? :)
bdfy
12th July 2005, 21:53
help file seems to be a bit complicated for niewb :(
I played with the parametres , but never got proper results :(
Here is a screenshot from avi-source I want to process
see attachment (80kb)
What parameters should I try ? I wonder if you can give advice using screen...
LigH
12th July 2005, 21:57
Only get an error page.
Why don't you attach the image directly to this thread?
Fizick
13th July 2005, 16:14
bdfy,
Please re-read all this thread.
bdfy
13th July 2005, 20:08
Fizick
Still lots of quastions...
I need to estimate angle,width of stripes and "strengh" of processing. Right ?
Angle:
the angle (slope) of stripes is defined by (but not equal to) the fy/fx ratio.
(by cotangent).
Width:then you must change BOTH fx, fy (with constant ratio) to set approroate "width" (step)...
OK, math is simple , but what is the units for width ? pixels, mm ?
Or the only way to find out the right value is to look at upper right window ( compating with lower one ) using info,show parameters. It's hard enough, but it's accomplishable.
But I still have no idea what plugin shows with Defreq(show=true,info=true) parameters :( How to use this info ?
"Thickness" the noise is controlled by dx, dy parameters.
Is this some kind of processing "strengh" ?
It would be great if you answer in russian here ;)
http://forum.ixbt.com/0029/009331-31.html
Fizick
13th July 2005, 20:35
1. А читал ли ты русскую документацию?
(do you read the russian documentation?)
2. Prease read Trevlac's description.
2. Make some attempts, and you got the right answer yourself. ;)
bdfy
13th July 2005, 21:31
I know, RTFM is always suitable answer :) - Yes, I read all the docs provided with the archieve and this topic from the very beginning. And I still have a lot of questions :(
I believe, you made a great filter , but its help IMO is awfull - there's no easy to understand instruction how to use it. I'm not the first and seems to be not the last man asking simple questions about filter's usage ;) I suppose it would be great to
provide a good tutorial for users in order to avoid oft-recurring questions. Just a quick tute with common example. Just any screenshot and explain how to choose suitable parameters for such a source.
PS : no sense ( i.e fonts :)) to post here in russian
Fizick
13th July 2005, 23:50
I am not a teacher, but plugin writer :)
Sorry, i have no time.
When you learned to use Defreq, please write a tutorial and post here.
bdfy
14th July 2005, 00:00
OK, thus I ask anyone who has enough time and experience with this filter :
TUTORIAL NEEDED!
Fizick
14th July 2005, 05:15
Here is the good tutorial:
http://forum.doom9.org/showthread.php?p=679006#post679006
lumier
31st July 2005, 04:58
Hello Fizick,
I am really impressed with your great filter, it works very well for a lot of my (Hauppauge PVR-150 based) broadcast captures :thanks: .
I do a lot of captures and I have noticed that the intereference frequencies change enough in between captures that I have to figure out new input parameters for defreq every time.
Now you have given us an easy, graphical way to figure these parameters out (defeqs output for show=true) , though I guess that many people might not fully understand how to use it right (took me some time to get used to ...).
E.g. I see people at the beginning of the thread share their input parameters for defreq. This only makes limited sense, because the parameters they give work only for their specific broadcast signal (e.g. the show they recorded) and the noise it contains. As I wrote above I find that for my own captures (TV cable) the interference frequencies (and therefore defreq input parameters) shift dramatically with time and channel!
In this way, defreq works very differently from many other AviSynth filters (e.g. needing very different parameters with every source). Because of this difference, I guess that quite a number of inexperienced users might not understand how to use defreq well.
Automating defreq could strongly improve this, making your filter more "newbie" friendly and thus - I am sure - even more popular.
Here is my idea how to do the automation:
A)
Have defreq run twice in two different modes. The first pass is used to determine the input parameters we currently pass to defreq "by hand" and to output these parameters to a file. The 2nd pass then reads the file and applies these parameters to the source material.
B)
In order to determine the parameters:
Use your defreq show output display (the grayish display showing the input picture transformed to frequency space) and sum the pixel value for each individual pixel in this display over time (e.g. all frames). Now we compare this sum value for each pixel with the sum value for pixels who are close to it. For a pixel that represents an interference frequency (e.g. defreqs needed input parameters would be a window around that pixel), we should find
(Sum Pixel)/(Sum Pixel_close) >> 1.
We could define a cutoff parameter so that when (Sum Pixel)/(Sum Pixel_close) >= parameter defeq assumes the pixel represents an interference frequency.
In other words: we recognize the interference frequencies via their time behavior - interference frequencies are "always on" and the integral over their amplitude over time must be much higher than surrounding amplitudes.
I am curios what you think ...
Fizick
31st July 2005, 12:39
lumier,
Your idea is great!
I say about temporal averering of frequency spectrum.
I am not shure, that fully authomatic parameters estimation will be possible,
but at lat we will see very sharp peak at interference frequency.
Probably we do not need in full clip first pass, but in some range only, about 20 frames. But these frames must be dynamic (not static) scene.
By the way, we can try this method right now, by temporal averaging with TemporalSmooth (with very high thresholds).
I will try implement your suggestions in new version later, after some discussion.
lumier
31st July 2005, 18:55
Your idea is great!
Glad to hear you're excited :)
Probably we do not need in full clip first pass, but in some range only, about 20 frames. But these frames must be dynamic (not static) scene.
Yes, I was thinking that too. Although I wonder about the amount of frames we want to use (dynamic scenes are a MUST). I have noticed that sometimes the interference frequencies seem to "pump" (e.g. come and fade) over the course of a second or so in the frequency space display - so 20 frames might be little bit on the low side.
Tests should help us out a lot here ...
By the way, we can try this method right now, by temporal averaging with TemporalSmooth (with very high thresholds).
Tell me more how you want to go about this.
Also, I noticed that I often find 3+ interference frequencies for my captures. Some of them are not so obvious in absolut amplitude strength (white dot sticking out very strongly in defreqs frequency space display), but when you compare these less obvious ones with their surroundig (pixels close by), they can be easily identified. For these cases we might need to define what we want to consider "close by".
I will try implement your suggestions in new version later, after some discussion.
I am thrilled to hear this.
Lumier
Fizick
31st July 2005, 20:55
Yes, 20 is probably is too small. 100 is better.
Try temporal averaging with TemporalSmooth:
defreq(show=true)
temporalsoften(100,255,255,255)
Fizick
3rd August 2005, 20:49
Version 0.6, August 2, 2005 - added temporal average mode show=2 (thanks to lumier for idea), changed show parameter to integer type; reorganized view of the spectrum window; cleaned a code.
lumier
4th August 2005, 19:29
That was really fast :thanks: ,
I'll try it out ASAP :).
frank10
7th September 2005, 10:06
I've read all the manual and this thread. I have still problem with this clip captured from VHS:
It seems to have this static interference (diagonal BottomLeft-TopRight) not on all the frame, particularly on the top (and so I don't see anything in the VD low-quarter):
http://img239.imageshack.us/img239/4144/interference05bx.th.jpg (http://img239.imageshack.us/my.php?image=interference05bx.jpg)
Looking at the spots I placed two windows, but the resulting pattern doesn't seems to match the original. The result is: nothing change.
In this case should I forgot the spots and try to reproduce the pattern I see in the original?
http://img359.imageshack.us/img359/2701/defreq00000ab.th.jpg (http://img359.imageshack.us/my.php?image=defreq00000ab.jpg)
I don't know what to do now. I tried also SeparateFields but the spots are in different places. Again nothing solves.
Help me please.
Fizick
7th September 2005, 19:57
frank10,
Yes, firstly forgot the spots and try approximately to reproduce the pattern you see in the original.
your current settings are too high. IMHO, your windows is near deinterlace artifactes now. Decrease used fx,fy values.
Then you will see nearest spot.
And always start with one window only.
Good luck! Happy defreqing :)
vcmohan
16th September 2005, 03:47
I checked the clouds image with FanFilter. It appears moire noise of high freq low intensity is present in the upper part, and low freq vertical bands left and right quarters of image. These I assume will be difficult to spot on an fft. On the image there are also horizontal streaks.
I tried the following after converting the image to YUY2 format
YUY=converttoYUY2()
VFan(yuy,0,1,"edge",6,gyplus=0,gyminus=0)
HFan(last,0,1,"edge",6,gyplus=0,gyminus=0)
Subtract(yuy,last).Levels(127,1,129,0,255)
using only one of the fan filters and both, the noise removed can be seen. There are also other problems with the image.
frank10
16th September 2005, 14:03
Thanks vcmohan: it worked with your fanfilter.
Very nice the subtract view.
I tried also these settings:
clip= loadClip...
VFan(clip,0,100000,"pass",4, gyplus=8 )
it seems better than edge because it has less hor 'shift' and blur: in this frame it is clearly visible because of the text-black (also the logo-white):
original frame with text:
http://img269.imageshack.us/img269/8281/fanfilterblacktext0zj.jpg
Could you explain more the gy plus-minus parameter?
It seems to be related to black-white point.
I added also an unsharp mask on fields and peachsmoother for noise.
At the end I have something like this:
SeparateFields ()
VFan(clip,0,100000,"pass",4, gyplus=8 )
HFan(last,0,100000,"edge",6,gyplus=0,gyminus=0)
odd=SelectOdd.UnsharpMask(strength=20, radius=3, threshold=10)
evn=SelectEven.UnsharpMask(strength=20, radius=3, threshold=10)
Interleave(evn,odd)
peachsmoother(NoiseReduction = 30, Stability = 40, Spatial = 250 )
weave()
CropBottom(8).AddBorders(0,4,0,4)
Is the filter order correct? Is Interleave necessary or not (at the end I have weave, so maybe it is redundant)?
There are also other problems with the image.
Maybe ring? or other more?
I would like to know more on this from experienced people like you because I'm learning filtering now... So any suggestions are welcome.
vcmohan
17th September 2005, 04:50
Glad that FanFilter helped you.
Could you explain more the gy plus-minus parameter?
These are thresholds used as plus or minus of the average values in the span. In one case this interval is allowed while in other its stopped. Edge tries to preserve edges, by splitting the span in 2 halves right and left and then filtering all values which are not within plus and minus of the individual halves mean values. Normally stop or pass gives a smoother or blurred image than edge. But since you used a smaller span you are not noticing it.
Maybe ring? or other more?
When I tried some stronger filter parameters I found strange color bands appear. It appears there is some problem in color as well.
As for usage of weave etc, I hope some experienced user answers you.
Fizick
17th September 2005, 21:21
please do not offtopic here :)
vcmohan
18th September 2005, 03:05
please do not offtopic here :)
Sorry for that. Since a question was asked I could not resist a reply
Poutnik
29th October 2005, 13:25
I have one very noisy TV capture with close to vertical interference.
I am going to try Fizick's script, mentioned at VaqueDenoiser doc, combined with DeFreq ( or VFan ) ....
LoadPlugin("vaguedenoiser.dll")
LoadPlugin("degrainmedian.dll")
avisource("input.avi")
aux=DeGrainMedian(mode=0, limity=7, interlaced=true)
VagueDenoiser(threshold=7, auxclip=aux, interlaced=true, wiener=true)
should I put DeFreq at the end ?
OR maybe aux=DeGrainMedian(mode=0, limity=7, interlaced=true).DeFreq(pars) ?
Poutnik
28th November 2005, 17:51
Another useless idea: Multiple 1D FFT ?
What about performing multiple 1D FFT for given limited set of either horizontal or vertical lines to calculate avg interference frequency and phase shift between lines?
Would it be possible to use it for non-GUI automatic interference remover like Defreq ?
Fizick
28th November 2005, 19:49
Of course NOT "aux=...".
Try use your first way or place defreq right after avisource.
Fizick
28th November 2005, 19:51
Multiple 1D fft I tried use for VHS jitter correction, but this plugin is not finished.
Poutnik
28th November 2005, 20:39
No time to finish or abandoned as bad idea in general ?
Fizick
28th November 2005, 22:39
Both.
results was not very good. algo must be improved. Arfefactes (curved lines).
Fizick
30th December 2005, 00:40
Use fx and fy parameters. And disable all other filters (temporary).
Ok after I get this I'll post in the DeFreq thread.
But can you please post an exact line that I insert? The fx and fy argument usage isn't clear to me. It isn't "show=fx,fy, info=fx,fy" so I'm unsure how I get the "show" and "info" lines to act on the x and y axes.
Try start with:
Defreq(fx=10, fy=10, show=1, info=true)
chipzoller
30th December 2005, 01:57
Ok I got that part, but I don't understand what you mean you say in your site:
"Firstly look to generated sample frequency stripes at the right top corner, and try make them similar to your picture interference pattern (right bottom area)."
Make the stripes similar to the picture interference pattern? I'm beginning to think this is way over my head.
EpheMeroN
25th April 2006, 18:36
I cannot get rid of these vertical lines. They start at the right and angle down towards the left. Please help. I can post sample video as well.
http://img242.imageshack.us/img242/9329/100004ts.th.jpg (http://img242.imageshack.us/my.php?image=100004ts.jpg) http://img242.imageshack.us/img242/240/200003me.th.jpg (http://img242.imageshack.us/my.php?image=200003me.jpg)
Fizick
29th April 2006, 06:30
A little update Defreq Version 0.7, April 28, 2006 - changed cleaning method: more frequencies are decreased near interference peak.
Chanded static linking of FFTW3.DLL library to dynamic loading.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.