This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Plot optical flow vectors




plot(flow) plots the optical flow vectors.


plot(flow,Name,Value) specifies options using one or more name-value arguments in addition to the input argument in the previous syntax.


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 = 
  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);

Input Arguments

collapse all

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

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: plot(flow,'DecimationFactor',[1 1])

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

Scaling factor for velocity vector display, specified as the comma-separated pair consisting of 'ScaleFactor' and a positive integer-valued scalar. Increase this value to display longer vectors.

Figure axes, specified as the comma-separated pair consisting of 'Parent' and axes object. The default is set to the current axes handle, gca.

Introduced in R2015a