Skip to content

gapi_cartToPolar

gapifunctionOpenCV 5.0.0
import { gapi_cartToPolar } from '@banou/opencv-wasm'

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

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

Calculates the magnitude and angle of 2D vectors.

The function cartToPolar calculates either the magnitude, angle, or both for every 2D vector (x(I),y(I)):

\begin{array}{l} \texttt{magnitude} (I)= \sqrt{\texttt{x}(I)^2+\texttt{y}(I)^2} , \\ \texttt{angle} (I)= \texttt{atan2} ( \texttt{y} (I), \texttt{x} (I))[ \cdot180 / \pi ] \end{array}

The angles are calculated with accuracy about 0.3 degrees. For the point (0,0), the angle is set to 0.

First output is a matrix of magnitudes of the same size and depth as input x. Second output is a matrix of angles that has the same size and depth as x; the angles are measured in radians (from 0 to 2*Pi) or in degrees (0 to 360 degrees).

Note: Function textual ID is "org.opencv.core.math.cartToPolar"

See: polarToCart

gapi_cartToPolar(x: GMat, y: GMat, angleInDegrees: boolean): tuple_GMat_and_GMat;
2 available overloads
gapi_cartToPolar(x: GMat, y: GMat): tuple_GMat_and_GMat;
gapi_cartToPolar(x: GMat, y: GMat, angleInDegrees: boolean): tuple_GMat_and_GMat;
x

matrix of CV_32FC1 x-coordinates.

y

array of CV_32FC1 y-coordinates.

angleInDegrees

a flag, indicating whether the angles are measured in radians (which is by default), or in degrees.

Returns

The tuple_GMat_and_GMat result.

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.