Merge pull request #1557 from ilya-lavrenov:ocl_minor_doc_update

This commit is contained in:
Roman Donchenko 2013-10-04 18:25:44 +04:00 committed by OpenCV Buildbot
commit 0a13510293
5 changed files with 278 additions and 247 deletions

View File

@ -3,6 +3,16 @@ Matrix Reductions
.. highlight:: cpp
ocl::absSum
---------------
Returns the sum of absolute values for matrix elements.
.. ocv:function:: Scalar ocl::absSum(const oclMat &m)
:param m: The Source image of all depth.
Counts the abs sum of matrix elements for each channel. Supports all data types.
ocl::countNonZero
---------------------
Returns the number of non-zero elements in src
@ -11,7 +21,7 @@ Returns the number of non-zero elements in src
:param src: Single-channel array
Counts non-zero array elements.
Counts non-zero array elements. Supports all data types.
ocl::minMax
------------------
@ -49,26 +59,6 @@ Returns void
The functions minMaxLoc find minimum and maximum element values and their positions. The extremums are searched across the whole array, or, if mask is not an empty array, in the specified array region. The functions do not work with multi-channel arrays.
ocl::Sum
------------------
Returns the sum of matrix elements for each channel
.. ocv:function:: Scalar ocl::sum(const oclMat &m)
:param m: The Source image of all depth.
Counts the sum of matrix elements for each channel.
ocl::absSum
---------------
Returns the sum of absolute values for matrix elements.
.. ocv:function:: Scalar ocl::absSum(const oclMat &m)
:param m: The Source image of all depth.
Counts the abs sum of matrix elements for each channel.
ocl::sqrSum
------------------
Returns the squared sum of matrix elements for each channel
@ -77,4 +67,14 @@ Returns the squared sum of matrix elements for each channel
:param m: The Source image of all depth.
Counts the squared sum of matrix elements for each channel.
Counts the squared sum of matrix elements for each channel. Supports all data types.
ocl::sum
------------------
Returns the sum of matrix elements for each channel
.. ocv:function:: Scalar ocl::sum(const oclMat &m)
:param m: The Source image of all depth.
Counts the sum of matrix elements for each channel.

View File

