[][src]Function opencv::core::cart_to_polar

pub fn cart_to_polar(
    x: &Mat,
    y: &Mat,
    magnitude: &mut Mat,
    angle: &mut Mat,
    angle_in_degrees: bool
) -> Result<()>

Calculates the magnitude and angle of 2D vectors.

The function cv::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.

Parameters

  • x: array of x-coordinates; this must be a single-precision or double-precision floating-point array.
  • y: array of y-coordinates, that must have the same size and same type as x.
  • magnitude: output array of magnitudes of the same size and type as x.
  • angle: output array of angles that has the same size and type as x; the angles are measured in radians (from 0 to 2*Pi) or in degrees (0 to 360 degrees).
  • angleInDegrees: a flag, indicating whether the angles are measured in radians (which is by default), or in degrees.

See also

Sobel, Scharr

C++ default parameters

  • angle_in_degrees: false