View Full Version : How to filter out vertical lines in video?
screw
19th April 2005, 08:31
I would like to remove some some vertical lines in video source.
They are different from film scratches, but anyway I tried Fizick's
DeScratch with no success - I even got picture worse.
Any suggestions?
There is an example of video file screenshot:
vcmohan
21st April 2005, 04:08
There are just two bands on the right hand side of the image. Any filter to remove these lines will unnecessarily effect the rest of the clean image. If I had to remove this noise then I will crop the image into two parts, filter the Right part with my plugin FanFilter (see the thread on removing diagonal bars in this Avisynth usage forum). Use stackhorizontal to get back full image.
I could remove the noise using the Newer VFanFilter. (This plugin will be available shortly)
There are 3 or 4 strong spots still seen. Possibly they can be removed with other filters, which some one else may advise you.
The unprocessed and processed Right Side image stacked is as below:
http://img94.echo.cx/img94/189/fanscreen08if.jpg (http://www.imageshack.us)
Possibly experimenting with VfanPass I can remove the noise. I will need some time to do that. Because of the very high values in the noise blurring is seen in the image. I will revisit this page after I conclude my tests.
screw
21st April 2005, 13:50
Thanks, I'll try your filter. BTW, I got also some positive results using Fizick's DeSpot instead DeScratch, but your filter seems doing it better.
Screw
vcmohan
22nd April 2005, 03:42
I now used my newer function VFanPass, which will be released shortly.
The result of processing with it is as below:
http://img251.echo.cx/img251/9738/fanpassscreen00dj.jpg (http://www.imageshack.us)
screw
22nd April 2005, 10:25
Looks very impressive. When your filter will be available?
And did you use just that new VfanPass filter or both VfanPass and VfanFilter?
Screw
vcmohan
23rd April 2005, 04:02
My target date for release is end of this month failing which my 71st birthday i.e. may 14. I am testing it under various situations and also trying to document properly.
I have just used crop, VFanPass and stack horizontal to get image properly. Crop had to be used as you have vertical alignment image features on the left side which I did not want them to get affected.
vcmohan
3rd May 2005, 04:31
yes. The revised FanFilter plugin is now available for free download at www.avisynth.org/warpenterprises I have kept my schedule.
Thanks, I shall try it.
Screw
kingmob
3rd May 2005, 11:01
are thse vertical lines static? Because that would make the problem quite a bit easier i'd guess.
For instance make a mask and overlay a blurred version.
To kingmob
No, those lines are dynamically changing and jittering along horizontal axis.
To vcmohan
I did try your filter. Yes, the lines are gone after, but the downside is that picture becomes very blurry. In attachment there is a screenshot - on the left side picture is unfiltered, on the right - filtered and blurry (120 pixels from the right side). Is there any workaround to make it sharp?
Screw
vcmohan
5th May 2005, 04:38
This type of noise is recognised by its character along width axis. Many vertical alignments will have similar charecteristics and so will be affected. In case of this filter try using the least possible lambda and for fanpass largest possible threshold.
The very reason I had to crop and stackhorizontal at the end was not to affect the vertical alignments seen at the left part of the image. I will think about and and see whether any other descriminants can be used. I think posiibly yes and shortly will introduce other factors in the plugin.
Well, my attachment is not approved yet, so you can not see it. Visually it seems that lines are smeared in horizontal direction.
Anyway, thanks, and I am waiting for some possible improvements in your filter.
Screw
kingmob
5th May 2005, 17:04
If they are not static, but always white, then my solution might still work. I would not know how to build a complex script that would detect if something is white and a line, but at least converting everything that's white to a mask is easy with masktools.
So you could try converting everything above a certain luma level to full white and everything below to full black. Then convolve this mask a bit to blur the edges and then use it to overlay a version of the frame which is filtered in such a way that the lines are gone.
This would cut down the anomalies i think.
To kingmob
Well, it might work, but since I am not so clever in mask usage, can you give some sample script? As you see above I can get two pictures - one is original, another filtered with VFanPass and lines are gone, but remaining is blurry. So if it would be possible to overlay filtered one over the original just for the places where lines are, it would be nice.
Script sample how to do such actions would be great.
And about your question - those lines are not always white, but for sure they are much lighter than rest of the area.
Screw
Well, I did some more tests with attempt to use masks, and got some progress. Now the picture is much sharper, since filtered and blurred is overlayed to original just in area, selected by mask. And the criteria was to apply it just to most light parts of noisy area, since those lines are much lighter than surrounding area. I used the following script:
---------------------------------------------------------
function FilterRight (clip clp)
{
Crop_right = clp.Crop (600,0,120,576)
left_good = clp.Crop (0,0,600,576)
mask = Crop_right.Binarize(150,upper=true).invert()
mask = mask.levels(10,1,40,0,255).greyscale().blur(1)
right_bad = VFanPass(Crop_right,25203,36969,8,false,4)
fixed_right = maskedmerge(Crop_right, right_bad, mask, y=3, u=1, v=1)
glued = StackHorizontal (left_good, fixed_right)
Return glued
}
----------------------------------------------------------
It was used only to that range of frames, where this noise exists.
Result is better, only problem is that mask is built selecting light parts of the picture, it means white areas are included. So there is the same blurring on the white areas. The rest of picture is acceptable.
Mask usage is just copied from some example here on forum, so it might be non-optimal. Any suggestions to improve that will be appeciated.
Screw
kingmob
7th May 2005, 09:34
You could tweak the binarize function. i'd use it on an already greyscaled image. But i think 150 is probably too low a value. and setting upper=false will prevent the need to invert.
Tot test you can interleave or stack the mask and the image and in that way tweak it to it's best value.
Also, i think you need to use u=3 and v=3 on maskedmerge.
I'm not sure why the levels are there?
Well, just Binarize gave me some yellow tones, but after that line:
mask = mask.levels(10,1,40,0,255).greyscale().blur(1)
I got nice BW (actually greyscale) image, but Levels are there because they were there in the original script - I just left it as is. As I did mention, I do not know much about mask usage - this is my first attempt.
As I understood from MaskMerge description, command is using original picture, if mask is blask and overlay picture if white. If mask value is someting in between 0 - 255, it is used as multiplier to original, so to have full replacement of scratches in original, mask have to me all white for those places, but I did notice also greytones. Is there a way to make mask just BW (binary)? Actually I thought that Binarize is doing that, but than I was confused by the presence of some tones in mask after testing Binarize command.
Well, regarding 150 - I did try higher values, but than correction was done just on really white places of lines - as I already mentioned, lines are not exactly white, they are just lighter than surrounding area. If there is a way to build a mask for areas, which are lighter than neighboring area, it might work better.
BTW, I did try to use also EdgeMask and DEdgeMask, but results were worse, since egdes of the objects were touched by filtering, making them blurry.
Screw
vcmohan
9th May 2005, 03:32
I have developed a new function VLineFilter with a different discrimination criteria. It works well but since all whites are treated similar some parts of white are affected. This new function has also windowing and moving window linearlrly with frames facility built in. Once I complete tests I will update FanFilter.
Results of VLineFilter are on right.
http://img158.echo.cx/img158/5716/vertstreaks09yb.jpg (http://www.imageshack.us)
There is no blurring. Also if noise is white darker lines of image can be protected.And vice versa. In this example I have not used windowing so the filter is acting on full image. Spurious effects on white parts of the figure are seen.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.