@ -3,46 +3,6 @@ Operations on Matrics
.. highlight:: cpp
ocl::oclMat::convertTo
--------------------------
Returns void
.. ocv:function:: void ocl::oclMat::convertTo(oclMat &m, int rtype, double alpha = 1, double beta = 0) const
:param m: the destination matrix. If it does not have a proper size or type before the operation, it will be reallocated.
:param rtype: the desired destination matrix type, or rather, the depth (since the number of channels will be the same with the source one). If rtype is negative, the destination matrix will have the same type as the source.
:param alpha: optional scale factor.
:param beta: optional delta added to the scaled values.
The method converts source pixel values to the target datatype. Saturate cast is applied in the end to avoid possible overflows. Supports all data types.
ocl::oclMat::copyTo
-----------------------
Returns void
.. ocv:function:: void ocl::oclMat::copyTo(oclMat &m, const oclMat &mask = oclMat()) const
:param m: The destination matrix. If it does not have a proper size or type before the operation, it will be reallocated.
:param mask: The operation mask. Its non-zero elements indicate, which matrix elements need to be copied.
Copies the matrix to another one. Supports all data types.
ocl::oclMat::setTo
----------------------
Returns oclMat
.. ocv:function:: oclMat& ocl::oclMat::setTo(const Scalar &s, const oclMat &mask = oclMat())
:param s: Assigned scalar, which is converted to the actual array type.
:param mask: The operation mask of the same size as ``*this`` and type ``CV_8UC1``.
Sets all or some of the array elements to the specified value. This is the advanced variant of Mat::operator=(const Scalar s) operator. Supports all data types.
ocl::absdiff
------------------
Returns void
@ -109,60 +69,6 @@ where ``I`` is a multi-dimensional index of array elements. In case of multi-cha
.. seealso:: :ocv:func:`addWeighted`
ocl::subtract
------------------
Returns void
.. ocv:function:: void ocl::subtract(const oclMat& src1, const oclMat& src2, oclMat& dst, const oclMat& mask = oclMat())
.. ocv:function:: void ocl::subtract(const oclMat& src1, const Scalar& s, oclMat& dst, const oclMat& mask = oclMat())
:param src1: the first input array.
:param src2: the second input array, must be the same size and same type as ``src1``.
:param s: scalar, the second input parameter.
:param dst: the destination array, it will have the same size and same type as ``src1``.
:param mask: the optional operation mask, 8-bit single channel array; specifies elements of the destination array to be changed.
Computes per-element subtract between two arrays or between array and a scalar. Supports all data types.
ocl::multiply
------------------
Returns void
.. ocv:function:: void ocl::multiply(const oclMat& src1, const oclMat& src2, oclMat& dst, double scale = 1)
:param src1: the first input array.
:param src2: the second input array, must be the same size and same type as ``src1``.
:param dst: the destination array, it will have the same size and same type as ``src1``.
:param scale: optional scale factor.
Computes per-element multiply between two arrays or between array and a scalar. Supports all data types.
ocl::divide
------------------
Returns void
.. ocv:function:: void ocl::divide(const oclMat& src1, const oclMat& src2, oclMat& dst, double scale = 1)
.. ocv:function:: void ocl::divide(double scale, const oclMat& src1, oclMat& dst)
:param src1: the first input array.
:param src2: the second input array, must be the same size and same type as ``src1``.
:param dst: the destination array, it will have the same size and same type as ``src1``.
:param scale: scalar factor.
Computes per-element divide between two arrays or between array and a scalar. Supports all data types.
ocl::bitwise_and
------------------
Returns void
@ -183,6 +89,18 @@ Returns void
Computes per-element bitwise_and between two arrays or between array and a scalar. Supports all data types.
ocl::bitwise_not
------------------
Returns void
.. ocv:function:: void ocl::bitwise_not(const oclMat &src, oclMat &dst)
:param src: the input array.
:param dst: the destination array, it will have the same size and same type as ``src``.
The functions bitwise not compute per-element bit-wise inversion of the source array. Supports all data types.
ocl::bitwise_or
------------------
Returns void
@ -223,18 +141,6 @@ Returns void
Computes per-element bitwise_xor between two arrays or between array and a scalar. Supports all data types.
ocl::bitwise_not
------------------
Returns void
.. ocv:function:: void ocl::bitwise_not(const oclMat &src, oclMat &dst)
:param src: the input array.
:param dst: the destination array, it will have the same size and same type as ``src``.
The functions bitwise not compute per-element bit-wise inversion of the source array. Supports all data types.
ocl::cartToPolar
------------------
Returns void
@ -253,24 +159,6 @@ Returns void
Calculates the magnitude and angle of 2D vectors. Supports only ``CV_32F`` and ``CV_64F`` data types.
ocl::polarToCart
------------------
Returns void
.. ocv:function:: void ocl::polarToCart(const oclMat &magnitude, const oclMat &angle, oclMat &x, oclMat &y, bool angleInDegrees = false)
:param magnitude: the source floating-point array of magnitudes of 2D vectors. It can be an empty matrix (=Mat()) - in this case the function assumes that all the magnitudes are = 1. If it's not empty, it must have the same size and same type as ``angle``.
:param angle: the source floating-point array of angles of the 2D vectors.
:param x: the destination array of x-coordinates of 2D vectors; will have the same size and the same type as ``angle``.
:param y: the destination array of y-coordinates of 2D vectors; will have the same size and the same type as ``angle``.
:param angleInDegrees: the flag indicating whether the angles are measured in radians, which is default mode, or in degrees.
The function polarToCart computes the cartesian coordinates of each 2D vector represented by the corresponding elements of magnitude and angle. Supports only ``CV_32F`` and ``CV_64F`` data types.
ocl::compare
------------------
Returns void
@ -287,6 +175,52 @@ Returns void
Performs per-element comparison of two arrays or an array and scalar value. Supports all data types.
ocl::dft
------------
Performs a forward or inverse discrete Fourier transform (1D or 2D) of the floating point matrix.
.. ocv:function:: void ocl::dft(const oclMat& src, oclMat& dst, Size dft_size = Size(), int flags = 0)
:param src: source matrix (real or complex).
:param dst: destination matrix (real or complex).
:param dft_size: size of original input, which is used for transformation from complex to real.
:param flags: optional flags:
* **DFT_ROWS** transforms each individual row of the source matrix.
* **DFT_COMPLEX_OUTPUT** performs a forward transformation of 1D or 2D real array. The result, though being a complex array, has complex-conjugate symmetry (*CCS*, see the function description below for details). Such an array can be packed into a real array of the same size as input, which is the fastest option and which is what the function does by default. However, you may wish to get a full complex array (for simpler spectrum analysis, and so on). Pass the flag to enable the function to produce a full-size complex output array.
* **DFT_INVERSE** inverts DFT. Use for complex-complex cases (real-complex and complex-real cases are always forward and inverse, respectively).
* **DFT_REAL_OUTPUT** specifies the output as real. The source matrix is the result of real-complex transform, so the destination matrix must be real.
Use to handle real matrices (``CV_32FC1``) and complex matrices in the interleaved format (``CV_32FC2``).
The ``dft_size`` must be powers of ``2``, ``3`` and ``5``. Real to complex dft output is not the same with cpu version. Real to complex and complex to real does not support ``DFT_ROWS``.
.. seealso:: :ocv:func:`dft`
ocl::divide
------------------
Returns void
.. ocv:function:: void ocl::divide(const oclMat& src1, const oclMat& src2, oclMat& dst, double scale = 1)
.. ocv:function:: void ocl::divide(double scale, const oclMat& src1, oclMat& dst)
:param src1: the first input array.
:param src2: the second input array, must be the same size and same type as ``src1``.
:param dst: the destination array, it will have the same size and same type as ``src1``.
:param scale: scalar factor.
Computes per-element divide between two arrays or between array and a scalar. Supports all data types.
ocl::exp
------------------
Returns void
@ -299,6 +233,45 @@ Returns void
The function exp calculates the exponent of every element of the input array. Supports only ``CV_32FC1`` and ``CV_64F`` data types.
ocl::flip
------------------
Returns void
.. ocv:function:: void ocl::flip(const oclMat& src, oclMat& dst, int flipCode)
:param src: source image.
:param dst: destination image.
:param flipCode: specifies how to flip the array: 0 means flipping around the x-axis, positive (e.g., 1) means flipping around y-axis, and negative (e.g., -1) means flipping around both axes.
The function flip flips the array in one of three different ways (row and column indices are 0-based). Supports all data types.
ocl::gemm
------------------
Performs generalized matrix multiplication.
.. ocv:function:: void ocl::gemm(const oclMat& src1, const oclMat& src2, double alpha, const oclMat& src3, double beta, oclMat& dst, int flags = 0)
:param src1: first multiplied input matrix that should be ``CV_32FC1`` type.
:param src2: second multiplied input matrix of the same type as ``src1``.
:param alpha: weight of the matrix product.
:param src3: third optional delta matrix added to the matrix product. It should have the same type as ``src1`` and ``src2``.
:param beta: weight of ``src3``.
:param dst: destination matrix. It has the proper size and the same type as input matrices.
:param flags: operation flags:
* **GEMM_1_T** transpose ``src1``.
* **GEMM_2_T** transpose ``src2``.
.. seealso:: :ocv:func:`gemm`
ocl::log
------------------
Returns void
@ -339,20 +312,6 @@ Returns void
The function magnitude calculates magnitude of 2D vectors formed from the corresponding elements of ``x`` and ``y`` arrays. Supports only ``CV_32F`` and ``CV_64F`` data types.
ocl::flip
------------------
Returns void
.. ocv:function:: void ocl::flip(const oclMat& src, oclMat& dst, int flipCode)
:param src: source image.
:param dst: destination image.
:param flipCode: specifies how to flip the array: 0 means flipping around the x-axis, positive (e.g., 1) means flipping around y-axis, and negative (e.g., -1) means flipping around both axes.
The function flip flips the array in one of three different ways (row and column indices are 0-based). Supports all data types.
ocl::meanStdDev
------------------
Returns void
@ -365,7 +324,7 @@ Returns void
:param stddev: the output parameter: computed standard deviation.
The functions meanStdDev compute the mean and the standard deviation M of array elements, independently for each channel, and return it via the output parameters. Supports all data types except ``CV_32F``, ``CV_64F``.
The functions meanStdDev compute the mean and the standard deviation M of array elements, independently for each channel, and return it via the output parameters. Supports all data types.
ocl::merge
------------------
@ -379,17 +338,21 @@ Returns void
Composes a multi-channel array from several single-channel arrays. Supports all data types.
ocl::split
ocl::multiply
------------------
Returns void
.. ocv:function:: void ocl::split(const oclMat &src, vector<oclMat> &dst)
.. ocv:function:: void ocl::multiply(const oclMat& src1, const oclMat& src2, oclMat& dst, double scale = 1)
:param src: The source multi-channel array
:param src1: the first input array.
:param dst: The destination array or vector of arrays; The number of arrays must match src.channels(). The arrays themselves will be reallocated if needed
:param src2: the second input array, must be the same size and same type as ``src1``.
The functions split split multi-channel array into separate single-channel arrays. Supports all data types.
:param dst: the destination array, it will have the same size and same type as ``src1``.
:param scale: optional scale factor.
Computes per-element multiply between two arrays or between array and a scalar. Supports all data types.
ocl::norm
------------------
@ -405,7 +368,73 @@ Returns the calculated norm
:param normType: type of the norm.
Calculates absolute array norm, absolute difference norm, or relative difference norm. Supports only ``CV_8UC1`` data type.
The functions ``norm`` calculate an absolute norm of ``src1`` (when there is no ``src2`` ):
.. math::
norm = \forkthree{\|\texttt{src1}\|_{L_{\infty}} = \max _I | \texttt{src1} (I)|}{if $\texttt{normType} = \texttt{NORM\_INF}$ }
{ \| \texttt{src1} \| _{L_1} = \sum _I | \texttt{src1} (I)|}{if $\texttt{normType} = \texttt{NORM\_L1}$ }
{ \| \texttt{src1} \| _{L_2} = \sqrt{\sum_I \texttt{src1}(I)^2} }{if $\texttt{normType} = \texttt{NORM\_L2}$ }
or an absolute or relative difference norm if ``src2`` is there:
.. math::
norm = \forkthree{\|\texttt{src1}-\texttt{src2}\|_{L_{\infty}} = \max _I | \texttt{src1} (I) - \texttt{src2} (I)|}{if $\texttt{normType} = \texttt{NORM\_INF}$ }
{ \| \texttt{src1} - \texttt{src2} \| _{L_1} = \sum _I | \texttt{src1} (I) - \texttt{src2} (I)|}{if $\texttt{normType} = \texttt{NORM\_L1}$ }
{ \| \texttt{src1} - \texttt{src2} \| _{L_2} = \sqrt{\sum_I (\texttt{src1}(I) - \texttt{src2}(I))^2} }{if $\texttt{normType} = \texttt{NORM\_L2}$ }
or
.. math::
norm = \forkthree{\frac{\|\texttt{src1}-\texttt{src2}\|_{L_{\infty}} }{\|\texttt{src2}\|_{L_{\infty}} }}{if $\texttt{normType} = \texttt{NORM\_RELATIVE\_INF}$ }
{ \frac{\|\texttt{src1}-\texttt{src2}\|_{L_1} }{\|\texttt{src2}\|_{L_1}} }{if $\texttt{normType} = \texttt{NORM\_RELATIVE\_L1}$ }
{ \frac{\|\texttt{src1}-\texttt{src2}\|_{L_2} }{\|\texttt{src2}\|_{L_2}} }{if $\texttt{normType} = \texttt{NORM\_RELATIVE\_L2}$ }
The functions ``norm`` return the calculated norm.
A multi-channel input arrays are treated as a single-channel, that is, the results for all channels are combined.
ocl::oclMat::convertTo
--------------------------
Returns void
.. ocv:function:: void ocl::oclMat::convertTo(oclMat &m, int rtype, double alpha = 1, double beta = 0) const
:param m: the destination matrix. If it does not have a proper size or type before the operation, it will be reallocated.
:param rtype: the desired destination matrix type, or rather, the depth (since the number of channels will be the same with the source one). If rtype is negative, the destination matrix will have the same type as the source.
:param alpha: optional scale factor.
:param beta: optional delta added to the scaled values.
The method converts source pixel values to the target datatype. Saturate cast is applied in the end to avoid possible overflows. Supports all data types.
ocl::oclMat::copyTo
-----------------------
Returns void
.. ocv:function:: void ocl::oclMat::copyTo(oclMat &m, const oclMat &mask = oclMat()) const
:param m: The destination matrix. If it does not have a proper size or type before the operation, it will be reallocated.
:param mask: The operation mask. Its non-zero elements indicate, which matrix elements need to be copied.
Copies the matrix to another one. Supports all data types.
ocl::oclMat::setTo
----------------------
Returns oclMat
.. ocv:function:: oclMat& ocl::oclMat::setTo(const Scalar &s, const oclMat &mask = oclMat())
:param s: Assigned scalar, which is converted to the actual array type.
:param mask: The operation mask of the same size as ``*this`` and type ``CV_8UC1``.
Sets all or some of the array elements to the specified value. This is the advanced variant of Mat::operator=(const Scalar s) operator. Supports all data types.
ocl::phase
------------------
@ -423,6 +452,24 @@ Returns void
The function phase computes the rotation angle of each 2D vector that is formed from the corresponding elements of ``x`` and ``y``. Supports only ``CV_32FC1`` and ``CV_64FC1`` data type.
ocl::polarToCart
------------------
Returns void
.. ocv:function:: void ocl::polarToCart(const oclMat &magnitude, const oclMat &angle, oclMat &x, oclMat &y, bool angleInDegrees = false)
:param magnitude: the source floating-point array of magnitudes of 2D vectors. It can be an empty matrix (=Mat()) - in this case the function assumes that all the magnitudes are = 1. If it's not empty, it must have the same size and same type as ``angle``.
:param angle: the source floating-point array of angles of the 2D vectors.
:param x: the destination array of x-coordinates of 2D vectors; will have the same size and the same type as ``angle``.
:param y: the destination array of y-coordinates of 2D vectors; will have the same size and the same type as ``angle``.
:param angleInDegrees: the flag indicating whether the angles are measured in radians, which is default mode, or in degrees.
The function polarToCart computes the cartesian coordinates of each 2D vector represented by the corresponding elements of magnitude and angle. Supports only ``CV_32F`` and ``CV_64F`` data types.
ocl::pow
------------------
Returns void
@ -437,71 +484,17 @@ Returns void
The function pow raises every element of the input array to ``p``. Supports only ``CV_32FC1`` and ``CV_64FC1`` data types.
ocl::transpose
ocl::setIdentity
------------------
Returns void
.. ocv:function:: void ocl::transpose(const oclMat &src, oclMat &dst)
.. ocv:function:: void ocl::setIdentity(oclMat& src, const Scalar & val = Scalar(1))
:param src: the source array.
:param src: matrix to initialize (not necessarily square).
:param dst: the destination array of the same type as ``src``.
:param val: value to assign to diagonal elements.
Transposes a matrix (in case when ``src`` == ``dst`` and matrix is square the operation are performed inplace)
ocl::dft
------------
Performs a forward or inverse discrete Fourier transform (1D or 2D) of the floating point matrix.
.. ocv:function:: void ocl::dft(const oclMat& src, oclMat& dst, Size dft_size = Size(), int flags = 0)
:param src: source matrix (real or complex).
:param dst: destination matrix (real or complex).
:param dft_size: size of original input, which is used for transformation from complex to real.
:param flags: optional flags:
* **DFT_ROWS** transforms each individual row of the source matrix.
* **DFT_COMPLEX_OUTPUT** performs a forward transformation of 1D or 2D real array. The result, though being a complex array, has complex-conjugate symmetry (*CCS*, see the function description below for details). Such an array can be packed into a real array of the same size as input, which is the fastest option and which is what the function does by default. However, you may wish to get a full complex array (for simpler spectrum analysis, and so on). Pass the flag to enable the function to produce a full-size complex output array.
* **DFT_INVERSE** inverts DFT. Use for complex-complex cases (real-complex and complex-real cases are always forward and inverse, respectively).
* **DFT_REAL_OUTPUT** specifies the output as real. The source matrix is the result of real-complex transform, so the destination matrix must be real.
Use to handle real matrices (``CV_32FC1``) and complex matrices in the interleaved format (``CV_32FC2``).
The ``dft_size`` must be powers of ``2``, ``3`` and ``5``. Real to complex dft output is not the same with cpu version. Real to complex and complex to real does not support ``DFT_ROWS``.
.. seealso:: :ocv:func:`dft`
ocl::gemm
------------------
Performs generalized matrix multiplication.
.. ocv:function:: void ocl::gemm(const oclMat& src1, const oclMat& src2, double alpha, const oclMat& src3, double beta, oclMat& dst, int flags = 0)
:param src1: first multiplied input matrix that should be ``CV_32FC1`` type.
:param src2: second multiplied input matrix of the same type as ``src1``.
:param alpha: weight of the matrix product.
:param src3: third optional delta matrix added to the matrix product. It should have the same type as ``src1`` and ``src2``.
:param beta: weight of ``src3``.
:param dst: destination matrix. It has the proper size and the same type as input matrices.
:param flags: operation flags:
* **GEMM_1_T** transpose ``src1``.
* **GEMM_2_T** transpose ``src2``.
.. seealso:: :ocv:func:`gemm`
The function initializes a scaled identity matrix.
ocl::sortByKey
------------------
@ -539,3 +532,47 @@ Example::
output -
keys = {1, 2, 3} (CV_8UC1)
values = {6,2, 10,5, 4,3} (CV_8UC2)
ocl::split
------------------
Returns void
.. ocv:function:: void ocl::split(const oclMat &src, vector<oclMat> &dst)
:param src: The source multi-channel array
:param dst: The destination array or vector of arrays; The number of arrays must match src.channels(). The arrays themselves will be reallocated if needed.
The functions split split multi-channel array into separate single-channel arrays. Supports all data types.
ocl::subtract
------------------
Returns void
.. ocv:function:: void ocl::subtract(const oclMat& src1, const oclMat& src2, oclMat& dst, const oclMat& mask = oclMat())
.. ocv:function:: void ocl::subtract(const oclMat& src1, const Scalar& s, oclMat& dst, const oclMat& mask = oclMat())
:param src1: the first input array.
:param src2: the second input array, must be the same size and same type as ``src1``.
:param s: scalar, the second input parameter.
:param dst: the destination array, it will have the same size and same type as ``src1``.
:param mask: the optional operation mask, 8-bit single channel array; specifies elements of the destination array to be changed.
Computes per-element subtract between two arrays or between array and a scalar. Supports all data types.
ocl::transpose
------------------
Returns void
.. ocv:function:: void ocl::transpose(const oclMat &src, oclMat &dst)
:param src: the source array.
:param dst: the destination array of the same type as ``src``.
Transposes a matrix (in case when ``src`` == ``dst`` and matrix is square the operation are performed inplace).

