AmusementClub / vs-bmdegrain

development prototype for block-matching-based denoising
MIT License
4 stars 0 forks source link

Temporal stability #2

Open NSQY opened 1 year ago

NSQY commented 1 year ago

One of the primary advantages of using MVTools (alternatively, ttmpsm.TTempSmooth) for noise reduction is its ability to produce a more temporally stable output. Without additional processing filters such as BM3D, DFTTest, and WNNM produce a spatially noiseless output, but a temporally noisy one. When applied to a noisy input, this can be extremely distracting during realtime playback.

When paired with MVTools, BM3D not produces a perceptively superior output, it also inherents some of this stability which leads to a more visually pleasing output, particularly (but not exclusively) when processing animation. Do you have any plans on improving temporal stability with bmdegrain?

bm3d_raw.webm bm3d_mvtools.webm

WolframRhodium commented 1 year ago

Is mvtools more stable because it is smoother and a large temporal radius is usually used?

NSQY commented 1 year ago

Sorry, I don't understand your question. The output of MVTools is not smooth at all, it retains more detail than most filtering methods. Even with a small temporal radius, the results are still favorable.

https://slow.pics/c/nw7GTQz7

from vstools import vs, core, depth, initialize_clip
from vsdenoise import BM3DCuda, Profile, MVTools, SADMode, SearchMode

img = core.imwri.Read(
    'Lichtenstein.png'
).std.Loop(24)
img = initialize_clip(img)

noise = core.noise.Add(img, var=50, type=4, seed='422')

mvtools = MVTools(noise, tr=2, refine=3)
mvtools.analyze(
    sharp=2,
    rfilter=4,
    sad_mode=SADMode.ADAPTIVE_SATD_MIXED,
    search=SearchMode.DIAMOND
    )

temporal_denoise = mvtools.degrain(thSAD=250)

bm3d_mvt = BM3DCuda(noise, sigma=10, radius=2, ref=temporal_denoise, profile=Profile.HIGH).final()
bm3d_raw = BM3DCuda(noise, sigma=10, radius=2, profile=Profile.HIGH).final()

noise.set_output(1)
temporal_denoise.text.Text('mvtools prefilter').set_output(2)
bm3d_mvt.text.Text('bm3d + mvtools').set_output(3)
bm3d_raw.text.Text('bm3d').set_output(4)

Lichtenstein

WolframRhodium commented 1 year ago

I mean smooth in the temporal axis. mvtools is certainly sharp from the spatial perspective since it does not make use of spatial similarity. And the sample above does not need any spatial filtering, misc.AverageFrames should be enough.

NSQY commented 1 year ago

the sample above does not need any spatial filtering, misc.AverageFrames should be enough.

Sure, but this is just a basic git-friendly sample to illustrate the point. Usage of misc.AverageFrames on any real content with motion will obviously not be suitable.

WolframRhodium commented 1 year ago

Temporal stability is not of high priority for now.