Log in

View Full Version : When to use MRecalculate()


fvisagie
20th November 2012, 14:28
Hi All,

I'm missing something about MRecalculate() and I hope you can set me straight. I read that mvtools2.html says
Refines and recalculates motion data of previously estimated (by MAnalyse) motion vectors with different super clip or new parameters set (e.g. lesser block size), after divide, etc. The two-stage method may be also useful for more stable (robust) motion estimation.I also found some discussions on the MVTools thread but am still struggling to find a summary of where and how MRecalculate() is useful.

For instance, the example given by mvtools2.html is
AVISource("c:\test.avi") # or MPEG2Source, DirectShowSource, some previous filter, etc
prefiltered = DeGrainMedian() # some smoothing
super = MSuper(hpad=16, vpad=16, levels=1) # one level is enough for MRecalculate
superfilt = MSuper(prefiltered, hpad=16, vpad=16) # all levels for MAnalyse
backward = MAnalyse(superfilt, isb = true, blksize=16)
forward = MAnalyse(superfilt, isb = false, blksize=16)
# recalculate for original source clip and other block size
forward_re = MRecalculate(super, forward, blksize=8, thSAD=100)
backward_re = MRecalculate(super, backward, blksize=8, thSAD=100)
MFlowFps(super, backward_re, forward_re, num=50, den=1)I understand that motion vectors from a prefiltered clip should generally be stabler and that afterwards you'd use those with your actual input clip, but what's the benefit in the example of doing MAnalyse(blksize=16) followed by MRecalculate(blksize=8), compared to just MAnalyse(blksize=8)? It would seem that blksize=16 helps to find large moving areas and blksize=8 refines the search for finer detail and smaller movement? What other uses are there for MRecalculate()?

martin53
20th November 2012, 18:57
I can say that all my experiments with prefiltered clips were disappointing, regarding the effort.

Big block sizes for MAnalyze worked better, even with more noise, than small block sizes with prefiltering.

And the results of the motion compensation filters looked better with big block sizes in MAnalyze and refinement, than without. It seems that the 2nd motion estimation just starts at a better point, and comes closer to what I expect.

fvisagie
23rd November 2012, 09:33
Thanks for your response, Martin.

pbristow
26th November 2012, 12:00
It depends a lot on your source. For example, if you're working with a low resolution image (e.g. 320x240), then getting the motion vectors accurate down to the last quarter-pixel matters a lot more than if the same image is presented in full HD (1920x1080). It's especially important if you're trying to do motion-compensated denoising or SuperResolution, as that relies on being able to overlay image sections that are *exactly* positioned to match... Otherwise, you create blurring of the very details you were trying to enhance.

Likewise, if your source is very noisy or very blocky, then pre-filtering before the analyisis / re-analysis can help a lot to get to the true underlying motion, rather than being misled by artifacts. Conversely, if it's a very blurry image, then although trying to sharpen it for display might just make it look artifical, a bit of sharpening in the pre-filter can help Manalyse() to lock on to the relevant details... *provided* there's not too much noise or blockiness, or pixellation, etc. present, as the sharpening will boost those too.

fvisagie
30th November 2012, 07:27
Great summary, thanks pbristow.