View File

@ -426,6 +426,7 @@ namespace cv
////////////////////////////// Arithmetics ///////////////////////////////////
//! adds one matrix to another with scale (dst = src1 * alpha + src2 * beta + gama)
// supports all data types
CV_EXPORTS void addWeighted(const oclMat &src1, double alpha, const oclMat &src2, double beta, double gama, oclMat &dst);
//! adds one matrix to another (dst = src1 + src2)
@ -472,17 +473,17 @@ namespace cv
CV_EXPORTS void absdiff(const oclMat &src1, const Scalar &s, oclMat &dst);
//! computes mean value and standard deviation of all or selected array elements
// supports except CV_32F,CV_64F
// supports all data types
CV_EXPORTS void meanStdDev(const oclMat &mtx, Scalar &mean, Scalar &stddev);
//! computes norm of array
// supports NORM_INF, NORM_L1, NORM_L2
// supports only CV_8UC1 type
// supports all data types
CV_EXPORTS double norm(const oclMat &src1, int normType = NORM_L2);
//! computes norm of the difference between two arrays
// supports NORM_INF, NORM_L1, NORM_L2
// supports only CV_8UC1 type
// supports all data types
CV_EXPORTS double norm(const oclMat &src1, const oclMat &src2, int normType = NORM_L2);
//! reverses the order of the rows, columns or both in a matrix
@ -490,7 +491,6 @@ namespace cv
CV_EXPORTS void flip(const oclMat &src, oclMat &dst, int flipCode);
//! computes sum of array elements
// disabled until fix crash
// support all types
CV_EXPORTS Scalar sum(const oclMat &m);
CV_EXPORTS Scalar absSum(const oclMat &m);
@ -499,7 +499,6 @@ namespace cv
//! finds global minimum and maximum array elements and returns their values
// support all C1 types
CV_EXPORTS void minMax(const oclMat &src, double *minVal, double *maxVal = 0, const oclMat &mask = oclMat());
CV_EXPORTS void minMax_buf(const oclMat &src, double *minVal, double *maxVal, const oclMat &mask, oclMat& buf);
//! finds global minimum and maximum array elements and returns their values with locations
// support all C1 types
@ -598,7 +597,7 @@ namespace cv
// support only CV_32FC1 type
CV_EXPORTS void convolve(const oclMat &image, const oclMat &temp1, oclMat &result);
CV_EXPORTS void cvtColor(const oclMat &src, oclMat &dst, int code , int dcn = 0);
CV_EXPORTS void cvtColor(const oclMat &src, oclMat &dst, int code, int dcn = 0);
//! initializes a scaled identity matrix
CV_EXPORTS void setIdentity(oclMat& src, const Scalar & val = Scalar(1));

