Main Content

plot

Plot optical flow vectors

Description

plot(flow) plots the optical flow vectors.

plot(flow,Name=Value) specifies options using one or more name-value arguments in addition to any combination of arguments from previous syntaxes. For example, plot(flow,Color="red") plots the optical flow with red flow vectors.

example

Examples

collapse all

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
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.

plot(opflow,DecimationFactor=[10 10],ScaleFactor=10);

Figure contains an axes object. The axes object contains an object of type quiver.

Input Arguments

collapse all

Object containing optical flow velocity matrices, specified as an opticalFlow object.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is 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.

Example: plot(flow,Color="red") plots the optical flow with red flow vectors.

Decimation factor of velocity vectors, specified as 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 plot.

Scaling factor for velocity vector display, specified as a positive integer-valued scalar. Increase this value to display longer vectors.

Figure axes, specified as an axes object. The default is set to the current axes handle, gca.

Color of optical flow vectors, specified as a 1-by-3 RGB triplet in the range [0,1] or a long or short color name.

Version History

Introduced in R2015a