Skip to content

optflow_DenseRLOFOpticalFlow

optflowclassOpenCV 5.0.0
import { optflow_DenseRLOFOpticalFlow } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSConstructor or factory
CLASSoptflow_DenseRLOFOpticalFlow
RETURN TYPEOwned native handle
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Native object: release it with using or delete(). Factories can return null; check before calling methods. Inherits optflow_DenseOpticalFlow.

Fast dense optical flow computation based on robust local optical flow (RLOF) algorithms and sparse-to-dense interpolation scheme.

The RLOF is a fast local optical flow approach described in [Senst2012] [Senst2013] [Senst2014] and [Senst2016] similar to the pyramidal iterative Lucas-Kanade method as proposed by [Bouguet00]. More details and experiments can be found in the following thesis [Senst2019]. The implementation is derived from optflow::calcOpticalFlowPyrLK().

The sparse-to-dense interpolation scheme allows for fast computation of dense optical flow using RLOF (see [Geistert2016]). For this scheme the following steps are applied: -# motion vector seeded at a regular sampled grid are computed. The sparsity of this grid can be configured with setGridStep -# (optinally) errornous motion vectors are filter based on the forward backward confidence. The threshold can be configured with setForwardBackward. The filter is only applied if the threshold >0 but than the runtime is doubled due to the estimation of the backward flow. -# Vector field interpolation is applied to the motion vector set to obtain a dense vector field.

For the RLOF configuration see optflow::RLOFOpticalFlowParameter for further details. Parameters have been described in [Senst2012] [Senst2013] [Senst2014] and [Senst2016].

Note: If the grid size is set to (1,1) and the forward backward threshold <= 0 than pixelwise dense optical flow field is computed by RLOF without using interpolation.

Note: Note that in output, if no correspondences are found between \a I0 and \a I1, the \a flow is set to 0. See: optflow::calcOpticalFlowDenseRLOF(), optflow::RLOFOpticalFlowParameter

Constructors and members

static create

Creates instance of optflow::DenseRLOFOpticalFlow

create(rlofParam: optflow_RLOFOpticalFlowParameter | null, forwardBackwardThreshold: number, gridStep: Size, interp_type: number, epicK: number, epicSigma: number, epicLambda: number, ricSPSize: number, ricSLICType: number, use_post_proc: boolean, fgsLambda: number, fgsSigma: number, use_variational_refinement: boolean): optflow_DenseRLOFOpticalFlow | null;
14 available overloads
create(): optflow_DenseRLOFOpticalFlow | null;
create(rlofParam: optflow_RLOFOpticalFlowParameter | null): optflow_DenseRLOFOpticalFlow | null;
create(rlofParam: optflow_RLOFOpticalFlowParameter | null, forwardBackwardThreshold: number): optflow_DenseRLOFOpticalFlow | null;
create(rlofParam: optflow_RLOFOpticalFlowParameter | null, forwardBackwardThreshold: number, gridStep: Size): optflow_DenseRLOFOpticalFlow | null;
create(rlofParam: optflow_RLOFOpticalFlowParameter | null, forwardBackwardThreshold: number, gridStep: Size, interp_type: number): optflow_DenseRLOFOpticalFlow | null;
create(rlofParam: optflow_RLOFOpticalFlowParameter | null, forwardBackwardThreshold: number, gridStep: Size, interp_type: number, epicK: number): optflow_DenseRLOFOpticalFlow | null;
create(rlofParam: optflow_RLOFOpticalFlowParameter | null, forwardBackwardThreshold: number, gridStep: Size, interp_type: number, epicK: number, epicSigma: number): optflow_DenseRLOFOpticalFlow | null;
create(rlofParam: optflow_RLOFOpticalFlowParameter | null, forwardBackwardThreshold: number, gridStep: Size, interp_type: number, epicK: number, epicSigma: number, epicLambda: number): optflow_DenseRLOFOpticalFlow | null;
create(rlofParam: optflow_RLOFOpticalFlowParameter | null, forwardBackwardThreshold: number, gridStep: Size, interp_type: number, epicK: number, epicSigma: number, epicLambda: number, ricSPSize: number): optflow_DenseRLOFOpticalFlow | null;
create(rlofParam: optflow_RLOFOpticalFlowParameter | null, forwardBackwardThreshold: number, gridStep: Size, interp_type: number, epicK: number, epicSigma: number, epicLambda: number, ricSPSize: number, ricSLICType: number): optflow_DenseRLOFOpticalFlow | null;
create(rlofParam: optflow_RLOFOpticalFlowParameter | null, forwardBackwardThreshold: number, gridStep: Size, interp_type: number, epicK: number, epicSigma: number, epicLambda: number, ricSPSize: number, ricSLICType: number, use_post_proc: boolean): optflow_DenseRLOFOpticalFlow | null;
create(rlofParam: optflow_RLOFOpticalFlowParameter | null, forwardBackwardThreshold: number, gridStep: Size, interp_type: number, epicK: number, epicSigma: number, epicLambda: number, ricSPSize: number, ricSLICType: number, use_post_proc: boolean, fgsLambda: number): optflow_DenseRLOFOpticalFlow | null;
create(rlofParam: optflow_RLOFOpticalFlowParameter | null, forwardBackwardThreshold: number, gridStep: Size, interp_type: number, epicK: number, epicSigma: number, epicLambda: number, ricSPSize: number, ricSLICType: number, use_post_proc: boolean, fgsLambda: number, fgsSigma: number): optflow_DenseRLOFOpticalFlow | null;
create(rlofParam: optflow_RLOFOpticalFlowParameter | null, forwardBackwardThreshold: number, gridStep: Size, interp_type: number, epicK: number, epicSigma: number, epicLambda: number, ricSPSize: number, ricSLICType: number, use_post_proc: boolean, fgsLambda: number, fgsSigma: number, use_variational_refinement: boolean): optflow_DenseRLOFOpticalFlow | null;
rlofParam

