Skip to content

magnitude

Core and matricesfunctionOpenCV 5.0.0
import { magnitude } from '@banou/opencv-wasm'

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

ARGUMENTSx, y, magnitude
FUNCTIONmagnitude
RETURN TYPEvoid
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Calculates the magnitude of 2D vectors.

The function cv::magnitude calculates the magnitude of 2D vectors formed from the corresponding elements of x and y arrays:

\texttt{dst} (I) =  \sqrt{\texttt{x}(I)^2 + \texttt{y}(I)^2}

See: cartToPolar, polarToCart, phase, sqrt

magnitude(x: Mat, y: Mat, magnitude: Mat): void;
x

floating-point array of x-coordinates of the vectors.

y

floating-point array of y-coordinates of the vectors; it must have the same size as x.

magnitude

Output destination, filled by the native operation. output array of the same size and type as x.

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.