Operations on Matrices

gpu::transpose

C++: void gpu::transpose(const GpuMat& src, GpuMat& dst)

Transposes a matrix.

Parameters:
  • src – Source matrix. 1-, 4-, 8-byte element sizes are supported for now.
  • dst – Destination matrix.

See also

transpose()

gpu::flip

C++: void gpu::flip(const GpuMat& src, GpuMat& dst, int flipCode)

Flips a 2D matrix around vertical, horizontal, or both axes.

Parameters:
  • src – Source matrix. Only CV_8UC1 and CV_8UC4 matrices are supported for now.
  • dst – Destination matrix.
  • flipCode

    Flip mode for the source:

    • 0 Flips around x-axis.
    • >0 Flips around y-axis.
    • <0 Flips around both axes.

See also

flip()

gpu::LUT

C++: void gpu::LUT(const GpuMat& src, const Mat& lut, GpuMat& dst)

Transforms the source matrix into the destination matrix using the given look-up table: dst(I) = lut(src(I))

Parameters:
  • src – Source matrix. CV_8UC1 and CV_8UC3 matrices are supported for now.
  • lut – Look-up table of 256 elements. It is a continuous CV_8U matrix.
  • dst – Destination matrix with the same depth as lut and the same number of channels as src.

See also

LUT()

gpu::merge

C++: void gpu::merge(const GpuMat* src, size_t n, GpuMat& dst)
C++: void gpu::merge(const GpuMat* src, size_t n, GpuMat& dst, const Stream& stream)
C++: void gpu::merge(const vector<GpuMat>& src, GpuMat& dst)
C++: void gpu::merge(const vector<GpuMat>& src, GpuMat& dst, const Stream& stream)

Makes a multi-channel matrix out of several single-channel matrices.

Parameters:
  • src – Array/vector of source matrices.
  • n – Number of source matrices.
  • dst – Destination matrix.
  • stream – Stream for the asynchronous version.

See also

merge()

gpu::split

C++: void gpu::split(const GpuMat& src, GpuMat* dst)
C++: void gpu::split(const GpuMat& src, GpuMat* dst, const Stream& stream)
C++: void gpu::split(const GpuMat& src, vector<GpuMat>& dst)
C++: void gpu::split(const GpuMat& src, vector<GpuMat>& dst, const Stream& stream)

Copies each plane of a multi-channel matrix into an array.

Parameters:
  • src – Source matrix.
  • dst – Destination array/vector of single-channel matrices.
  • stream – Stream for the asynchronous version.

See also

split()

gpu::magnitude

C++: void gpu::magnitude(const GpuMat& xy, GpuMat& magnitude)
C++: void gpu::magnitude(const GpuMat& x, const GpuMat& y, GpuMat& magnitude)
C++: void gpu::magnitude(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, const Stream& stream)

Computes magnitudes of complex matrix elements.

Parameters:
  • xy – Source complex matrix in the interleaved format (CV_32FC2).
  • x – Source matrix containing real components (CV_32FC1).
  • y – Source matrix containing imaginary components (CV_32FC1).
  • magnitude – Destination matrix of float magnitudes (CV_32FC1).
  • stream – Stream for the asynchronous version.

See also

magnitude()

gpu::magnitudeSqr

C++: void gpu::magnitudeSqr(const GpuMat& xy, GpuMat& magnitude)
C++: void gpu::magnitudeSqr(const GpuMat& x, const GpuMat& y, GpuMat& magnitude)
C++: void gpu::magnitudeSqr(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, const Stream& stream)

Computes squared magnitudes of complex matrix elements.

Parameters:
  • xy – Source complex matrix in the interleaved format (CV_32FC2).
  • x – Source matrix containing real components (CV_32FC1).
  • y – Source matrix containing imaginary components (CV_32FC1).
  • magnitude – Destination matrix of float magnitude squares (CV_32FC1).
  • stream – Stream for the asynchronous version.

gpu::phase

C++: void gpu::phase(const GpuMat& x, const GpuMat& y, GpuMat& angle, bool angleInDegrees=false)
C++: void gpu::phase(const GpuMat& x, const GpuMat& y, GpuMat& angle, bool angleInDegrees, const Stream& stream)

Computes polar angles of complex matrix elements.

Parameters:
  • x – Source matrix containing real components (CV_32FC1).
  • y – Source matrix containing imaginary components (CV_32FC1).
  • angle – Destionation matrix of angles (CV_32FC1).
  • angleInDegress – Flag for angles that must be evaluated in degress.
  • stream – Stream for the asynchronous version.

See also

phase()

gpu::cartToPolar

C++: void gpu::cartToPolar(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, GpuMat& angle, bool angleInDegrees=false)
C++: void gpu::cartToPolar(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, GpuMat& angle, bool angleInDegrees, const Stream& stream)

Converts Cartesian coordinates into polar.

Parameters:
  • x – Source matrix containing real components (CV_32FC1).
  • y – Source matrix containing imaginary components (CV_32FC1).
  • magnitude – Destination matrix of float magnitudes (CV_32FC1).
  • angle – Destionation matrix of angles (CV_32FC1).
  • angleInDegress – Flag for angles that must be evaluated in degress.
  • stream – Stream for the asynchronous version.

See also

cartToPolar()

gpu::polarToCart

C++: void gpu::polarToCart(const GpuMat& magnitude, const GpuMat& angle, GpuMat& x, GpuMat& y, bool angleInDegrees=false)
C++: void gpu::polarToCart(const GpuMat& magnitude, const GpuMat& angle, GpuMat& x, GpuMat& y, bool angleInDegrees, const Stream& stream)

Converts polar coordinates into Cartesian.

Parameters:
  • magnitude – Source matrix containing magnitudes (CV_32FC1).
  • angle – Source matrix containing angles (CV_32FC1).
  • x – Destination matrix of real components (CV_32FC1).
  • y – Destination matrix of imaginary components (CV_32FC1).
  • angleInDegress – Flag that indicates angles in degress.
  • stream – Stream for the asynchronous version.

See also

polarToCart()

Table Of Contents

Previous topic

Data Structures

Next topic

Per-element Operations

This Page