Plot optical flow vectors
Create an Optical Flow Object and Plot Its Velocity
Create an optical flow object from two equal-sized velocity matrices.
Vx = randn(100,100); Vy = randn(100,100); opflow = opticalFlow(Vx,Vy);
Inspect the properties of the optical flow object. The orientation and the magnitude are computed from the velocity matrices.
opflow = opticalFlow with properties: Vx: [100x100 double] Vy: [100x100 double] Orientation: [100x100 double] Magnitude: [100x100 double]
Plot the velocity of the object as a quiver plot.
flow — Object containing optical flow matrices
Object containing optical flow velocity matrices, specified as an
Specify optional pairs of arguments as
the argument name and
Value is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name in quotes.
DecimationFactor — Decimation factor of velocity vectors
[1 1] (default) | two-element vector
Decimation factor of velocity vectors, specified as the
comma-separated pair consisting of
DecimationFactor' and a two-element vector.
The two-element vector is of form [XDecimFactor
YDecimFactor] and specifies the decimation factor for
velocity vectors along the x and y
directions respectively. XDecimFactor and
YDecimFactor are positive scalar integers.
Increase the value of this property to get a less cluttered quiver
ScaleFactor — Scaling factor for velocity vector display
1 (default) | positive integer-valued scalar
Scaling factor for velocity vector display, specified as the
comma-separated pair consisting of '
and a positive integer-valued scalar. Increase this value to display
Parent — Figure axes
Figure axes, specified as the comma-separated pair consisting of
Parent' and axes object. The default is set to
the current axes handle,
Introduced in R2015a