DISOpticalFlow
import { DISOpticalFlow } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Native object: release it with using or delete(). Factories can return null; check before calling methods. Inherits DenseOpticalFlow.
DIS optical flow algorithm.
This class implements the Dense Inverse Search (DIS) optical flow algorithm. More details about the algorithm can be found at [Kroeger2016] . Includes three presets with preselected parameters to provide reasonable trade-off between speed and quality. However, even the slowest preset is still relatively fast, use DeepFlow if you need better quality and don't care about speed.
This implementation includes several additional features compared to the algorithm described in the paper,
including spatial propagation of flow vectors (getUseSpatialPropagation), as well as an option to
utilize an initial flow approximation passed to calc (which is, essentially, temporal propagation,
if the previous frame's flow field is passed).
Constructors and members
static create
Creates an instance of DISOpticalFlow
create(preset: number): DISOpticalFlow | null;presetone of PRESET_ULTRAFAST, PRESET_FAST and PRESET_MEDIUM
The DISOpticalFlow | 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;The this result.
getFinestScale
Finest level of the Gaussian pyramid on which the flow is computed (zero level corresponds to the original image resolution). The final flow is obtained by bilinear upscaling. See: setFinestScale
getFinestScale(): number;The number result.
setFinestScale
Finest level of the Gaussian pyramid on which the flow is computed (zero level corresponds to the original image resolution). The final flow is obtained by bilinear upscaling. See: setFinestScale See: getFinestScale
setFinestScale(val: number): void;valval argument (number).
setCoarsestScale
Sets the coarsest scale
setCoarsestScale(val: number): void;valCoarsest level of the Gaussian pyramid on which the flow is computed. If set to -1, the auto-computed coarsest scale will be used.
getCoarsestScale
Gets the coarsest scale
getCoarsestScale(): number;The number result.
getPatchSize
Size of an image patch for matching (in pixels). Normally, default 8x8 patches work well enough in most cases. See: setPatchSize
getPatchSize(): number;The number result.
setPatchSize
Size of an image patch for matching (in pixels). Normally, default 8x8 patches work well enough in most cases. See: setPatchSize See: getPatchSize
setPatchSize(val: number): void;valval argument (number).
getPatchStride
Stride between neighbor patches. Must be less than patch size. Lower values correspond to higher flow quality. See: setPatchStride
getPatchStride(): number;The number result.
setPatchStride
Stride between neighbor patches. Must be less than patch size. Lower values correspond to higher flow quality. See: setPatchStride See: getPatchStride
setPatchStride(val: number): void;valval argument (number).
getGradientDescentIterations
Maximum number of gradient descent iterations in the patch inverse search stage. Higher values may improve quality in some cases. See: setGradientDescentIterations
getGradientDescentIterations(): number;The number result.
setGradientDescentIterations
Maximum number of gradient descent iterations in the patch inverse search stage. Higher values may improve quality in some cases. See: setGradientDescentIterations See: getGradientDescentIterations
setGradientDescentIterations(val: number): void;valval argument (number).
getVariationalRefinementIterations
Number of fixed point iterations of variational refinement per scale. Set to zero to disable variational refinement completely. Higher values will typically result in more smooth and high-quality flow. See: setGradientDescentIterations
getVariationalRefinementIterations(): number;The number result.
setVariationalRefinementIterations
Maximum number of gradient descent iterations in the patch inverse search stage. Higher values may improve quality in some cases. See: setGradientDescentIterations See: getGradientDescentIterations
setVariationalRefinementIterations(val: number): void;valval argument (number).
getVariationalRefinementAlpha
Weight of the smoothness term See: setVariationalRefinementAlpha
getVariationalRefinementAlpha(): number;The number result.
setVariationalRefinementAlpha
Weight of the smoothness term See: setVariationalRefinementAlpha See: getVariationalRefinementAlpha
setVariationalRefinementAlpha(val: number): void;valval argument (number).
getVariationalRefinementDelta
Weight of the color constancy term See: setVariationalRefinementDelta
getVariationalRefinementDelta(): number;The number result.
setVariationalRefinementDelta
Weight of the color constancy term See: setVariationalRefinementDelta See: getVariationalRefinementDelta
setVariationalRefinementDelta(val: number): void;valval argument (number).
getVariationalRefinementGamma
Weight of the gradient constancy term See: setVariationalRefinementGamma
getVariationalRefinementGamma(): number;The number result.
setVariationalRefinementGamma
Weight of the gradient constancy term See: setVariationalRefinementGamma See: getVariationalRefinementGamma
setVariationalRefinementGamma(val: number): void;valval argument (number).
getVariationalRefinementEpsilon
Norm value shift for robust penalizer See: setVariationalRefinementEpsilon
getVariationalRefinementEpsilon(): number;The number result.
setVariationalRefinementEpsilon
Norm value shift for robust penalizer See: setVariationalRefinementEpsilon See: getVariationalRefinementEpsilon
setVariationalRefinementEpsilon(val: number): void;valval argument (number).
getUseMeanNormalization
Whether to use mean-normalization of patches when computing patch distance. It is turned on by default as it typically provides a noticeable quality boost because of increased robustness to illumination variations. Turn it off if you are certain that your sequence doesn't contain any changes in illumination. See: setUseMeanNormalization
getUseMeanNormalization(): boolean;The boolean result.
setUseMeanNormalization
Whether to use mean-normalization of patches when computing patch distance. It is turned on by default as it typically provides a noticeable quality boost because of increased robustness to illumination variations. Turn it off if you are certain that your sequence doesn't contain any changes in illumination. See: setUseMeanNormalization See: getUseMeanNormalization
setUseMeanNormalization(val: boolean): void;valval argument (boolean).
getUseSpatialPropagation
Whether to use spatial propagation of good optical flow vectors. This option is turned on by default, as it tends to work better on average and can sometimes help recover from major errors introduced by the coarse-to-fine scheme employed by the DIS optical flow algorithm. Turning this option off can make the output flow field a bit smoother, however. See: setUseSpatialPropagation
getUseSpatialPropagation(): boolean;The boolean result.
setUseSpatialPropagation
Whether to use spatial propagation of good optical flow vectors. This option is turned on by default, as it tends to work better on average and can sometimes help recover from major errors introduced by the coarse-to-fine scheme employed by the DIS optical flow algorithm. Turning this option off can make the output flow field a bit smoother, however. See: setUseSpatialPropagation See: getUseSpatialPropagation
setUseSpatialPropagation(val: boolean): void;valval argument (boolean).
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.