View File

@ -481,13 +481,13 @@ static void arithmetic_minMax_run(const oclMat &src, const oclMat & mask, cl_mem
}
template <typename T, typename WT>
void arithmetic_minMax(const oclMat &src, double *minVal, double *maxVal,
const oclMat &mask, oclMat &buf)
void arithmetic_minMax(const oclMat &src, double *minVal, double *maxVal, const oclMat &mask)
{
size_t groupnum = src.clCxt->getDeviceInfo().maxComputeUnits;
CV_Assert(groupnum != 0);
int dbsize = groupnum * 2 * src.elemSize();
oclMat buf;
ensureSizeIsEnough(1, dbsize, CV_8UC1, buf);
cl_mem buf_data = reinterpret_cast<cl_mem>(buf.data);
@ -509,15 +509,9 @@ void arithmetic_minMax(const oclMat &src, double *minVal, double *maxVal,
}
}
typedef void (*minMaxFunc)(const oclMat &src, double *minVal, double *maxVal, const oclMat &mask);
void cv::ocl::minMax(const oclMat &src, double *minVal, double *maxVal, const oclMat &mask)
{
oclMat buf;
minMax_buf(src, minVal, maxVal, mask, buf);
}
typedef void (*minMaxFunc)(const oclMat &src, double *minVal, double *maxVal, const oclMat &mask, oclMat &buf);
void cv::ocl::minMax_buf(const oclMat &src, double *minVal, double *maxVal, const oclMat &mask, oclMat &buf)
{
CV_Assert(src.channels() == 1);
CV_Assert(src.size() == mask.size() || mask.empty());
@ -531,7 +525,7 @@ void cv::ocl::minMax_buf(const oclMat &src, double *minVal, double *maxVal, cons
CV_Error(CV_GpuNotSupported, "Selected device doesn't support double");
}
static minMaxFunc functab[8] =
static minMaxFunc functab[] =
{
arithmetic_minMax<uchar, int>,
arithmetic_minMax<char, int>,
@ -543,9 +537,10 @@ void cv::ocl::minMax_buf(const oclMat &src, double *minVal, double *maxVal, cons
0
};
minMaxFunc func;
func = functab[src.depth()];
func(src, minVal, maxVal, mask, buf);
minMaxFunc func = functab[src.depth()];
CV_Assert(func != 0);
func(src, minVal, maxVal, mask);
}
//////////////////////////////////////////////////////////////////////////////

View File

@ -212,7 +212,7 @@ void cv::ocl::GoodFeaturesToTrackDetector_OCL::operator ()(const oclMat& image,
cornerMinEigenVal_dxdy(image, eig_, Dx_, Dy_, blockSize, 3);
double maxVal = 0;
minMax_buf(eig_, 0, &maxVal, oclMat(), minMaxbuf_);
minMax(eig_, NULL, &maxVal);
ensureSizeIsEnough(1, std::max(1000, static_cast<int>(image.size().area() * 0.05)), CV_32FC2, tmpCorners_);