Skip to content

buildOpticalFlowPyramid

Motion and trackingfunctionOpenCV 5.0.0
import { buildOpticalFlowPyramid } from '@banou/opencv-wasm'

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

ARGUMENTSimg, pyramid, winSize, maxLevel
FUNCTIONbuildOpticalFlowPyramid
RETURN TYPEnumber
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Constructs the image pyramid which can be passed to calcOpticalFlowPyrLK.

buildOpticalFlowPyramid(img: Mat, pyramid: MatVector, winSize: Size, maxLevel: number, withDerivatives: boolean, pyrBorder: number, derivBorder: number, tryReuseInputImage: boolean): number;
5 available overloads
buildOpticalFlowPyramid(img: Mat, pyramid: MatVector, winSize: Size, maxLevel: number): number;
buildOpticalFlowPyramid(img: Mat, pyramid: MatVector, winSize: Size, maxLevel: number, withDerivatives: boolean): number;
buildOpticalFlowPyramid(img: Mat, pyramid: MatVector, winSize: Size, maxLevel: number, withDerivatives: boolean, pyrBorder: number): number;
buildOpticalFlowPyramid(img: Mat, pyramid: MatVector, winSize: Size, maxLevel: number, withDerivatives: boolean, pyrBorder: number, derivBorder: number): number;
buildOpticalFlowPyramid(img: Mat, pyramid: MatVector, winSize: Size, maxLevel: number, withDerivatives: boolean, pyrBorder: number, derivBorder: number, tryReuseInputImage: boolean): number;
img

8-bit input image.

pyramid

Output destination, filled by the native operation. output pyramid.

winSize

window size of optical flow algorithm. Must be not less than winSize argument of calcOpticalFlowPyrLK. It is needed to calculate required padding for pyramid levels.

maxLevel

0-based maximal pyramid level number.

withDerivatives

set to precompute gradients for the every pyramid level. If pyramid is constructed without the gradients then calcOpticalFlowPyrLK will calculate them internally.

pyrBorder

the border mode for pyramid layers.

derivBorder

the border mode for gradients.

tryReuseInputImage

put ROI of input image into the pyramid if possible. You can pass false to force data copying.

Returns

number of levels in constructed pyramid. Can be less than maxLevel.

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.