View Full Version : removing vertical lines (banding-like)?
patrick_
3rd August 2011, 20:22
http://img810.imageshack.us/img810/1091/shote.png
As you can see in the screenshot, the video has 2px wide vertical lines. Those lines are static, so temporal filtering is useless.
Right now I'm creating an edge mask to protect the drawing and remove the lines with removegrain and deen. It works OK, but the edge mask doesn't protect low-contrast details (When it does, it detects these vertical lines as edges as well).
Any suggestion about what filter can remove those lines?
*.mp4 guy
5th August 2011, 19:51
chroma = last
FIR = Mt_Convolution(Horizontal=" 48 64 96 64 48 ", vertical ="1", u=-128, v=-128)
Diff = Mt_Makediff(Last, FIR)
THR=string("192")
MedianDiff = MT_Luts(Diff, Diff, mode="med", pixels = " 0 0 1 0 2 0 -1 0 -2 0 " ,\
expr = " X Y - X Y - X Y - abs 1 + * X Y - abs 1 + "+THR+" 1 >= "+THR+" 0.5 ^ "+THR+" ? + / - 128 +", u=1,v=1)\
.fft3dfilter(bw=2, bh=16, ow=1, oh=8, bt=1, sigma=16, sigma2=0.75, sigma3=16, sigma4=16, plane=0)
ReconstructedMedian = mt_makediff(Diff, MedianDiff)
Mt_AddDiff(FIR, ReconstructedMedian)
mergechroma(last, chroma, 1)
I cant do any real testing without a proper sample, but that worked on image the you posted (http://www.imagebam.com/image/257124143652194).
Your problem is oddly identical to the one in this thread (http://forum.doom9.org/showthread.php?t=154863).
patrick_
3rd September 2011, 11:13
Thanks. Your suggestions removed a lot more details than deen, but combining deen with a much softer version of your script (and without the ffd3d part) did a great job.
*.mp4 guy
4th September 2011, 01:12
I'm afraid you are mistaken. You appear to assume that you know how the posted script works, and have convinced yourself that you can improve it. fft3dfilter as it is used in the script I posted increases detail retention. I repeat, fft2d is being used to make the output sharper. Furthermore the assertion that deen would outperform this script is extremely unlikely, as deen is a simple thresholded blur. Additionally the image I posted corresponds to a slightly blurrier version of the script in my post, never the less I do not believe any usage of deen could outperform it.
If I am somehow wrong in my analysis I apologize, and I would very much like to see a representative example and complete scripts representing the case where deen usage is preferable to the aforementioned script fragment.
patrick_
4th September 2011, 11:04
You're wrong ;) I tested modifying the values, and nothing came close to the deen result. After that, I dediced to combine it with deen. Using trial and error, I reached the conclusion that without FFT3D results look better. If FFT3D was supposed to preserve details, it failed completely, because your script doesn't even preserve the room corners (which are high-contrast lines). It's not that I have "convinced myself". If the results with the modified script are better, than the script has been improved. It this case "better" doesn't mean that it removes more stripes, but I prefer to keep some stripes and much more details.
source = last
mask = mt_edge(thY1=30,mode="prewitt").RemoveGrain(mode=4)
filtered = last.RemoveGrain(mode=2).Deen("a3d",1,7,1,30)
mt_merge(filtered, source, mask)
mask = mt_edge(thY1=30,mode="prewitt").RemoveGrain(mode=4)
chroma = last
FIR = Mt_Convolution(Horizontal=" 48 64 96 64 48 ", vertical ="1", u=-128, v=-128)
Diff = Mt_Makediff(Last, FIR)
THR=string("4")
MedianDiff = MT_Luts(Diff, Diff, mode="med", pixels = " 0 0 1 0 2 0 -1 0 -2 0 " ,\
expr = " X Y - X Y - X Y - abs 1 + * X Y - abs 1 + "+THR+" 1 >= "+THR+" 0.5 ^ "+THR+" ? + / - 128 +", u=1,v=1)
ReconstructedMedian = mt_makediff(Diff, MedianDiff)
filtered = Mt_AddDiff(FIR, ReconstructedMedian).mergechroma(chroma, 1)
source
mt_merge(filtered, source, mask)
Keep in mind that the source video has previously been bobbed (50fps), cleaned with NeatVideo, and SRestored (23,976fps)
http://screenshotcomparison.com/comparison/78159
*.mp4 guy
12th September 2011, 20:01
You haven't provided a control example, I have no way to know what is going on, furthermore you are doing pre and post processing that may or may not be relevant.
Your post does not answer my questions, or give me the data I need to answer them myself, all it does is reassert your original statement. This is annoying.
I do not have the spare time or patience that I used to for this sort of thing. However, If you have any interest in figuring out what is at issue here, and perhaps getting better results from that understanding; I will take a look at an untouched source sample should you choose to provide one, when I have the time.
mandarinka
12th September 2011, 23:37
I had some success on an issue looking like this (also anime but the lines were horizontal, see here: http://screenshotcomparison.com/comparison/53026). FFT3Dfilter set to use a pattern was able to remove the lines almost absolutely (traces remained in some high motion shots iirc). The downside of the approach is that you must find a frame with as flat background as possible (possibly a black screen in credits roll if there is such, and it is affected, however I think I used a normal scene from the footage) and a section, in which the artifacting is very pronounced. There must not be any detail or line/edge in the block you will use as a sample for FFT3Dfilter, otherwise you'll get *nasty* results.
The line I used (result of trial&error, more or less):
fft3dfilter(plane=0,pfactor =1,pcutoff=0.04,pshow=false,pframe=63205,px=29,py=13)
You'll have to find the right pframe (use pshow=true for search) and px/py Ourself of course. The blocks are overlapped so it's not trivial (also I think there is a bug/misbehavior where the chroma block is taken from a different coordinates, because of lower chroma resolution; also if your coordinates point outside of the frame, fft3dfilter will error out; for those reasons it's better to limit filtering to luma only, see "plane=0").
Hope this helps you too...
PS. Looking at your sample image, maybe something like the shirt (pullover?) of the boy on left could be used for the sample block.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.