Commit 202e239c authored by Alexey Spizhevoy's avatar Alexey Spizhevoy

fixed GPU minMaxLoc test, updated docs

parent d7e612cd
......@@ -89,7 +89,7 @@ void minMax(const GpuMat\& src, double* minVal, double* maxVal,\par
\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{mask}{Optional mask to select a sub-matrix.}
\cvarg{mask}{Optional mask to select a sub-matrix. Please note the result is undefined in the case of empty mask.}
\cvarg{buf}{Optional buffer to avoid extra memory allocations. It's resized automatically.}
\end{description}
......@@ -112,7 +112,7 @@ void minMaxLoc(const GpuMat\& src, double* minVal, double* maxVal,\par
\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.}
\cvarg{mask}{Optional mask to select a sub-matrix.}
\cvarg{mask}{Optional mask to select a sub-matrix. Please note the result is undefined in the case of empty mask.}
\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.}
\end{description}
......
This diff is collapsed.
......@@ -829,6 +829,10 @@ struct CV_GpuMinMaxLocTest: public CvTest
cv::Mat mask(src.size(), CV_8U);
rng.fill(mask, RNG::UNIFORM, Scalar(0), Scalar(2));
// At least one of mask elements must be non zero as OpenCV returns 0
// in such case, our implementation returns max value
mask.at<unsigned char>(0, 0) = 1;
double minVal, maxVal;
cv::Point minLoc, maxLoc;
......@@ -855,6 +859,10 @@ struct CV_GpuMinMaxLocTest: public CvTest
cv::Point minLoc_, maxLoc_;
cv::gpu::minMaxLoc(cv::gpu::GpuMat(src), &minVal_, &maxVal_, &minLoc_, &maxLoc_, cv::gpu::GpuMat(mask), valbuf, locbuf);
cout << rows << " " << cols << " " << depth << endl;
cout << minVal << " " << minVal_ << endl;
cout << maxVal << " " << maxVal_ << endl;
CHECK(minVal == minVal_, CvTS::FAIL_INVALID_OUTPUT);
CHECK(maxVal == maxVal_, CvTS::FAIL_INVALID_OUTPUT);
CHECK(0 == memcmp(src.ptr(minLoc.y) + minLoc.x * src.elemSize(), src.ptr(minLoc_.y) + minLoc_.x * src.elemSize(), src.elemSize()),
......
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