gpu_matrix_reductions.tex 5.34 KB
Newer Older
1 2 3
\section{Matrix Reductions}


4 5 6 7 8
\cvCppFunc{gpu::meanStdDev}
Computes mean value and standard deviation of matrix elements.

\cvdefCpp{void meanStdDev(const GpuMat\& mtx, Scalar\& mean, Scalar\& stddev);}
\begin{description}
9
\cvarg{mtx}{Source matrix. \texttt{CV\_8UC1} matrices are supported for now.}
10 11 12 13 14 15 16 17 18 19
\cvarg{mean}{Mean value.}
\cvarg{stddev}{Standard deviation value.}
\end{description}

See also: \cvCppCross{meanStdDev}.


\cvCppFunc{gpu::norm}
Returns norm of matrix (or of two matrices difference).

20
\cvdefCpp{double norm(const GpuMat\& src, int normType=NORM\_L2);}
21
\begin{description}
22
\cvarg{src}{Source matrix. Any matrices except 64F are supported.}
23 24 25
\cvarg{normType}{Norm type. \texttt{NORM\_L1}, \texttt{NORM\_L2} and \texttt{NORM\_INF} are supported for now.}
\end{description}

26 27 28 29 30 31 32
\cvdefCpp{double norm(const GpuMat\& src, int normType, GpuMat\& buf);}
\begin{description}
\cvarg{src}{Source matrix. Any matrices except 64F are supported.}
\cvarg{normType}{Norm type. \texttt{NORM\_L1}, \texttt{NORM\_L2} and \texttt{NORM\_INF} are supported for now.}
\cvarg{buf}{Optional buffer to avoid extra memory allocations. It's resized automatically.}
\end{description}

33 34
\cvdefCpp{double norm(const GpuMat\& src1, const GpuMat\& src2,\par
  int normType=NORM\_L2);}
35
\begin{description}
36
\cvarg{src1}{First source matrix. \texttt{CV\_8UC1} matrices are supported for now.}
37 38 39 40 41 42 43
\cvarg{src2}{Second source matrix. Must have the same size and type as \texttt{src1}}.
\cvarg{normType}{Norm type. \texttt{NORM\_L1}, \texttt{NORM\_L2} and \texttt{NORM\_INF} are supported for now.}
\end{description}

See also: \cvCppCross{norm}.


44
\cvCppFunc{gpu::sum}
45
Returns sum of matrix elements.
46 47 48 49 50

\cvdefCpp{Scalar sum(const GpuMat\& src);\newline
Scalar sum(const GpuMat\& src, GpuMat\& buf);}

\begin{description}
51
\cvarg{src}{Source image of any depth except \texttt{CV\_64F}.}
52
\cvarg{buf}{Optional buffer to avoid extra memory allocations. It's resized automatically.}
53 54 55 56 57
\end{description}

See also: \cvCppCross{sum}.


58 59 60 61 62 63 64 65 66 67 68 69
\cvCppFunc{gpu::absSum}
Returns sum of matrix elements absolute values.

\cvdefCpp{Scalar absSum(const GpuMat\& src);\newline
Scalar absSum(const GpuMat\& src, GpuMat\& buf);}

\begin{description}
\cvarg{src}{Source image of any depth except \texttt{CV\_64F}.}
\cvarg{buf}{Optional buffer to avoid extra memory allocations. It's resized automatically.}
\end{description}


70
\cvCppFunc{gpu::sqrSum}
71
Returns squared sum of matrix elements.
72 73 74 75

\cvdefCpp{Scalar sqrSum(const GpuMat\& src);\newline
Scalar sqrSum(const GpuMat\& src, GpuMat\& buf);}
\begin{description}
76
\cvarg{src}{Source image of any depth except \texttt{CV\_64F}.}
77
\cvarg{buf}{Optional buffer to avoid extra memory allocations. It's resized automatically.}
78 79 80 81
\end{description}


\cvCppFunc{gpu::minMax}
82
Finds global minimum and maximum matrix elements and returns their values.
83 84 85 86 87 88 89 90 91

\cvdefCpp{void minMax(const GpuMat\& src, double* minVal,\par
  double* maxVal=0, const GpuMat\& mask=GpuMat());\newline
void minMax(const GpuMat\& src, double* minVal, double* maxVal,\par
  const GpuMat\& mask, GpuMat\& buf);}
\begin{description}
\cvarg{src}{Single-channel source image.}
\cvarg{minVal}{Pointer to returned minimum value. \texttt{NULL} if not required.}
\cvarg{maxVal}{Pointer to returned maximum value. \texttt{NULL} if not required.}
92
\cvarg{mask}{Optional mask to select a sub-matrix.}
93
\cvarg{buf}{Optional buffer to avoid extra memory allocations. It's resized automatically.}
94 95
\end{description}

96
Function doesn't work with \texttt{CV\_64F} images on GPU with compute capability $<$ 1.3.\newline
97 98 99 100
See also: \cvCppCross{minMaxLoc}.


\cvCppFunc{gpu::minMaxLoc}
101
Finds global minimum and maximum matrix elements and returns their values with locations.
102 103 104 105 106 107 108 109 110 111 112 113 114

\cvdefCpp{void minMaxLoc(const GpuMat\& src, double\* minVal, double* maxVal=0,\par
  Point* minLoc=0, Point* maxLoc=0,\par
  const GpuMat\& mask=GpuMat());\newline
void minMaxLoc(const GpuMat\& src, double* minVal, double* maxVal,\par
  Point* minLoc, Point* maxLoc, const GpuMat\& mask,\par
  GpuMat\& valbuf, GpuMat\& locbuf);}
\begin{description}
\cvarg{src}{Single-channel source image.}
\cvarg{minVal}{Pointer to returned minimum value. \texttt{NULL} if not required.}
\cvarg{maxVal}{Pointer to returned maximum value. \texttt{NULL} if not required.}
\cvarg{minValLoc}{Pointer to returned minimum location. \texttt{NULL} if not required.}
\cvarg{maxValLoc}{Pointer to returned maximum location. \texttt{NULL} if not required.}
115
\cvarg{mask}{Optional mask to select a sub-matrix.}
116 117
\cvarg{valbuf}{Optional values buffer to avoid extra memory allocations. It's resized automatically.}
\cvarg{locbuf}{Optional locations buffer to avoid extra memory allocations. It's resized automatically.}
118 119
\end{description}

120
Function doesn't work with \texttt{CV\_64F} images on GPU with compute capability $<$ 1.3.\newline
121 122 123 124
See also: \cvCppCross{minMaxLoc}.


\cvCppFunc{gpu::countNonZero}
125
Counts non-zero matrix elements.
126 127 128 129 130

\cvdefCpp{int countNonZero(const GpuMat\& src);\newline
int countNonZero(const GpuMat\& src, GpuMat\& buf);}
\begin{description}
\cvarg{src}{Single-channel source image.}
131
\cvarg{buf}{Optional buffer to avoid extra memory allocations. It's resized automatically.}
132 133
\end{description}

134
Function doesn't work with \texttt{CV\_64F} images on GPU with compute capability $<$ 1.3.\newline
135
See also: \cvCppCross{countNonZero}.