Log in

View Full Version : mvtools global motion -> depan


Terka
20th February 2010, 12:10
goal: want to have steady background
so i tried to make global motion compensation using:
mvtools for vector estimation
and
depaninterleave for interleaving them.
when comparing the result with DePanEstimate->depaninterleave, have following conclusion:

1.the background is calm for mvtools->depaninterleave, cant say this for DePanEstimate->depaninterleave
2.the mvtools->depaninterleave doesnot only shift (rotate) the picture, but it blurs also.

why the blur happens? what am i doing wrong?


nn=clp.nnedi2(field=-2)
tri=nn.GlobalMOCO(bobC, prev=1,next=1,matchfields=false)
tri

function GlobalMOCO (clip clp, clip calm, int "prev", int "next", int "subpixel", bool "matchfields", float "pixaspect", bool "info")
{

prev = default( prev , 0 )
next = default( next , 1 )
subpixel = default( subpixel , 2 ) #quality of matching 0-2
matchfields = default( matchfields, True ) # xxx todo
pixaspect = default( pixaspect , 1.094 ) #PAL
info = default( info , false ) #PAL

# procedure ##############
mdata = DePanEstimate (calm) #motion data
depa = DePanInterleave(clp, data=mdata, matchfields =matchfields,prev=prev, next=next,pixaspect=pixaspect,subpixel=subpixel,info=info)
return (depa)
}

nn
vectors = MSuper().MAnalyse(isb = false)
globalmotion = MDepan(vectors, pixaspect=1.094, thSCD1=50000)

mvtools=DePanInterleave(nn, data=globalmotion)
nn3=interleave(nn,nn,nn)
stackhorizontal(nn3,tri,mvtools,Overlay(tri,mvtools, mode="difference", pc_range=true).tweak(sat=3.75))

wonkey_monkey
20th February 2010, 12:57
why the blur happens? what am i doing wrong?

Without seeing your clip it's hard to say, but are you sure the blur isn't there to begin with? It's natural for moving images to have some blur, but when you steady them the blur becomes unnatural.

David

Terka
20th February 2010, 15:14
im sure the blur comes with the mvtools->depaninterleave.
the DePanEstimate->depaninterleave doesnot have it.
thats why i have in the last line stackhorizontal to compare them.
you can try yourselves on whatever clip with global motion.
its more visible when ShowFrameNumber is used, then the blur on the frame-numbers is clearly visible.

Didée
20th February 2010, 15:57
DepanEstime per default does not estimate zoom and rotation. MDepan per default does both. If MDepan does find any sort of zoom and/or rotation, even if very small, then the result can be expected to be softer than without.
(Compare: rotating a digital picture 4 times by 90°, opposed to rotating 8 times by 45°. You know what happens.)

Adjust parameters so that both tools really do the same thing. Then compare again.

Terka
20th February 2010, 18:51
changed this line:
globalmotion = MDepan(vectors, pixaspect=1.094, thSCD1=50000,zoom = false, rot = false)
but still blur remains

Didée
20th February 2010, 19:38
Hehe! It's much more simple!

nn=clp.nnedi2(field=-2)
tri=nn.GlobalMOCO(bobC, prev=1,next=1,matchfields=false)
tri

function GlobalMOCO (clip clp, clip calm, int "prev", int "next", int "subpixel", bool "matchfields", float "pixaspect", bool "info")
{

prev = default( prev , 0 )
next = default( next , 1 )
subpixel = default( subpixel , 2 ) #quality of matching 0-2
matchfields = default( matchfields, True ) # xxx todo
pixaspect = default( pixaspect , 1.094 ) #PAL
info = default( info , false ) #PAL

# procedure ##############
mdata = DePanEstimate (calm) #motion data
depa = DePanInterleave(clp, data=mdata, matchfields =matchfields,prev=prev, next=next,pixaspect=pixaspect,subpixel=subpixel,info=info)
return (depa)
}

nn
vectors = MSuper().MAnalyse(isb = false)
globalmotion = MDepan(vectors, pixaspect=1.094, thSCD1=50000)

mvtools=DePanInterleave(nn, data=globalmotion,subpixel=2) # <- here you forgot something ... ;-)
nn3=interleave(nn,nn,nn)
stackhorizontal(nn3,tri,mvtools,Overlay(tri,mvtools, mode="difference", pc_range=true).tweak(sat=3.75))

Took me a bit to find it. As per documentation, the default "subpixel" is "2" for Depan, but "1" for DepanInterleave.
In GlobalMoCo(), you explicitely set subpixel=2 (bicubic) interpolation. For MDepan+DepanInterleave, you didn't specify subpixel, and the default happens to be "1" (bilinear) ...


Unrelated sidenote: in that script, it seems that you let search MVTools on the plain NNEDI2-bob, while GlobalMoCo seems to get a pre-calmed clip for motion estimation. That's still not a fair comparison. ;)

Terka
20th February 2010, 20:33
bingo! thank you!
regarding your sidenote:
you are right MVTools have an disadvantage... But, despite of it their result is better. It looks like the depan`s phase-shift takes an 'average' motion, mvtools discards some minor motions and takes the 'real global' motion. Im not saying depan is bad, im saying the latter is what i need.