arithm.rst 6.76 KB

Arithm Operations on Matrices

cuda::gemm

Performs generalized matrix multiplication.

The function performs generalized matrix multiplication similar to the gemm functions in BLAS level 3. For example, gemm(src1, src2, alpha, src3, beta, dst, GEMM_1_T + GEMM_3_T) corresponds to

\texttt{dst} =  \texttt{alpha} \cdot \texttt{src1} ^T  \cdot \texttt{src2} +  \texttt{beta} \cdot \texttt{src3} ^T

Note

Transposition operation doesn't support CV_64FC2 input type.

cuda::mulSpectrums

Performs a per-element multiplication of two Fourier spectrums.

Only full (not packed) CV_32FC2 complex spectrums in the interleaved format are supported for now.

cuda::mulAndScaleSpectrums

Performs a per-element multiplication of two Fourier spectrums and scales the result.

Only full (not packed) CV_32FC2 complex spectrums in the interleaved format are supported for now.

cuda::dft

Performs a forward or inverse discrete Fourier transform (1D or 2D) of the floating point matrix.

Use to handle real matrices ( CV32FC1 ) and complex matrices in the interleaved format ( CV32FC2 ).

The source matrix should be continuous, otherwise reallocation and data copying is performed. The function chooses an operation mode depending on the flags, size, and channel count of the source matrix:

  • If the source matrix is complex and the output is not specified as real, the destination matrix is complex and has the dft_size size and CV_32FC2 type. The destination matrix contains a full result of the DFT (forward or inverse).
  • If the source matrix is complex and the output is specified as real, the function assumes that its input is the result of the forward transform (see the next item). The destination matrix has the dft_size size and CV_32FC1 type. It contains the result of the inverse DFT.
  • If the source matrix is real (its type is CV_32FC1 ), forward DFT is performed. The result of the DFT is packed into complex ( CV_32FC2 ) matrix. So, the width of the destination matrix is dft_size.width / 2 + 1 . But if the source is a single column, the height is reduced instead of the width.

cuda::Convolution

Base class for convolution (or cross-correlation) operator.

class CV_EXPORTS Convolution : public Algorithm
{
public:
    virtual void convolve(InputArray image, InputArray templ, OutputArray result, bool ccorr = false, Stream& stream = Stream::Null()) = 0;
};

cuda::Convolution::convolve

Computes a convolution (or cross-correlation) of two images.

cuda::createConvolution

Creates implementation for :ocv:class:`cuda::Convolution` .