see optflow::RLOFOpticalFlowParameter

forwardBackwardThreshold

see setForwardBackward

gridStep

see setGridStep

interp_type

see setInterpolation

epicK

see setEPICK

epicSigma

see setEPICSigma

epicLambda

see setEPICLambda

ricSPSize

see setRICSPSize

ricSLICType

see setRICSLICType

use_post_proc

see setUsePostProc

fgsLambda

see setFgsLambda

fgsSigma

see setFgsSigma

use_variational_refinement

see setUseVariationalRefinement

Returns

The optflow_DenseRLOFOpticalFlow | null result.

clone

Create another handle to the same native object. This retains the object without copying its pixels or algorithm state; dispose both handles separately.

clone(): this;
Returns

The this result.

setRLOFOpticalFlowParameter

Configuration of the RLOF alogrithm. See: optflow::RLOFOpticalFlowParameter, getRLOFOpticalFlowParameter

setRLOFOpticalFlowParameter(val: optflow_RLOFOpticalFlowParameter | null): void;
val

val argument (optflow_RLOFOpticalFlowParameter | null).

getRLOFOpticalFlowParameter

Configuration of the RLOF alogrithm. See: optflow::RLOFOpticalFlowParameter, getRLOFOpticalFlowParameter See: optflow::RLOFOpticalFlowParameter, setRLOFOpticalFlowParameter

getRLOFOpticalFlowParameter(): optflow_RLOFOpticalFlowParameter | null;
Returns

The optflow_RLOFOpticalFlowParameter | null result.

setForwardBackward

Threshold for the forward backward confidence check For each grid point \mathbf{x} a motion vector d_{I0,I1}(\mathbf{x}) is computed. If the forward backward error

 EP_{FB} = || d_{I0,I1} + d_{I1,I0} || 
is larger than threshold given by this function then the motion vector will not be used by the following

vector field interpolation. d_{I1,I0} denotes the backward flow. Note, the forward backward test will only be applied if the threshold > 0. This may results into a doubled runtime for the motion estimation. See: getForwardBackward, setGridStep

setForwardBackward(val: number): void;
val

val argument (number).

getForwardBackward

