OF(X, Y, W = 5, grads.diff = 1, center = TRUE, cutoffpar = 4, verbose = FALSE, ...)## S3 method for class 'OF':
plot(x, ...)
## S3 method for class 'OF':
hist(x, ...)
## S3 method for class 'OF':
summary(object, ...)
OF
.cutoffpar
*sd.OF
: optional arguments to the optim
function (cannot be par
, fn
, gr
or method
). See details section for plot
and hist
method functions. Not used I_o(x,y) ~ I_f(x,y) + [partial(I_f) wrt x]*dx + [partial(I_f) wrt y]*dy.
The procedure follows that proposed by Lucas and Kanade (1981) whereby for some window, W, it is assumed that all dx (dy) are assumed constant, and least squares estimation is used to estimate dx and dy (see Marzban and Sandgathe, 2010 for more on this implementation). This function iteratively calls optflow for each window in the field.
The above formulation is linear in the parameters. Marzban and Sandgathe (2010) also introduce an additive error component, which leads to a nonlinear version of the above. Namely,
I_o(x,y) ~ I_f(x,y) + [partial(I_f) wrt x]*dx + [partial(I_f) wrt y]*dy + A(x,y).
See Marzban and Sandgathe for more details.
The plot method function can produce a figure like that of Fig. 1, 5, and 6 in Marzban and Sandgathe (2010) or with option full=TRUE
, even more plots. Optional arguments that may be passed in via the ellipses include: full
(logical, produce a figure analogous to Fig. 1, 5 and 6 from Marzban and Sandgathe (2010) (FALSE/default) or make more plots (TRUE)), scale
(default is 1 or no scaling, any numeric value by which the fields are divided/scaled before plotting), of.scale
(default is 1, factor by which display vectors can be magnified), of.step
(plot OF vectors every of.step, default is 4), prop
(default is 2, value for prop
argument in the call to rose.diag
from package nbins
(default is 40, number of bins to use in the call to rose.diag
).
The hist
method function produces a two-dimensional histogram like that of Fig. 3 and 7 in Marzban and Sandgathe (2010). It can also take various arguments passed via the ellipses. They include: xmin
, xmax
, ymin
, ymax
(lower and upper bounds for the histogram breaks in the x- (angle) and y- (magnitude/displacement error) directions, resp. Defaults to (0,360) and (0,4)), nbreaks (default is 100, the number of breaks to use).
The summary
method mostly uses the stats
function from package circ.summary
from package
Marzban, C. and Sandgathe, S. (2010) Optical flow for verification. Wea. Forecasting, 25, 1479--1494, doi:10.1175/2010WAF2222351.1.
optflow
, optim
, circ.summary
data(hump)
initial <- hump$initial
final <- hump$final
look <- OF(final, initial, W=9, verbose=TRUE)
plot(look) # Compare with Fig. 1 in Marzban and Sandgathe (2010).
hist(look) # 2-d histogram.
plot(look, full=TRUE) # More plots.
summary(look)
Run the code above in your browser using DataLab