Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 11th May 2019, 08:14   #1  |  Link
Mike3
Registered User
 
Join Date: Apr 2019
Posts: 11
Color coded motion vectors creation in avi synth

How can I obtain color coded motion vectors of an image sequence in avisynth ?

similar to this http://oioiiooixiii.blogspot.com/201...acroblock.html

but with color like here

https://youtu.be/y8DZdxs4Lc8?t=293
Mike3 is offline   Reply With Quote
Old 11th May 2019, 15:50   #2  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 4,060
mshow for the 1st left example (not the stylized blocks, although you can apply the same filter colorkey avisynth to get the 1st right example) , mmask for the 2nd
poisondeathray is offline   Reply With Quote
Old 12th May 2019, 07:34   #3  |  Link
Mike3
Registered User
 
Join Date: Apr 2019
Posts: 11
Are mshow and mmask in the stock avisynth dll's ?

From what I searched mshow seems to be mvtools related but what about mmask ?
Mike3 is offline   Reply With Quote
Old 12th May 2019, 11:13   #4  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,479
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 View Post
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.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 12th May 2019 at 19:07.
StainlessS is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 23:04.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.