Threshold for the forward backward confidence check For each grid point \mathbf{x} a motion vector d_{I0,I1}(\mathbf{x}) is computed. If the forward backward error

 EP_{FB} = || d_{I0,I1} + d_{I1,I0} || 
is larger than threshold given by this function then the motion vector will not be used by the following

vector field interpolation. d_{I1,I0} denotes the backward flow. Note, the forward backward test will only be applied if the threshold > 0. This may results into a doubled runtime for the motion estimation. See: getForwardBackward, setGridStep See: setForwardBackward

getForwardBackward(): number;
Returns

The number result.

getGridStep

Size of the grid to spawn the motion vectors. For each grid point a motion vector is computed. Some motion vectors will be removed due to the forwatd backward threshold (if set >0). The rest will be the base of the vector field interpolation. See: getForwardBackward, setGridStep

getGridStep(): Size;
Returns

The Size result.

setGridStep

Size of the grid to spawn the motion vectors. For each grid point a motion vector is computed. Some motion vectors will be removed due to the forwatd backward threshold (if set >0). The rest will be the base of the vector field interpolation. See: getForwardBackward, setGridStep See: getGridStep

setGridStep(val: Size): void;
val

val argument (Size).

setInterpolation

Interpolation used to compute the dense optical flow. Two interpolation algorithms are supported

  • INTERP_GEO applies the fast geodesic interpolation, see [Geistert2016].
  • INTERP_EPIC_RESIDUAL applies the edge-preserving interpolation, see [Revaud2015],Geistert2016. See: ximgproc::EdgeAwareInterpolator, getInterpolation
setInterpolation(val: number): void;
val

val argument (number).

getInterpolation

Interpolation used to compute the dense optical flow. Two interpolation algorithms are supported

  • INTERP_GEO applies the fast geodesic interpolation, see [Geistert2016].
  • INTERP_EPIC_RESIDUAL applies the edge-preserving interpolation, see [Revaud2015],Geistert2016. See: ximgproc::EdgeAwareInterpolator, getInterpolation See: ximgproc::EdgeAwareInterpolator, setInterpolation
getInterpolation(): number;
Returns

The number result.

getEPICK

see ximgproc::EdgeAwareInterpolator() K value. K is a number of nearest-neighbor matches considered, when fitting a locally affine model. Usually it should be around 128. However, lower values would make the interpolation noticeably faster. See: ximgproc::EdgeAwareInterpolator, setEPICK

getEPICK(): number;
Returns

The number result.

setEPICK

see ximgproc::EdgeAwareInterpolator() K value. K is a number of nearest-neighbor matches considered, when fitting a locally affine model. Usually it should be around 128. However, lower values would make the interpolation noticeably faster. See: ximgproc::EdgeAwareInterpolator, setEPICK See: ximgproc::EdgeAwareInterpolator, getEPICK

setEPICK(val: number): void;
val

val argument (number).

getEPICSigma

see ximgproc::EdgeAwareInterpolator() sigma value. Sigma is a parameter defining how fast the weights decrease in the locally-weighted affine fitting. Higher values can help preserve fine details, lower values can help to get rid of noise in the output flow. See: ximgproc::EdgeAwareInterpolator, setEPICSigma

getEPICSigma(): number;
Returns

The number result.

setEPICSigma

see ximgproc::EdgeAwareInterpolator() sigma value. Sigma is a parameter defining how fast the weights decrease in the locally-weighted affine fitting. Higher values can help preserve fine details, lower values can help to get rid of noise in the output flow. See: ximgproc::EdgeAwareInterpolator, setEPICSigma See: ximgproc::EdgeAwareInterpolator, getEPICSigma

setEPICSigma(val: number): void;
val

val argument (number).

getEPICLambda

see ximgproc::EdgeAwareInterpolator() lambda value. Lambda is a parameter defining the weight of the edge-aware term in geodesic distance, should be in the range of 0 to 1000. See: ximgproc::EdgeAwareInterpolator, setEPICSigma

getEPICLambda(): number;
Returns

The number result.

setEPICLambda

