motion ¶
Classes:
-
MotionVectors–Class for storing and managing motion vectors for a video clip.
MotionVectors ¶
MotionVectors(
blksize: int | tuple[int, int] | None = None,
overlap_div: int | tuple[int, int] | None = None,
)
Bases: VSObject, defaultdict[MVDirection, dict[int, VideoNode]]
Class for storing and managing motion vectors for a video clip.
Contains both backward and forward motion vectors.
Methods:
-
analysis_data– -
clear–Clear all stored motion vectors.
-
get_vector–Get a single motion vector.
-
get_vectors–Get the backward and forward vectors.
-
scale_vectors–Scales image_size, block_size, overlap, padding, and the individual motion_vectors contained in Analyse output
-
set_vector–Store a motion vector.
-
show_vector–Draws generated vectors onto a clip.
Attributes:
-
blksize(tuple[int, int] | None) – -
deltas(list[int]) –List of active deltas.
-
has_vectors(bool) –Whether any motion vectors have been stored.
-
overlap_div(tuple[int, int] | None) – -
scaled– -
tr(int) –Temporal radius of the motion vectors.
Source code in vsdenoise/mvtools/motion.py
25 26 27 28 29 30 31 32 33 34 35 | |
analysis_data ¶
analysis_data() -> None
Source code in vsdenoise/mvtools/motion.py
174 175 176 | |
clear ¶
clear() -> None
Clear all stored motion vectors.
Source code in vsdenoise/mvtools/motion.py
81 82 83 84 85 86 87 88 89 90 91 | |
get_vector ¶
get_vector(direction: MVDirection, delta: int) -> VideoNode
Get a single motion vector.
Parameters:
-
(direction¶MVDirection) –Motion vector direction to get.
-
(delta¶int) –Motion vector delta to get.
Returns:
-
VideoNode–A single motion vector VideoNode
Source code in vsdenoise/mvtools/motion.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
get_vectors ¶
get_vectors(
direction: MVDirection = BOTH,
tr: int | None = None,
delta: int | Sequence[int] | None = None,
) -> tuple[list[VideoNode], list[VideoNode]]
Get the backward and forward vectors.
Parameters:
-
(direction¶MVDirection, default:BOTH) –Motion vector direction to get.
-
(tr¶int | None, default:None) –The number of frames to get the vectors for.
-
(delta¶int | Sequence[int] | None, default:None) –Specific delta(s) of motion vectors to retrieve.
Returns:
-
list[VideoNode]–A tuple containing two lists of motion vectors.
-
list[VideoNode]–The first list contains backward vectors and the second contains forward vectors.
Source code in vsdenoise/mvtools/motion.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
scale_vectors ¶
Scales image_size, block_size, overlap, padding, and the individual motion_vectors contained in Analyse output by arbitrary and independent x and y factors.
Parameters:
Source code in vsdenoise/mvtools/motion.py
178 179 180 181 182 183 184 185 186 187 | |
set_vector ¶
set_vector(vector: VideoNode, direction: MVDirection, delta: int) -> None
Store a motion vector.
Parameters:
-
(vector¶VideoNode) –Motion vector clip to store.
-
(direction¶MVDirection) –Direction of the motion vector (forward or backward).
-
(delta¶int) –Frame distance for the motion vector.
Source code in vsdenoise/mvtools/motion.py
93 94 95 96 97 98 99 100 101 102 103 | |
show_vector ¶
show_vector(
clip: VideoNode,
direction: Literal[FORWARD, BACKWARD] = FORWARD,
delta: int = 1,
scenechange: bool | None = None,
) -> VideoNode
Draws generated vectors onto a clip.
Parameters:
-
(clip¶VideoNode) –The clip to overlay the motion vectors on.
-
(direction¶Literal[FORWARD, BACKWARD], default:FORWARD) –Motion vector direction to use.
-
(delta¶int, default:1) –Motion vector delta to use.
-
(scenechange¶bool | None, default:None) –Skips drawing vectors if frame props indicate they are from a different scene than the current frame of the clip.
Returns:
-
VideoNode–Clip with motion vectors overlaid.
Source code in vsdenoise/mvtools/motion.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |