Skip to content

SparseOpticalFlow

Motion and trackingclassOpenCV 5.0.0
import { SparseOpticalFlow } from '@banou/opencv-wasm'

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

ARGUMENTSConstructor or factory
CLASSSparseOpticalFlow
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 Algorithm.

Base interface for sparse optical flow algorithms.

Constructors and members

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.

calc

Calculates a sparse optical flow.

calc(prevImg: Mat, nextImg: Mat, prevPts: Mat, nextPts: Mat, status: Mat, err: Mat): void;
2 available overloads
calc(prevImg: Mat, nextImg: Mat, prevPts: Mat, nextPts: Mat, status: Mat): void;
calc(prevImg: Mat, nextImg: Mat, prevPts: Mat, nextPts: Mat, status: Mat, err: Mat): void;
prevImg

First input image.

nextImg

Second input image of the same size and the same type as prevImg.

prevPts

Vector of 2D points for which the flow needs to be found.

nextPts

Input/output value, modified by the native operation. Output vector of 2D points containing the calculated new positions of input features in the second image.

status

Output destination, filled by the native operation. Output status vector. Each element of the vector is set to 1 if the flow for the corresponding features has been found. Otherwise, it is set to 0.

err

Output destination, filled by the native operation. Optional output vector that contains error response for each point (inverse confidence).

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.