see ximgproc::EdgeAwareInterpolator() lambda value. Lambda is a parameter defining the weight of the edge-aware term in geodesic distance, should be in the range of 0 to 1000. See: ximgproc::EdgeAwareInterpolator, setEPICSigma See: ximgproc::EdgeAwareInterpolator, getEPICLambda

setEPICLambda(val: number): void;
val

val argument (number).

getFgsLambda

see ximgproc::EdgeAwareInterpolator(). Sets the respective fastGlobalSmootherFilter() parameter. See: ximgproc::EdgeAwareInterpolator, setFgsLambda

getFgsLambda(): number;
Returns

The number result.

setFgsLambda

see ximgproc::EdgeAwareInterpolator(). Sets the respective fastGlobalSmootherFilter() parameter. See: ximgproc::EdgeAwareInterpolator, setFgsLambda See: ximgproc::EdgeAwareInterpolator, ximgproc::fastGlobalSmootherFilter, getFgsLambda

setFgsLambda(val: number): void;
val

val argument (number).

getFgsSigma

see ximgproc::EdgeAwareInterpolator(). Sets the respective fastGlobalSmootherFilter() parameter. See: ximgproc::EdgeAwareInterpolator, ximgproc::fastGlobalSmootherFilter, setFgsSigma

getFgsSigma(): number;
Returns

The number result.

setFgsSigma

see ximgproc::EdgeAwareInterpolator(). Sets the respective fastGlobalSmootherFilter() parameter. See: ximgproc::EdgeAwareInterpolator, ximgproc::fastGlobalSmootherFilter, setFgsSigma See: ximgproc::EdgeAwareInterpolator, ximgproc::fastGlobalSmootherFilter, getFgsSigma

setFgsSigma(val: number): void;
val

val argument (number).

setUsePostProc

enables ximgproc::fastGlobalSmootherFilter See: getUsePostProc

setUsePostProc(val: boolean): void;
val

val argument (boolean).

getUsePostProc

enables ximgproc::fastGlobalSmootherFilter See: getUsePostProc See: ximgproc::fastGlobalSmootherFilter, setUsePostProc

getUsePostProc(): boolean;
Returns

The boolean result.

setUseVariationalRefinement

enables VariationalRefinement See: getUseVariationalRefinement

setUseVariationalRefinement(val: boolean): void;
val

val argument (boolean).

getUseVariationalRefinement

enables VariationalRefinement See: getUseVariationalRefinement See: ximgproc::fastGlobalSmootherFilter, setUsePostProc

getUseVariationalRefinement(): boolean;
Returns

The boolean result.

setRICSPSize

Parameter to tune the approximate size of the superpixel used for oversegmentation. See: cv::ximgproc::createSuperpixelSLIC, cv::ximgproc::RICInterpolator

setRICSPSize(val: number): void;
val

val argument (number).

getRICSPSize

Parameter to tune the approximate size of the superpixel used for oversegmentation. See: cv::ximgproc::createSuperpixelSLIC, cv::ximgproc::RICInterpolator See: setRICSPSize

getRICSPSize(): number;
Returns

The number result.

setRICSLICType

Parameter to choose superpixel algorithm variant to use:

  • cv::ximgproc::SLICType SLIC segments image using a desired region_size (value: 100)
  • cv::ximgproc::SLICType SLICO will optimize using adaptive compactness factor (value: 101)
  • cv::ximgproc::SLICType MSLIC will optimize using manifold methods resulting in more content-sensitive superpixels (value: 102). See: cv::ximgproc::createSuperpixelSLIC, cv::ximgproc::RICInterpolator
setRICSLICType(val: number): void;
val

val argument (number).

getRICSLICType

Parameter to choose superpixel algorithm variant to use:

  • cv::ximgproc::SLICType SLIC segments image using a desired region_size (value: 100)
  • cv::ximgproc::SLICType SLICO will optimize using adaptive compactness factor (value: 101)
  • cv::ximgproc::SLICType MSLIC will optimize using manifold methods resulting in more content-sensitive superpixels (value: 102). See: cv::ximgproc::createSuperpixelSLIC, cv::ximgproc::RICInterpolator See: setRICSLICType
getRICSLICType(): number;
Returns

The number result.

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.