Log in

View Full Version : denoising casual chat


feisty2
1st November 2015, 16:07
http://i.imgur.com/4pFNK2I.png
so I was thinking like, is it possible to get even better quality than BM3D (Block Matching) or NLMeans (Pixel Matching)
maybe just do a combo of both
like, NLMeans filters in time domain, and sure it treats high frequencies well cuz they are kinda sparse in time domain, and it's super destructive to low frequencies
and BM3D, does good stuff to low frequencies and kills high frequencies on the contrary, as it block matches in time domain BUT, filters in frequency domain, low frequencies are sparse in frequency domain so they are filtered right and well, and high frequencies are not that lucky...

so maybe, maybe combine the high frequencies from NLMeans and low frequencies from BM3D and it would be,
even better

demo:
source image
http://i.imgur.com/oFPwzSY.png

NLMeans

import vapoursynth as vs
core = vs.get_core()
clp = whatever..
clp = core.knlm.KNLMeansCL(clp, 0, 32, 4, h=2.4)
clp.set_output ()

http://i.imgur.com/Idkj3qP.png
low frequencies are screwed, see places boxed out with red rectangles

BM3D

import vapoursynth as vs
core = vs.get_core()
clp = whatever
ref = core.bm3d.Basic(clp, sigma=8, block_size=8, block_step=1, group_size=32, bm_range=24, bm_step=1)
clp = core.bm3d.Final(clp, ref, sigma=8, block_size=8, block_step=1, group_size=32, bm_range=24, bm_step=1)
clp.set_output ()

http://i.imgur.com/6FXO9UZ.png
high frequencies are fucked, also boxed out with red rectangles

NLMeans BM3D Combo

import vapoursynth as vs
core = vs.get_core()
clp = whatever

def gauss (src, p=30):
core = vs.get_core ()
upsmp = core.fmtc.resample (src, src.width * 2, src.height * 2, kernel="gauss", a1=100, fulls=True, fulld=True)
clip = core.fmtc.resample (upsmp, src.width, src.height, kernel="gauss", a1=p, fulls=True, fulld=True)
return clip

nlm = core.knlm.KNLMeansCL(clp, 0, 32, 4, h=2.4)
ref = core.bm3d.Basic(clp, sigma=8, block_size=8, block_step=1, group_size=32, bm_range=24, bm_step=1)
bm3 = core.bm3d.Final(clp, ref, sigma=8, block_size=8, block_step=1, group_size=32, bm_range=24, bm_step=1)
clp = core.std.MergeDiff (gauss (bm3, 16), core.std.MakeDiff(nlm,gauss (nlm,16)))
clp.set_output ()

http://i.imgur.com/IsZjl92.png
now you are practically enjoying advantages from both sides, (and suffering from computing complexity from both sides too..)

Bloax
1st November 2015, 20:13
It would seem like you're demonstrating with far too aggressive settings; the source image looks far better than the result thanks to the filters blurring out all details.

feisty2
1st November 2015, 23:19
It would seem like you're demonstrating with far too aggressive settings; the source image looks far better than the result thanks to the filters blurring out all details.

Exactly, that's why it's called demo, not real case
I was just using that to show the difference