Log in

View Full Version : mvtools compenstion question


Terka
30th November 2012, 11:57
Have 4 consecutive frames a1, a2, a3, a4 want to create frame a5 using mvtools.
Vectors a1 -> a2, a2 -> a3, a3 -> a4 can be calculated.
But how use them to compute frame a5 so the motion will be there?

fvisagie
30th November 2012, 15:24
I haven't tried it yet, but this example from the MVTools v2 documentation seems to suggest a solution:


To recreate bad frames by interpolation with MFlowInter:

AVISource("c:\test.avi") # or MPEG2Source, DirectShowSource, some previous filter, etc
super = MSuper()
backward_vectors = MAnalyse(super, isb = true, delta=2)
forward_vectors = MAnalyse(super, isb = false, delta=2)
inter = MFlowInter(super, backward_vectors, forward_vectors, time=50, ml=70)
# Assume bad frames are 50 and 60
trim(0,49) ++ inter.trim(49,-1) \
++ trim(51,59) ++ inter.trim(59,-1) ++ trim(61,0)

Didée
30th November 2012, 16:02
@fvisagie: That is interpolation: create a motion status between two frames.

If I understand Terka correct, he wants motion extrapolation. Have frames 1 2 3 4, and nothing else, then try to create frame 5.

If so: long story short, there is no way to do this correctly. A cheap & simple trick would be to take the vectors from a3 -> a4, and apply the vectors to a4, to create a4 -> X. This will mostly work out for uniform motion (like fullscreen camera panning - ideal example), but will more or less fail in spots with changing motion vectors.

Terka
30th November 2012, 16:37
Didée, yes you understand correctly. So no trend on vectors v12, v23, v34 could be achieveable? Is it possible to use/create filters on vector clip?

Didée
30th November 2012, 16:57
The problem is that the vectors for which you want a trend, are not located at the same spatial position. Therefore a simple "filter" on the vector clip won't work anyway (apart from the question if those data can be "filtered" by image filters in a sense-making way).

There is (or once was?) an option to manyalyse: "temporal=true", which includes temporal predictors for motion search. Maybe something could be fiddled with this, but I wouldn't put high expectations in it.

In what context are you actually working here? Last frame before scenechange?

Terka
30th November 2012, 17:59
Just curious.
But what i was thinking of is sharpening similar to USM using motion compensation.
USM is subtract between 'normal' and 'blurred'.
I want to create vectors between them and use the vectors on normal. So 'normal' will be moved to mocomped position.
Then i also could subtract 'normal' and 'mocomped normal' which is similar to USM.

Didée
30th November 2012, 18:16
>> Then i also could subtract 'normal' and 'mocomped normal' which is similar to USM.

How is this related to 1 2 3 4 > [5] ?

For what you describe in your last sentence, you just do comp = clip.mcompensate(vector), then subtract clip and comp. No motion extrapolation needed for that.