Skip to contents

Plotting method for Image objects produced by the farneback function.

Usage

plotOF(
  of,
  gridsize = c(25, 25),
  thresh = 0,
  add = TRUE,
  arrow.ex = 0.05,
  xpd = TRUE,
  ...
)

Arguments

of

An Image produced by the farneback function.

gridsize

A 2-element vector indicating the number of optical flow vectors to plot in each x-y dimension (default: c(25, 25)). Alternatively, a numeric value that will be used for both dimensions.

thresh

The minimal length of optical flow vectors that should be plotted (default: 0).

add

A logical indicating whether to plot the vector field over an existing plot (default: FALSE).

arrow.ex

Controls the length of the arrows. The length is in terms of the fraction of the shorter axis in the plot. So with a default of .05, 20 arrows of maximum length can line up end to end along the shorter axis.

xpd

If true does not clip arrows to fit inside the plot region, default is not to clip.

...

Graphics arguments passed to the arrows function that can change the color or arrow sizes. See arrows help for details.

See also

Author

Simon Garnier, garnier@njit.edu

Examples

balloon <- video(system.file("sample_vid/Balloon.mp4", package = "Rvision"))
#> Error: Could not open the video.
balloon1 <- readFrame(balloon, 1)
#> Error in eval(expr, envir, enclos): object 'balloon' not found
balloon2 <- readFrame(balloon, 2)
#> Error in eval(expr, envir, enclos): object 'balloon' not found
changeColorSpace(balloon1, "GRAY", "self")
#> Error in eval(expr, envir, enclos): object 'balloon1' not found
changeColorSpace(balloon2, "GRAY", "self")
#> Error in eval(expr, envir, enclos): object 'balloon2' not found
of <- farneback(balloon1, balloon2)
#> Error in eval(expr, envir, enclos): object 'balloon1' not found
plot(of)
#> Error in eval(expr, envir, enclos): object 'of' not found
plotOF(of, length = 0.05)
#> Error in eval(expr, envir, enclos): object 'of' not found