Commit 0a135102 authored by Roman Donchenko's avatar Roman Donchenko Committed by OpenCV Buildbot

Merge pull request #1557 from ilya-lavrenov:ocl_minor_doc_update

parents df213241 dafd4da0
......@@ -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,32 +59,22 @@ 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
ocl::sqrSum
------------------
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.
Returns the squared sum of matrix elements for each channel
.. ocv:function:: Scalar ocl::absSum(const oclMat &m)
.. ocv:function:: Scalar ocl::sqrSum(const oclMat &m)
:param m: The Source image of all depth.
Counts the abs sum of matrix elements for each channel.
Counts the squared sum of matrix elements for each channel. Supports all data types.
ocl::sqrSum
ocl::sum
------------------
Returns the squared sum of matrix elements for each channel
Returns the sum of matrix elements for each channel
.. ocv:function:: Scalar ocl::sqrSum(const oclMat &m)
.. ocv:function:: Scalar ocl::sum(const oclMat &m)
:param m: The Source image of all depth.
Counts the squared sum of matrix elements for each channel.
Counts the sum of matrix elements for each channel.
This diff is collapsed.
......@@ -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));
......
......@@ -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,
}
}
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);
typedef void (*minMaxFunc)(const oclMat &src, double *minVal, double *maxVal, const oclMat &mask);
void cv::ocl::minMax_buf(const oclMat &src, double *minVal, double *maxVal, const oclMat &mask, oclMat &buf)
void cv::ocl::minMax(const oclMat &src, double *minVal, double *maxVal, const oclMat &mask)
{
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);
}
//////////////////////////////////////////////////////////////////////////////
......
......@@ -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_);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment