HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Both MvTools2
https://avisynth.org.ru/mvtools/mvtools2.html
Quote:
MShow
MShow (clip super, clip vectors, int "scale", int "sil", int "tol", bool "showsad", int "number", int "thSCD1", int "thSCD2", bool "isse", bool "planar")
Shows the motion vectors on padded source by super clip opening (since v2.0.11).
scale allows to enlarge the motion vectors, in order for example to gain in accuracy ( when pel > 1 and scale = 1, you can't see a variation of less than one pixel ).
sil allows to see a different level of analysis ( when searching for motion vectors, a hierarchical analysis is done, and it may be interesting to see what happens at higher levels ).
tol is a tolerance threshold. If the distortion induced by the motion vector is over tol the vector isn't shown.
showsad allows to show the mean (scaled to block 8x8) SAD after compensating the picture and quantity (ThSCD1) of bad (ThSCD1) blocks.
number allows to mark given block (with this number) as white. Default=-1.
Defaults are : scale = 1, sil = 0, tol = 20000 and showsad = false ( which shows all vectors ).
|
To show the motion vectors ( forward ) : EDIT: The next two examples are bugged see later edit.
Code:
AVISource("c:\test.avi") # or MPEG2Source, DirectShowSource, some previous filter, etc
vectors = MSuper().MAnalyse(isb = false)
MShow(vectors) # implicit last works properly
To show the backward one :
Code:
AVISource("c:\test.avi") # or MPEG2Source, DirectShowSource, some previous filter, etc
vectors = MSuper().MAnalyse(isb = true)
MShow(vectors)
Quote:
MMask
MMask (clip source, clip vectors, float "ml", float "gamma", int "kind", int "Ysc", float "time", int "thSCD1", int "thSCD2", bool "isse", bool "planar")
Creates mask clip from source clip with motion vectors data. Mask is defined by blocks data, but is interpolated to fit full frame size. The mask is created both on the luma and on chroma planes. Mask values may be from 0 (min) to 255 (max).
kind parameter defines kind of mask.
Mode kind=0 creates motion mask from the motion vectors length. It builds a better mask than MotionMask function of MaskTools plugin because motion vectors are a lot more reliable than the algorithm of MotionMask. Mask value 0 means no motion at all ( the length of the motion vector is null ). The longer vector length, the larger mask value (saturated to 255), the scale is defined by ml.
kind=1 allows to build a mask of the SAD (sum of absolute differences) values instead of the vectors' length. It can be useful to find problem areas with bad motion estimation. (Internal factor blocksize*blocksize/4 is used for normalization of scale ml.)
kind=2 allows to build a occlusion mask (bad blocks due to rupture, tensile). Currently, some normalized sum of positive blocks motion differences is used. It can be scaled with ml.
kind=3 allows to build a mask of horizontal component of motion vector in pel units plus 128. It can be scaled with ml.
kind=4 allows to build a mask of vertical component of motion vector in pel units plus 128. It can be scaled with ml.
kind=5 - motion colormap as x,y components of motion vector shown in U, V color planes (in pel units plus 128, It can be scaled with ml).
ml parameter defines the scale of motion mask. When the vector's length (or other kind value) is superior or equal to ml, the output value is saturated to 255. The lesser value results to lesser output.
gamma is used to defined the exponent of relation output to input. gamma = 1.0 implies a linear relation, whereas gamma = 2.0 gives a quadratic relation.
time: percent of motion compensation (default=100.0, full compensation), define time moment between reference and current frame.
And finally, Ysc is the value taken by the mask on scene change
Defaults are : kind = 0, ml = 100, gamma = 1.0, and Ysc = 0.
|
To use MMask :
Code:
AVISource("c:\test.avi") # or MPEG2Source, DirectShowSource, some previous filter, etc
vectors = MSuper().MAnalyse(isb = false)
MMask(vectors)
EDIT:
Actually first two examples are bugged (I reported them some few months ago, fixed in current Pinterf ver$):- http://forum.doom9.org/showthread.ph...46#post1863946
Quote:
Originally Posted by StainlessS
Small prob in first two (mvtools docs) examples:
Code:
# To show the motion vectors ( forward ) :
AVISource("c:\test.avi") # or MPEG2Source, DirectShowSource, some previous filter, etc
vectors = MSuper().MAnalyse(isb = false)
MShow(vectors) # implicit last works properly # ERROR:- MShow: Wrong Super Frame Clip
FIXED
Code:
AVISource("c:\test.avi") # or MPEG2Source, DirectShowSource, some previous filter, etc
Last=MSuper() # Assigns implicit last with Super clip
vectors = Last.MAnalyse(isb = false) # Implicit Last = super, 1st arg
Last.MShow(vectors) # Implicit Last = super, 1st arg
2nd example similar prob isb=true.
|
Last edited by StainlessS; 12th May 2019 at 18:07.
|