Skip to content

polarToCart

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

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

ARGUMENTSmagnitude, angle, x, y
FUNCTIONpolarToCart
RETURN TYPEvoid
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Calculates x and y coordinates of 2D vectors from their magnitude and angle.

The function cv::polarToCart calculates the Cartesian coordinates of each 2D vector represented by the corresponding elements of magnitude and angle:

\begin{array}{l} \texttt{x} (I) =  \texttt{magnitude} (I) \cos ( \texttt{angle} (I)) \\ \texttt{y} (I) =  \texttt{magnitude} (I) \sin ( \texttt{angle} (I)) \\ \end{array}

The relative accuracy of the estimated coordinates is about 1e-6.

See: cartToPolar, magnitude, phase, exp, log, pow, sqrt

polarToCart(magnitude: Mat, angle: Mat, x: Mat, y: Mat, angleInDegrees: boolean): void;
2 available overloads
polarToCart(magnitude: Mat, angle: Mat, x: Mat, y: Mat): void;
polarToCart(magnitude: Mat, angle: Mat, x: Mat, y: Mat, angleInDegrees: boolean): void;
magnitude

input floating-point array of magnitudes of 2D vectors; it can be an empty matrix (=Mat()), in this case, the function assumes that all the magnitudes are =1; if it is not empty, it must have the same size and type as angle.

angle

input floating-point array of angles of 2D vectors.

x

Output destination, filled by the native operation. output array of x-coordinates of 2D vectors; it has the same size and type as angle.

y

Output destination, filled by the native operation. output array of y-coordinates of 2D vectors; it has the same size and type as angle.

angleInDegrees

when true, the input angles are measured in degrees, otherwise, they are measured in radians.

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.