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. |
|
|
Thread Tools | Search this Thread | Display Modes |
3rd June 2010, 00:09 | #22 | Link |
Registered User
Join Date: Sep 2007
Posts: 5,377
|
*.mp4 guy - very impressive. I can't remember a better example of targetting noise virtually perfectly
I would love to learn how you approached this and about the functions used, but they are beyond my level of knowledge of avisynth. I can read all the documentation until my face turns blue, but that doesn't tell me how to use it properly |
3rd June 2010, 03:28 | #23 | Link | ||
Registered User
Join Date: Feb 2004
Posts: 1,348
|
Quote:
Quote:
Thinking about how badly denoisers worked on this source, I added fft3d to the mix, using it to remove detail from the noise pattern isolated by the median filter, before subtracting said pattern from the blur-difference clip. I set up fft3d with low block width (low ability to target the pattern) and normal block height, then I set it to be spatial only, and tried to find which sigmas would correspond to the pattern, in this case it was sigma2, then I found the maximum value of sigma2 that wouldn't touch the pattern, then I set all the other sigmas very high, to maximise detail removal from the pattern (detail recovery). If that sounds complicated (IE, poorly explained), it wasn't (complicated) It was just a few random ideas of how to apply stuff I already knew well, and a bit of trial and error refinement until it worked. Hopefully this was helpful (I doubt it) and doesn't make me look like a pompous idiot, but you did asked (unless you didn't). |
||
3rd June 2010, 13:48 | #25 | Link | |
Registered User
Join Date: Sep 2007
Posts: 5,377
|
Quote:
Anyways, thanks for trying to clarify, and nice job *.mp4 guy. |
|
4th June 2010, 02:09 | #26 | Link | |
Registered User
Join Date: Feb 2004
Posts: 1,348
|
Quote:
2 - Check 3 - Go to 1 3 4 6 4 3 Used filter (original was multiplied by 16 for easy modification) 1 4 6 4 1 gaussian 0 1 1 1 0 box radius 1 2 2 3 2 2 box radius 1.5 1 1 1 1 1 box radius 2 After a while it gets easier to think of what a filter will look like, which makes the process faster, but it really is just guessing and checking. Sometimes I will use a program to generate arbitrary lowpass filter coefficients, but that is mostly a convenience thing. If you want to know how to make FIR filters, spend some time fiddling with mt_convolution until you start to understand what does what. |
|
5th June 2010, 09:33 | #27 | Link |
Registered User
Join Date: Mar 2008
Posts: 118
|
And thus the age of mass targeted filter creation begins. (Ridiculous job, *.mp4 guy.)
Someone should write a GeneticConvolution program that generates FIR filters, gets the user to evaluate them for fitness, and iteratively improves them. |
11th June 2010, 01:06 | #29 | Link |
Registered User
Join Date: Oct 2007
Location: Forest of the Trufulas
Posts: 37
|
I'll second the request for a function, but I'll go out on a limb and say this was probably a specific fix for a specific problem, and thus isn't a good candidate for a function. Hope I'm wrong.
Congrats to *.mp4 guy for a job well done. (The "corduroy" forehead in post #1 reminds me of my cable reception, hence the vote for a function. ) |
14th June 2010, 01:49 | #31 | Link |
Registered User
Join Date: Feb 2004
Posts: 1,348
|
Code:
function DeStripe(Clip C, int "rad", int "offset", int "thr") { rad = Default(rad, 2) offset = Default(offset, 0) thr_ = Default(thr, 256) Blurred = Rad == 1 ? C.Mt_Convolution(Horizontal=" 1 1 1 ", vertical = " 1 ", u=1, v=1) : C Blurred = Rad == 2 ? offset == 0 ? C.Mt_Convolution(Horizontal=" 1 1 1 1 1 ", vertical = " 1 ", u=1, v=1) : C.Mt_Convolution(Horizontal=" 1 0 1 0 1 ", vertical = " 1 ", u=1, v=1) : Blurred Blurred = Rad == 3 ? offset == 0 ? C.Mt_Convolution(Horizontal=" 1 1 1 1 1 1 1 ", vertical = " 1 ", u=1, v=1) : offset == 1 ? C.Mt_Convolution(Horizontal=" 1 1 0 1 0 1 1 ", vertical = " 1 ", u=1, v=1) : C.Mt_Convolution(Horizontal=" 1 0 0 1 0 0 1 ", vertical = " 1 ", u=1, v=1) : Blurred Blurred = Rad == 4 ? offset == 0 ? C.Mt_Convolution(Horizontal=" 1 1 1 1 1 1 1 1 1 ", vertical = " 1 ", u=1, v=1) : offset == 1 ? C.Mt_Convolution(Horizontal=" 1 1 1 0 1 0 1 1 1 ", vertical = " 1 ", u=1, v=1) : offset == 2 ? C.Mt_Convolution(Horizontal=" 1 1 0 0 1 0 0 1 1 ", vertical = " 1 ", u=1, v=1) : C.Mt_Convolution(Horizontal=" 1 0 0 0 1 0 0 0 1 ", vertical = " 1 ", u=1, v=1) : Blurred Blurred = Rad == 5 ? offset == 0 ? C.Mt_Convolution(Horizontal=" 1 1 1 1 1 1 1 1 1 1 1 ", vertical = " 1 ", u=1, v=1) : offset == 1 ? C.Mt_Convolution(Horizontal=" 1 1 1 1 0 1 0 1 1 1 1 ", vertical = " 1 ", u=1, v=1) : offset == 2 ? C.Mt_Convolution(Horizontal=" 1 1 1 0 0 1 0 0 1 1 1 ", vertical = " 1 ", u=1, v=1) : offset == 3 ? C.Mt_Convolution(Horizontal=" 1 1 0 0 0 1 0 0 0 1 1 ", vertical = " 1 ", u=1, v=1) : C.Mt_Convolution(Horizontal=" 1 0 0 0 0 1 0 0 0 0 1 ", vertical = " 1 ", u=1, v=1) : Blurred Diff = Mt_Makediff(C, Blurred) THR=string(thr_) MedianDiff = Rad == 1 ? MT_Luts(Diff, Diff, mode="med", pixels = " 0 0 1 0 -1 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) : Diff MedianDiff = Rad == 2 ? offset == 0 ? MT_Luts(Diff, Diff, mode="med", pixels = " 0 0 1 0 -1 0 2 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) : MT_Luts(Diff, Diff, mode="med", pixels = " 0 0 2 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) : MedianDiff MedianDiff = Rad == 3 ? offset == 0 ? MT_Luts(Diff, Diff, mode="med", pixels = " 0 0 1 0 -1 0 2 0 -2 0 3 0 -3 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) : offset == 1 ? MT_Luts(Diff, Diff, mode="med", pixels = " 0 0 2 0 -2 0 3 0 -3 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) : MT_Luts(Diff, Diff, mode="med", pixels = " 0 0 3 0 -3 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) : MedianDiff MedianDiff = Rad == 4 ? offset == 0 ? MT_Luts(Diff, Diff, mode="med", pixels = " 0 0 1 0 -1 0 2 0 -2 0 3 0 -3 0 4 0 -4 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) : offset == 1 ? MT_Luts(Diff, Diff, mode="med", pixels = " 0 0 2 0 -2 0 3 0 -3 0 4 0 -4 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) : offset == 2 ? MT_Luts(Diff, Diff, mode="med", pixels = " 0 0 3 0 -3 0 4 0 -4 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) : MT_Luts(Diff, Diff, mode="med", pixels = " 0 0 4 0 -4 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) : MedianDiff MedianDiff = Rad == 5 ? offset == 0 ? MT_Luts(Diff, Diff, mode="med", pixels = " 0 0 1 0 -1 0 2 0 -2 0 3 0 -3 0 4 0 -4 0 5 0 -5 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) : offset == 1 ? MT_Luts(Diff, Diff, mode="med", pixels = " 0 0 2 0 -2 0 3 0 -3 0 4 0 -4 0 5 0 -5 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) : offset == 2 ? MT_Luts(Diff, Diff, mode="med", pixels = " 0 0 3 0 -3 0 4 0 -4 0 5 0 -5 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) : offset == 3 ? MT_Luts(Diff, Diff, mode="med", pixels = " 0 0 4 0 -4 0 5 0 -5 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) : MT_Luts(Diff, Diff, mode="med", pixels = " 0 0 5 0 -5 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) : MedianDiff ReconstructedMedian = mt_makediff(Diff, MedianDiff) Mt_AddDiff(Blurred, ReconstructedMedian) Return(Mergechroma(Last, C, 1)) } Don't ask me if it works, I didn't have much information to work with. thr is strength, rad is "how big are the (whatevers)" offset is "how far apart are they" rad goes from 1 to 5, offset from 1 to 4, thr from 1 to bignumber. Also its generic and therefore not very good. |
16th June 2010, 22:23 | #32 | Link |
Registered User
Join Date: Apr 2006
Posts: 299
|
I tested your script on the image by the original poster. Seperation is'nt as strong as your custom coefficients but still better detail and seperation than the other "contest entries" in this thread.
I'm excited about this filter cause I've been looking for an avisynth filter for periodic noise like in scans of magazine prints and photos with honeycomb textures. I love how avisynth gurus on this board find clever solutions that work with well with compressed 8-bit sources where professional photo software ends up emphasizing the limits of the original. A bug: Seems to cut off the image after 320 horizontal pixels. EDIT: Cutting off was related to something else, please ignore my bug report. Last edited by markanini; 18th June 2010 at 11:19. |
Tags |
corduroy, ridge |
|
|