Commit b7e6b5af authored by Vladislav Vinogradov's avatar Vladislav Vinogradov

fixed tests (call resetDevice, if there was a gpu failure)

parent 0773ab4d
This diff is collapsed.
...@@ -581,13 +581,12 @@ PERF_TEST_P(Sz, ImgProc_CalcHist, GPU_TYPICAL_MAT_SIZES) ...@@ -581,13 +581,12 @@ PERF_TEST_P(Sz, ImgProc_CalcHist, GPU_TYPICAL_MAT_SIZES)
{ {
cv::gpu::GpuMat d_src(src); cv::gpu::GpuMat d_src(src);
cv::gpu::GpuMat d_hist; cv::gpu::GpuMat d_hist;
cv::gpu::GpuMat d_buf;
cv::gpu::calcHist(d_src, d_hist, d_buf); cv::gpu::calcHist(d_src, d_hist);
TEST_CYCLE() TEST_CYCLE()
{ {
cv::gpu::calcHist(d_src, d_hist, d_buf); cv::gpu::calcHist(d_src, d_hist);
} }
GPU_SANITY_CHECK(d_hist); GPU_SANITY_CHECK(d_hist);
...@@ -1706,10 +1705,30 @@ PERF_TEST_P(Sz_Depth_Cn, ImgProc_ImagePyramidGetLayer, Combine(GPU_TYPICAL_MAT_S ...@@ -1706,10 +1705,30 @@ PERF_TEST_P(Sz_Depth_Cn, ImgProc_ImagePyramidGetLayer, Combine(GPU_TYPICAL_MAT_S
} }
} }
namespace {
struct Vec3fComparator
{
bool operator()(const cv::Vec3f& a, const cv::Vec3f b) const
{
if(a[0] != b[0]) return a[0] < b[0];
else if(a[1] != b[1]) return a[1] < b[1];
else return a[2] < b[2];
}
};
struct Vec2fComparator
{
bool operator()(const cv::Vec2f& a, const cv::Vec2f b) const
{
if(a[0] != b[0]) return a[0] < b[0];
else return a[1] < b[1];
}
};
}
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// HoughLines // HoughLines
PERF_TEST_P(Sz, DISABLED_ImgProc_HoughLines, GPU_TYPICAL_MAT_SIZES) PERF_TEST_P(Sz, ImgProc_HoughLines, GPU_TYPICAL_MAT_SIZES)
{ {
declare.time(30.0); declare.time(30.0);
...@@ -1744,7 +1763,11 @@ PERF_TEST_P(Sz, DISABLED_ImgProc_HoughLines, GPU_TYPICAL_MAT_SIZES) ...@@ -1744,7 +1763,11 @@ PERF_TEST_P(Sz, DISABLED_ImgProc_HoughLines, GPU_TYPICAL_MAT_SIZES)
cv::gpu::HoughLines(d_src, d_lines, d_buf, rho, theta, threshold); cv::gpu::HoughLines(d_src, d_lines, d_buf, rho, theta, threshold);
} }
GPU_SANITY_CHECK(d_lines); cv::Mat h_lines(d_lines);
cv::Vec2f* begin = (cv::Vec2f*)(h_lines.ptr<char>(0));
cv::Vec2f* end = (cv::Vec2f*)(h_lines.ptr<char>(0) + (h_lines.cols) * 2 * sizeof(float));
std::sort(begin, end, Vec2fComparator());
SANITY_CHECK(h_lines);
} }
else else
{ {
...@@ -1756,7 +1779,8 @@ PERF_TEST_P(Sz, DISABLED_ImgProc_HoughLines, GPU_TYPICAL_MAT_SIZES) ...@@ -1756,7 +1779,8 @@ PERF_TEST_P(Sz, DISABLED_ImgProc_HoughLines, GPU_TYPICAL_MAT_SIZES)
cv::HoughLines(src, lines, rho, theta, threshold); cv::HoughLines(src, lines, rho, theta, threshold);
} }
CPU_SANITY_CHECK(lines); std::sort(lines.begin(), lines.end(), Vec2fComparator());
SANITY_CHECK(lines);
} }
} }
...@@ -1804,7 +1828,11 @@ PERF_TEST_P(Sz_Dp_MinDist, ImgProc_HoughCircles, Combine(GPU_TYPICAL_MAT_SIZES, ...@@ -1804,7 +1828,11 @@ PERF_TEST_P(Sz_Dp_MinDist, ImgProc_HoughCircles, Combine(GPU_TYPICAL_MAT_SIZES,
cv::gpu::HoughCircles(d_src, d_circles, d_buf, CV_HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius); cv::gpu::HoughCircles(d_src, d_circles, d_buf, CV_HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius);
} }
GPU_SANITY_CHECK(d_circles); cv::Mat h_circles(d_circles);
cv::Vec3f* begin = (cv::Vec3f*)(h_circles.ptr<char>(0));
cv::Vec3f* end = (cv::Vec3f*)(h_circles.ptr<char>(0) + (h_circles.cols) * 3 * sizeof(float));
std::sort(begin, end, Vec3fComparator());
SANITY_CHECK(h_circles);
} }
else else
{ {
...@@ -1817,7 +1845,8 @@ PERF_TEST_P(Sz_Dp_MinDist, ImgProc_HoughCircles, Combine(GPU_TYPICAL_MAT_SIZES, ...@@ -1817,7 +1845,8 @@ PERF_TEST_P(Sz_Dp_MinDist, ImgProc_HoughCircles, Combine(GPU_TYPICAL_MAT_SIZES,
cv::HoughCircles(src, circles, CV_HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius); cv::HoughCircles(src, circles, CV_HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius);
} }
CPU_SANITY_CHECK(circles); std::sort(circles.begin(), circles.end(), Vec3fComparator());
SANITY_CHECK(circles);
} }
} }
......
...@@ -89,7 +89,6 @@ PERF_TEST_P(HOG, CalTech, Values<string>("gpu/caltech/image_00000009_0.png", "gp ...@@ -89,7 +89,6 @@ PERF_TEST_P(HOG, CalTech, Values<string>("gpu/caltech/image_00000009_0.png", "gp
SANITY_CHECK(found_locations); SANITY_CHECK(found_locations);
} }
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
// HaarClassifier // HaarClassifier
...@@ -181,4 +180,4 @@ PERF_TEST_P(ImageAndCascade, ObjDetect_LBPClassifier, ...@@ -181,4 +180,4 @@ PERF_TEST_P(ImageAndCascade, ObjDetect_LBPClassifier,
} }
} }
} // namespace } // namespace
\ No newline at end of file
...@@ -42,6 +42,9 @@ ...@@ -42,6 +42,9 @@
#ifndef __OPENCV_TEST_INTERPOLATION_HPP__ #ifndef __OPENCV_TEST_INTERPOLATION_HPP__
#define __OPENCV_TEST_INTERPOLATION_HPP__ #define __OPENCV_TEST_INTERPOLATION_HPP__
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
template <typename T> T readVal(const cv::Mat& src, int y, int x, int c, int border_type, cv::Scalar borderVal = cv::Scalar()) template <typename T> T readVal(const cv::Mat& src, int y, int x, int c, int border_type, cv::Scalar borderVal = cv::Scalar())
{ {
if (border_type == cv::BORDER_CONSTANT) if (border_type == cv::BORDER_CONSTANT)
...@@ -113,7 +116,7 @@ template <typename T> struct CubicInterpolator ...@@ -113,7 +116,7 @@ template <typename T> struct CubicInterpolator
for (float cx = xmin; cx <= xmax; cx += 1.0f) for (float cx = xmin; cx <= xmax; cx += 1.0f)
{ {
const float w = bicubicCoeff(x - cx) * bicubicCoeff(y - cy); const float w = bicubicCoeff(x - cx) * bicubicCoeff(y - cy);
sum += w * readVal<T>(src, cvFloor(cy), cvFloor(cx), c, border_type, borderVal); sum += w * readVal<T>(src, (int) floorf(cy), (int) floorf(cx), c, border_type, borderVal);
wsum += w; wsum += w;
} }
} }
......
...@@ -13,10 +13,50 @@ ...@@ -13,10 +13,50 @@
#include <float.h> #include <float.h>
#if defined(__GNUC__) && !defined(__APPLE__) #if defined(__GNUC__) && !defined(__APPLE__) && !defined(__arm__)
#include <fpu_control.h> #include <fpu_control.h>
#endif #endif
namespace
{
// http://www.christian-seiler.de/projekte/fpmath/
class FpuControl
{
public:
FpuControl();
~FpuControl();
private:
#if defined(__GNUC__) && !defined(__APPLE__) && !defined(__arm__)
fpu_control_t fpu_oldcw, fpu_cw;
#elif defined(_WIN32) && !defined(_WIN64)
unsigned int fpu_oldcw, fpu_cw;
#endif
};
FpuControl::FpuControl()
{
#if defined(__GNUC__) && !defined(__APPLE__) && !defined(__arm__)
_FPU_GETCW(fpu_oldcw);
fpu_cw = (fpu_oldcw & ~_FPU_EXTENDED & ~_FPU_DOUBLE & ~_FPU_SINGLE) | _FPU_SINGLE;
_FPU_SETCW(fpu_cw);
#elif defined(_WIN32) && !defined(_WIN64)
_controlfp_s(&fpu_cw, 0, 0);
fpu_oldcw = fpu_cw;
_controlfp_s(&fpu_cw, _PC_24, _MCW_PC);
#endif
}
FpuControl::~FpuControl()
{
#if defined(__GNUC__) && !defined(__APPLE__) && !defined(__arm__)
_FPU_SETCW(fpu_oldcw);
#elif defined(_WIN32) && !defined(_WIN64)
_controlfp_s(&fpu_cw, fpu_oldcw, _MCW_PC);
#endif
}
}
#include "TestHaarCascadeApplication.h" #include "TestHaarCascadeApplication.h"
#include "NCVHaarObjectDetection.hpp" #include "NCVHaarObjectDetection.hpp"
...@@ -47,12 +87,8 @@ bool TestHaarCascadeApplication::init() ...@@ -47,12 +87,8 @@ bool TestHaarCascadeApplication::init()
return true; return true;
} }
bool TestHaarCascadeApplication::process() bool TestHaarCascadeApplication::process()
{ {
#if defined(__APPLE)
return true;
#endif
NCVStatus ncvStat; NCVStatus ncvStat;
bool rcode = false; bool rcode = false;
...@@ -205,44 +241,19 @@ bool TestHaarCascadeApplication::process() ...@@ -205,44 +241,19 @@ bool TestHaarCascadeApplication::process()
} }
ncvAssertReturn(cudaSuccess == cudaStreamSynchronize(0), false); ncvAssertReturn(cudaSuccess == cudaStreamSynchronize(0), false);
#if !defined(__APPLE__) {
// calculations here
#if defined(__GNUC__) FpuControl fpu;
//http://www.christian-seiler.de/projekte/fpmath/ (void) fpu;
fpu_control_t fpu_oldcw, fpu_cw; ncvStat = ncvApplyHaarClassifierCascade_host(
_FPU_GETCW(fpu_oldcw); // store old cw h_integralImage, h_rectStdDev, h_pixelMask,
fpu_cw = (fpu_oldcw & ~_FPU_EXTENDED & ~_FPU_DOUBLE & ~_FPU_SINGLE) | _FPU_SINGLE; detectionsOnThisScale_h,
_FPU_SETCW(fpu_cw); haar, h_HaarStages, h_HaarNodes, h_HaarFeatures, false,
searchRoiU, 1, 1.0f);
// calculations here ncvAssertReturn(ncvStat == NCV_SUCCESS, false);
ncvStat = ncvApplyHaarClassifierCascade_host( }
h_integralImage, h_rectStdDev, h_pixelMask,
detectionsOnThisScale_h,
haar, h_HaarStages, h_HaarNodes, h_HaarFeatures, false,
searchRoiU, 1, 1.0f);
ncvAssertReturn(ncvStat == NCV_SUCCESS, false);
_FPU_SETCW(fpu_oldcw); // restore old cw
#else
#ifndef _WIN64
Ncv32u fpu_oldcw, fpu_cw;
_controlfp_s(&fpu_cw, 0, 0);
fpu_oldcw = fpu_cw;
_controlfp_s(&fpu_cw, _PC_24, _MCW_PC);
#endif
ncvStat = ncvApplyHaarClassifierCascade_host(
h_integralImage, h_rectStdDev, h_pixelMask,
detectionsOnThisScale_h,
haar, h_HaarStages, h_HaarNodes, h_HaarFeatures, false,
searchRoiU, 1, 1.0f);
ncvAssertReturn(ncvStat == NCV_SUCCESS, false);
#ifndef _WIN64
_controlfp_s(&fpu_cw, fpu_oldcw, _MCW_PC);
#endif
#endif
#endif
NCV_SKIP_COND_END NCV_SKIP_COND_END
int devId; int devId;
...@@ -302,4 +313,4 @@ bool TestHaarCascadeApplication::deinit() ...@@ -302,4 +313,4 @@ bool TestHaarCascadeApplication::deinit()
return true; return true;
} }
#endif /* CUDA_DISABLER */ #endif /* CUDA_DISABLER */
\ No newline at end of file
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "NCVAutoTestLister.hpp" #include "NCVAutoTestLister.hpp"
#include "NCVTestSourceProvider.hpp" #include "NCVTestSourceProvider.hpp"
#include <main_test_nvidia.h> #include "main_test_nvidia.h"
static std::string path; static std::string path;
...@@ -97,7 +97,7 @@ void generateRectStdDevTests(NCVAutoTestLister &testLister, NCVTestSourceProvide ...@@ -97,7 +97,7 @@ void generateRectStdDevTests(NCVAutoTestLister &testLister, NCVTestSourceProvide
template <class T> template <class T>
void generateResizeTests(NCVAutoTestLister &testLister, NCVTestSourceProvider<T> &src) void generateResizeTests(NCVAutoTestLister &testLister, NCVTestSourceProvider<T> &src)
{ {
for (Ncv32u i=1; i<480; i+=3) for (Ncv32u i=2; i<10; ++i)
{ {
char testName[80]; char testName[80];
sprintf(testName, "TestResize_VGA_s%d", i); sprintf(testName, "TestResize_VGA_s%d", i);
...@@ -105,7 +105,7 @@ void generateResizeTests(NCVAutoTestLister &testLister, NCVTestSourceProvider<T> ...@@ -105,7 +105,7 @@ void generateResizeTests(NCVAutoTestLister &testLister, NCVTestSourceProvider<T>
testLister.add(new TestResize<T>(testName, src, 640, 480, i, false)); testLister.add(new TestResize<T>(testName, src, 640, 480, i, false));
} }
for (Ncv32u i=1; i<1080; i+=5) for (Ncv32u i=2; i<10; ++i)
{ {
char testName[80]; char testName[80];
sprintf(testName, "TestResize_1080_s%d", i); sprintf(testName, "TestResize_1080_s%d", i);
...@@ -117,7 +117,7 @@ void generateResizeTests(NCVAutoTestLister &testLister, NCVTestSourceProvider<T> ...@@ -117,7 +117,7 @@ void generateResizeTests(NCVAutoTestLister &testLister, NCVTestSourceProvider<T>
void generateNPPSTVectorTests(NCVAutoTestLister &testLister, NCVTestSourceProvider<Ncv32u> &src, Ncv32u maxLength) void generateNPPSTVectorTests(NCVAutoTestLister &testLister, NCVTestSourceProvider<Ncv32u> &src, Ncv32u maxLength)
{ {
//compaction //compaction
for (Ncv32f _i=256.0; _i<maxLength; _i*=1.1f) for (Ncv32f _i=256.0; _i<maxLength; _i*=1.5f)
{ {
Ncv32u i = (Ncv32u)_i; Ncv32u i = (Ncv32u)_i;
char testName[80]; char testName[80];
...@@ -132,13 +132,13 @@ void generateNPPSTVectorTests(NCVAutoTestLister &testLister, NCVTestSourceProvid ...@@ -132,13 +132,13 @@ void generateNPPSTVectorTests(NCVAutoTestLister &testLister, NCVTestSourceProvid
testLister.add(new TestCompact(testName, src, i, 0xC001C0DE, 0)); testLister.add(new TestCompact(testName, src, i, 0xC001C0DE, 0));
testLister.add(new TestCompact(testName, src, i, 0xC001C0DE, 100)); testLister.add(new TestCompact(testName, src, i, 0xC001C0DE, 100));
} }
for (Ncv32u i=256*256-256; i<256*256+257; i++) for (Ncv32u i=256*256-10; i<256*256+10; i++)
{ {
char testName[80]; char testName[80];
sprintf(testName, "Compaction%d", i); sprintf(testName, "Compaction%d", i);
testLister.add(new TestCompact(testName, src, i, 0xFFFFFFFF, 40)); testLister.add(new TestCompact(testName, src, i, 0xFFFFFFFF, 40));
} }
for (Ncv32u i=256*256*256-10; i<256*256*256+10; i++) for (Ncv32u i=256*256*256-2; i<256*256*256+2; i++)
{ {
char testName[80]; char testName[80];
sprintf(testName, "Compaction%d", i); sprintf(testName, "Compaction%d", i);
...@@ -212,7 +212,7 @@ void generateDrawRectsTests(NCVAutoTestLister &testLister, ...@@ -212,7 +212,7 @@ void generateDrawRectsTests(NCVAutoTestLister &testLister,
void generateVectorTests(NCVAutoTestLister &testLister, NCVTestSourceProvider<Ncv32u> &src, Ncv32u maxLength) void generateVectorTests(NCVAutoTestLister &testLister, NCVTestSourceProvider<Ncv32u> &src, Ncv32u maxLength)
{ {
//growth //growth
for (Ncv32f _i=10.0; _i<maxLength; _i*=1.1f) for (Ncv32f _i=10.0; _i<maxLength; _i*=1.5f)
{ {
Ncv32u i = (Ncv32u)_i; Ncv32u i = (Ncv32u)_i;
char testName[80]; char testName[80];
...@@ -253,16 +253,16 @@ void generateHaarApplicationTests(NCVAutoTestLister &testLister, NCVTestSourcePr ...@@ -253,16 +253,16 @@ void generateHaarApplicationTests(NCVAutoTestLister &testLister, NCVTestSourcePr
Ncv32u maxWidth, Ncv32u maxHeight) Ncv32u maxWidth, Ncv32u maxHeight)
{ {
(void)maxHeight; (void)maxHeight;
for (Ncv32u i=20; i<512; i+=11) for (Ncv32u i=100; i<512; i+=41)
{ {
for (Ncv32u j=20; j<128; j+=5) for (Ncv32u j=100; j<128; j+=25)
{ {
char testName[80]; char testName[80];
sprintf(testName, "HaarAppl%d_%d", i, j); sprintf(testName, "HaarAppl%d_%d", i, j);
testLister.add(new TestHaarCascadeApplication(testName, src, path + "haarcascade_frontalface_alt.xml", j, i)); testLister.add(new TestHaarCascadeApplication(testName, src, path + "haarcascade_frontalface_alt.xml", j, i));
} }
} }
for (Ncv32f _i=20.0; _i<maxWidth; _i*=1.1f) for (Ncv32f _i=20.0; _i<maxWidth; _i*=1.5f)
{ {
Ncv32u i = (Ncv32u)_i; Ncv32u i = (Ncv32u)_i;
char testName[80]; char testName[80];
...@@ -276,6 +276,8 @@ static void devNullOutput(const std::string& msg) ...@@ -276,6 +276,8 @@ static void devNullOutput(const std::string& msg)
(void)msg; (void)msg;
} }
}
bool nvidia_NPPST_Integral_Image(const std::string& test_data_path, OutputLevel outputLevel) bool nvidia_NPPST_Integral_Image(const std::string& test_data_path, OutputLevel outputLevel)
{ {
path = test_data_path.c_str(); path = test_data_path.c_str();
...@@ -283,17 +285,15 @@ bool nvidia_NPPST_Integral_Image(const std::string& test_data_path, OutputLevel ...@@ -283,17 +285,15 @@ bool nvidia_NPPST_Integral_Image(const std::string& test_data_path, OutputLevel
NCVAutoTestLister testListerII("NPPST Integral Image", outputLevel); NCVAutoTestLister testListerII("NPPST Integral Image", outputLevel);
NCVTestSourceProvider<Ncv8u> testSrcRandom_8u(2010, 0, 255, 4096, 4096); NCVTestSourceProvider<Ncv8u> testSrcRandom_8u(2010, 0, 255, 2048, 2048);
NCVTestSourceProvider<Ncv32f> testSrcRandom_32f(2010, -1.0f, 1.0f, 4096, 4096); NCVTestSourceProvider<Ncv32f> testSrcRandom_32f(2010, -1.0f, 1.0f, 2048, 2048);
generateIntegralTests<Ncv8u, Ncv32u>(testListerII, testSrcRandom_8u, 4096, 4096); generateIntegralTests<Ncv8u, Ncv32u>(testListerII, testSrcRandom_8u, 2048, 2048);
generateIntegralTests<Ncv32f, Ncv32f>(testListerII, testSrcRandom_32f, 4096, 4096); generateIntegralTests<Ncv32f, Ncv32f>(testListerII, testSrcRandom_32f, 2048, 2048);
return testListerII.invoke(); return testListerII.invoke();
} }
}
bool nvidia_NPPST_Squared_Integral_Image(const std::string& test_data_path, OutputLevel outputLevel) bool nvidia_NPPST_Squared_Integral_Image(const std::string& test_data_path, OutputLevel outputLevel)
{ {
path = test_data_path; path = test_data_path;
...@@ -301,9 +301,9 @@ bool nvidia_NPPST_Squared_Integral_Image(const std::string& test_data_path, Outp ...@@ -301,9 +301,9 @@ bool nvidia_NPPST_Squared_Integral_Image(const std::string& test_data_path, Outp
NCVAutoTestLister testListerSII("NPPST Squared Integral Image", outputLevel); NCVAutoTestLister testListerSII("NPPST Squared Integral Image", outputLevel);
NCVTestSourceProvider<Ncv8u> testSrcRandom_8u(2010, 0, 255, 4096, 4096); NCVTestSourceProvider<Ncv8u> testSrcRandom_8u(2010, 0, 255, 2048, 2048);
generateSquaredIntegralTests(testListerSII, testSrcRandom_8u, 4096, 4096); generateSquaredIntegralTests(testListerSII, testSrcRandom_8u, 2048, 2048);
return testListerSII.invoke(); return testListerSII.invoke();
} }
...@@ -315,9 +315,9 @@ bool nvidia_NPPST_RectStdDev(const std::string& test_data_path, OutputLevel outp ...@@ -315,9 +315,9 @@ bool nvidia_NPPST_RectStdDev(const std::string& test_data_path, OutputLevel outp
NCVAutoTestLister testListerRStdDev("NPPST RectStdDev", outputLevel); NCVAutoTestLister testListerRStdDev("NPPST RectStdDev", outputLevel);
NCVTestSourceProvider<Ncv8u> testSrcRandom_8u(2010, 0, 255, 4096, 4096); NCVTestSourceProvider<Ncv8u> testSrcRandom_8u(2010, 0, 255, 2048, 2048);
generateRectStdDevTests(testListerRStdDev, testSrcRandom_8u, 4096, 4096); generateRectStdDevTests(testListerRStdDev, testSrcRandom_8u, 2048, 2048);
return testListerRStdDev.invoke(); return testListerRStdDev.invoke();
} }
...@@ -329,8 +329,8 @@ bool nvidia_NPPST_Resize(const std::string& test_data_path, OutputLevel outputLe ...@@ -329,8 +329,8 @@ bool nvidia_NPPST_Resize(const std::string& test_data_path, OutputLevel outputLe
NCVAutoTestLister testListerResize("NPPST Resize", outputLevel); NCVAutoTestLister testListerResize("NPPST Resize", outputLevel);
NCVTestSourceProvider<Ncv32u> testSrcRandom_32u(2010, 0, 0xFFFFFFFF, 4096, 4096); NCVTestSourceProvider<Ncv32u> testSrcRandom_32u(2010, 0, 0xFFFFFFFF, 2048, 2048);
NCVTestSourceProvider<Ncv64u> testSrcRandom_64u(2010, 0, -1, 4096, 4096); NCVTestSourceProvider<Ncv64u> testSrcRandom_64u(2010, 0, -1, 2048, 2048);
generateResizeTests(testListerResize, testSrcRandom_32u); generateResizeTests(testListerResize, testSrcRandom_32u);
generateResizeTests(testListerResize, testSrcRandom_64u); generateResizeTests(testListerResize, testSrcRandom_64u);
...@@ -345,9 +345,9 @@ bool nvidia_NPPST_Vector_Operations(const std::string& test_data_path, OutputLev ...@@ -345,9 +345,9 @@ bool nvidia_NPPST_Vector_Operations(const std::string& test_data_path, OutputLev
NCVAutoTestLister testListerNPPSTVectorOperations("NPPST Vector Operations", outputLevel); NCVAutoTestLister testListerNPPSTVectorOperations("NPPST Vector Operations", outputLevel);
NCVTestSourceProvider<Ncv32u> testSrcRandom_32u(2010, 0, 0xFFFFFFFF, 4096, 4096); NCVTestSourceProvider<Ncv32u> testSrcRandom_32u(2010, 0, 0xFFFFFFFF, 2048, 2048);
generateNPPSTVectorTests(testListerNPPSTVectorOperations, testSrcRandom_32u, 4096*4096); generateNPPSTVectorTests(testListerNPPSTVectorOperations, testSrcRandom_32u, 2048*2048);
return testListerNPPSTVectorOperations.invoke(); return testListerNPPSTVectorOperations.invoke();
} }
...@@ -359,8 +359,8 @@ bool nvidia_NPPST_Transpose(const std::string& test_data_path, OutputLevel outpu ...@@ -359,8 +359,8 @@ bool nvidia_NPPST_Transpose(const std::string& test_data_path, OutputLevel outpu
NCVAutoTestLister testListerTranspose("NPPST Transpose", outputLevel); NCVAutoTestLister testListerTranspose("NPPST Transpose", outputLevel);
NCVTestSourceProvider<Ncv32u> testSrcRandom_32u(2010, 0, 0xFFFFFFFF, 4096, 4096); NCVTestSourceProvider<Ncv32u> testSrcRandom_32u(2010, 0, 0xFFFFFFFF, 2048, 2048);
NCVTestSourceProvider<Ncv64u> testSrcRandom_64u(2010, 0, -1, 4096, 4096); NCVTestSourceProvider<Ncv64u> testSrcRandom_64u(2010, 0, -1, 2048, 2048);
generateTransposeTests(testListerTranspose, testSrcRandom_32u); generateTransposeTests(testListerTranspose, testSrcRandom_32u);
generateTransposeTests(testListerTranspose, testSrcRandom_64u); generateTransposeTests(testListerTranspose, testSrcRandom_64u);
...@@ -375,9 +375,9 @@ bool nvidia_NCV_Vector_Operations(const std::string& test_data_path, OutputLevel ...@@ -375,9 +375,9 @@ bool nvidia_NCV_Vector_Operations(const std::string& test_data_path, OutputLevel
NCVAutoTestLister testListerVectorOperations("Vector Operations", outputLevel); NCVAutoTestLister testListerVectorOperations("Vector Operations", outputLevel);
NCVTestSourceProvider<Ncv32u> testSrcRandom_32u(2010, 0, 0xFFFFFFFF, 4096, 4096); NCVTestSourceProvider<Ncv32u> testSrcRandom_32u(2010, 0, 0xFFFFFFFF, 2048, 2048);
generateVectorTests(testListerVectorOperations, testSrcRandom_32u, 4096*4096); generateVectorTests(testListerVectorOperations, testSrcRandom_32u, 2048*2048);
return testListerVectorOperations.invoke(); return testListerVectorOperations.invoke();
...@@ -404,7 +404,7 @@ bool nvidia_NCV_Haar_Cascade_Application(const std::string& test_data_path, Outp ...@@ -404,7 +404,7 @@ bool nvidia_NCV_Haar_Cascade_Application(const std::string& test_data_path, Outp
NCVTestSourceProvider<Ncv8u> testSrcFacesVGA_8u(path + "group_1_640x480_VGA.pgm"); NCVTestSourceProvider<Ncv8u> testSrcFacesVGA_8u(path + "group_1_640x480_VGA.pgm");
generateHaarApplicationTests(testListerHaarAppl, testSrcFacesVGA_8u, 1280, 720); generateHaarApplicationTests(testListerHaarAppl, testSrcFacesVGA_8u, 640, 480);
return testListerHaarAppl.invoke(); return testListerHaarAppl.invoke();
} }
...@@ -416,9 +416,9 @@ bool nvidia_NCV_Hypotheses_Filtration(const std::string& test_data_path, OutputL ...@@ -416,9 +416,9 @@ bool nvidia_NCV_Hypotheses_Filtration(const std::string& test_data_path, OutputL
NCVAutoTestLister testListerHypFiltration("Hypotheses Filtration", outputLevel); NCVAutoTestLister testListerHypFiltration("Hypotheses Filtration", outputLevel);
NCVTestSourceProvider<Ncv32u> testSrcRandom_32u(2010, 0, 0xFFFFFFFF, 4096, 4096); NCVTestSourceProvider<Ncv32u> testSrcRandom_32u(2010, 0, 0xFFFFFFFF, 2048, 2048);
generateHypothesesFiltrationTests(testListerHypFiltration, testSrcRandom_32u, 1024); generateHypothesesFiltrationTests(testListerHypFiltration, testSrcRandom_32u, 512);
return testListerHypFiltration.invoke(); return testListerHypFiltration.invoke();
} }
...@@ -430,13 +430,13 @@ bool nvidia_NCV_Visualization(const std::string& test_data_path, OutputLevel out ...@@ -430,13 +430,13 @@ bool nvidia_NCV_Visualization(const std::string& test_data_path, OutputLevel out
NCVAutoTestLister testListerVisualize("Visualization", outputLevel); NCVAutoTestLister testListerVisualize("Visualization", outputLevel);
NCVTestSourceProvider<Ncv8u> testSrcRandom_8u(2010, 0, 255, 4096, 4096); NCVTestSourceProvider<Ncv8u> testSrcRandom_8u(2010, 0, 255, 2048, 2048);
NCVTestSourceProvider<Ncv32u> testSrcRandom_32u(2010, 0, RAND_MAX, 4096, 4096); NCVTestSourceProvider<Ncv32u> testSrcRandom_32u(2010, 0, RAND_MAX, 2048, 2048);
generateDrawRectsTests(testListerVisualize, testSrcRandom_8u, testSrcRandom_32u, 4096, 4096); generateDrawRectsTests(testListerVisualize, testSrcRandom_8u, testSrcRandom_32u, 2048, 2048);
generateDrawRectsTests(testListerVisualize, testSrcRandom_32u, testSrcRandom_32u, 4096, 4096); generateDrawRectsTests(testListerVisualize, testSrcRandom_32u, testSrcRandom_32u, 2048, 2048);
return testListerVisualize.invoke(); return testListerVisualize.invoke();
} }
#endif /* CUDA_DISABLER */ #endif /* CUDA_DISABLER */
\ No newline at end of file
This diff is collapsed.
...@@ -43,8 +43,6 @@ ...@@ -43,8 +43,6 @@
#ifdef HAVE_CUDA #ifdef HAVE_CUDA
namespace {
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// StereoBM // StereoBM
...@@ -60,7 +58,7 @@ struct StereoBM : testing::TestWithParam<cv::gpu::DeviceInfo> ...@@ -60,7 +58,7 @@ struct StereoBM : testing::TestWithParam<cv::gpu::DeviceInfo>
} }
}; };
TEST_P(StereoBM, Regression) GPU_TEST_P(StereoBM, Regression)
{ {
cv::Mat left_image = readImage("stereobm/aloe-L.png", cv::IMREAD_GRAYSCALE); cv::Mat left_image = readImage("stereobm/aloe-L.png", cv::IMREAD_GRAYSCALE);
cv::Mat right_image = readImage("stereobm/aloe-R.png", cv::IMREAD_GRAYSCALE); cv::Mat right_image = readImage("stereobm/aloe-R.png", cv::IMREAD_GRAYSCALE);
...@@ -95,7 +93,7 @@ struct StereoBeliefPropagation : testing::TestWithParam<cv::gpu::DeviceInfo> ...@@ -95,7 +93,7 @@ struct StereoBeliefPropagation : testing::TestWithParam<cv::gpu::DeviceInfo>
} }
}; };
TEST_P(StereoBeliefPropagation, Regression) GPU_TEST_P(StereoBeliefPropagation, Regression)
{ {
cv::Mat left_image = readImage("stereobp/aloe-L.png"); cv::Mat left_image = readImage("stereobp/aloe-L.png");
cv::Mat right_image = readImage("stereobp/aloe-R.png"); cv::Mat right_image = readImage("stereobp/aloe-R.png");
...@@ -133,7 +131,7 @@ struct StereoConstantSpaceBP : testing::TestWithParam<cv::gpu::DeviceInfo> ...@@ -133,7 +131,7 @@ struct StereoConstantSpaceBP : testing::TestWithParam<cv::gpu::DeviceInfo>
} }
}; };
TEST_P(StereoConstantSpaceBP, Regression) GPU_TEST_P(StereoConstantSpaceBP, Regression)
{ {
cv::Mat left_image = readImage("csstereobp/aloe-L.png"); cv::Mat left_image = readImage("csstereobp/aloe-L.png");
cv::Mat right_image = readImage("csstereobp/aloe-R.png"); cv::Mat right_image = readImage("csstereobp/aloe-R.png");
...@@ -177,7 +175,7 @@ struct TransformPoints : testing::TestWithParam<cv::gpu::DeviceInfo> ...@@ -177,7 +175,7 @@ struct TransformPoints : testing::TestWithParam<cv::gpu::DeviceInfo>
} }
}; };
TEST_P(TransformPoints, Accuracy) GPU_TEST_P(TransformPoints, Accuracy)
{ {
cv::Mat src = randomMat(cv::Size(1000, 1), CV_32FC3, 0, 10); cv::Mat src = randomMat(cv::Size(1000, 1), CV_32FC3, 0, 10);
cv::Mat rvec = randomMat(cv::Size(3, 1), CV_32F, 0, 1); cv::Mat rvec = randomMat(cv::Size(3, 1), CV_32F, 0, 1);
...@@ -225,7 +223,7 @@ struct ProjectPoints : testing::TestWithParam<cv::gpu::DeviceInfo> ...@@ -225,7 +223,7 @@ struct ProjectPoints : testing::TestWithParam<cv::gpu::DeviceInfo>
} }
}; };
TEST_P(ProjectPoints, Accuracy) GPU_TEST_P(ProjectPoints, Accuracy)
{ {
cv::Mat src = randomMat(cv::Size(1000, 1), CV_32FC3, 0, 10); cv::Mat src = randomMat(cv::Size(1000, 1), CV_32FC3, 0, 10);
cv::Mat rvec = randomMat(cv::Size(3, 1), CV_32F, 0, 1); cv::Mat rvec = randomMat(cv::Size(3, 1), CV_32F, 0, 1);
...@@ -275,7 +273,7 @@ struct SolvePnPRansac : testing::TestWithParam<cv::gpu::DeviceInfo> ...@@ -275,7 +273,7 @@ struct SolvePnPRansac : testing::TestWithParam<cv::gpu::DeviceInfo>
} }
}; };
TEST_P(SolvePnPRansac, Accuracy) GPU_TEST_P(SolvePnPRansac, Accuracy)
{ {
cv::Mat object = randomMat(cv::Size(5000, 1), CV_32FC3, 0, 100); cv::Mat object = randomMat(cv::Size(5000, 1), CV_32FC3, 0, 100);
cv::Mat camera_mat = randomMat(cv::Size(3, 3), CV_32F, 0.5, 1); cv::Mat camera_mat = randomMat(cv::Size(3, 3), CV_32F, 0.5, 1);
...@@ -324,7 +322,7 @@ PARAM_TEST_CASE(ReprojectImageTo3D, cv::gpu::DeviceInfo, cv::Size, MatDepth, Use ...@@ -324,7 +322,7 @@ PARAM_TEST_CASE(ReprojectImageTo3D, cv::gpu::DeviceInfo, cv::Size, MatDepth, Use
} }
}; };
TEST_P(ReprojectImageTo3D, Accuracy) GPU_TEST_P(ReprojectImageTo3D, Accuracy)
{ {
cv::Mat disp = randomMat(size, depth, 5.0, 30.0); cv::Mat disp = randomMat(size, depth, 5.0, 30.0);
cv::Mat Q = randomMat(cv::Size(4, 4), CV_32FC1, 0.1, 1.0); cv::Mat Q = randomMat(cv::Size(4, 4), CV_32FC1, 0.1, 1.0);
...@@ -344,6 +342,4 @@ INSTANTIATE_TEST_CASE_P(GPU_Calib3D, ReprojectImageTo3D, testing::Combine( ...@@ -344,6 +342,4 @@ INSTANTIATE_TEST_CASE_P(GPU_Calib3D, ReprojectImageTo3D, testing::Combine(
testing::Values(MatDepth(CV_8U), MatDepth(CV_16S)), testing::Values(MatDepth(CV_8U), MatDepth(CV_16S)),
WHOLE_SUBMAT)); WHOLE_SUBMAT));
} // namespace
#endif // HAVE_CUDA #endif // HAVE_CUDA
This diff is collapsed.
...@@ -43,9 +43,10 @@ ...@@ -43,9 +43,10 @@
#ifdef HAVE_CUDA #ifdef HAVE_CUDA
namespace { namespace
{
IMPLEMENT_PARAM_CLASS(Border, int) IMPLEMENT_PARAM_CLASS(Border, int)
}
PARAM_TEST_CASE(CopyMakeBorder, cv::gpu::DeviceInfo, cv::Size, MatType, Border, BorderType, UseRoi) PARAM_TEST_CASE(CopyMakeBorder, cv::gpu::DeviceInfo, cv::Size, MatType, Border, BorderType, UseRoi)
{ {
...@@ -69,7 +70,7 @@ PARAM_TEST_CASE(CopyMakeBorder, cv::gpu::DeviceInfo, cv::Size, MatType, Border, ...@@ -69,7 +70,7 @@ PARAM_TEST_CASE(CopyMakeBorder, cv::gpu::DeviceInfo, cv::Size, MatType, Border,
} }
}; };
TEST_P(CopyMakeBorder, Accuracy) GPU_TEST_P(CopyMakeBorder, Accuracy)
{ {
cv::Mat src = randomMat(size, type); cv::Mat src = randomMat(size, type);
cv::Scalar val = randomScalar(0, 255); cv::Scalar val = randomScalar(0, 255);
...@@ -99,6 +100,4 @@ INSTANTIATE_TEST_CASE_P(GPU_ImgProc, CopyMakeBorder, testing::Combine( ...@@ -99,6 +100,4 @@ INSTANTIATE_TEST_CASE_P(GPU_ImgProc, CopyMakeBorder, testing::Combine(
ALL_BORDER_TYPES, ALL_BORDER_TYPES,
WHOLE_SUBMAT)); WHOLE_SUBMAT));
} // namespace
#endif // HAVE_CUDA #endif // HAVE_CUDA
This diff is collapsed.
...@@ -69,7 +69,7 @@ PARAM_TEST_CASE(BilateralFilter, cv::gpu::DeviceInfo, cv::Size, MatType) ...@@ -69,7 +69,7 @@ PARAM_TEST_CASE(BilateralFilter, cv::gpu::DeviceInfo, cv::Size, MatType)
} }
}; };
TEST_P(BilateralFilter, Accuracy) GPU_TEST_P(BilateralFilter, Accuracy)
{ {
cv::Mat src = randomMat(size, type); cv::Mat src = randomMat(size, type);
...@@ -105,7 +105,7 @@ struct BruteForceNonLocalMeans: testing::TestWithParam<cv::gpu::DeviceInfo> ...@@ -105,7 +105,7 @@ struct BruteForceNonLocalMeans: testing::TestWithParam<cv::gpu::DeviceInfo>
} }
}; };
TEST_P(BruteForceNonLocalMeans, Regression) GPU_TEST_P(BruteForceNonLocalMeans, Regression)
{ {
using cv::gpu::GpuMat; using cv::gpu::GpuMat;
...@@ -134,8 +134,6 @@ TEST_P(BruteForceNonLocalMeans, Regression) ...@@ -134,8 +134,6 @@ TEST_P(BruteForceNonLocalMeans, Regression)
INSTANTIATE_TEST_CASE_P(GPU_Denoising, BruteForceNonLocalMeans, ALL_DEVICES); INSTANTIATE_TEST_CASE_P(GPU_Denoising, BruteForceNonLocalMeans, ALL_DEVICES);
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
// Fast Force Non local means // Fast Force Non local means
...@@ -150,7 +148,7 @@ struct FastNonLocalMeans: testing::TestWithParam<cv::gpu::DeviceInfo> ...@@ -150,7 +148,7 @@ struct FastNonLocalMeans: testing::TestWithParam<cv::gpu::DeviceInfo>
} }
}; };
TEST_P(FastNonLocalMeans, Regression) GPU_TEST_P(FastNonLocalMeans, Regression)
{ {
using cv::gpu::GpuMat; using cv::gpu::GpuMat;
...@@ -167,8 +165,8 @@ TEST_P(FastNonLocalMeans, Regression) ...@@ -167,8 +165,8 @@ TEST_P(FastNonLocalMeans, Regression)
fnlmd.labMethod(GpuMat(bgr), dbgr, 20, 10); fnlmd.labMethod(GpuMat(bgr), dbgr, 20, 10);
#if 0 #if 0
//dumpImage("denoising/fnlm_denoised_lena_bgr.png", cv::Mat(dbgr)); dumpImage("denoising/fnlm_denoised_lena_bgr.png", cv::Mat(dbgr));
//dumpImage("denoising/fnlm_denoised_lena_gray.png", cv::Mat(dgray)); dumpImage("denoising/fnlm_denoised_lena_gray.png", cv::Mat(dgray));
#endif #endif
cv::Mat bgr_gold = readImage("denoising/fnlm_denoised_lena_bgr.png", cv::IMREAD_COLOR); cv::Mat bgr_gold = readImage("denoising/fnlm_denoised_lena_bgr.png", cv::IMREAD_COLOR);
...@@ -181,5 +179,4 @@ TEST_P(FastNonLocalMeans, Regression) ...@@ -181,5 +179,4 @@ TEST_P(FastNonLocalMeans, Regression)
INSTANTIATE_TEST_CASE_P(GPU_Denoising, FastNonLocalMeans, ALL_DEVICES); INSTANTIATE_TEST_CASE_P(GPU_Denoising, FastNonLocalMeans, ALL_DEVICES);
#endif // HAVE_CUDA #endif // HAVE_CUDA
This diff is collapsed.
...@@ -43,27 +43,30 @@ ...@@ -43,27 +43,30 @@
#ifdef HAVE_CUDA #ifdef HAVE_CUDA
namespace { namespace
IMPLEMENT_PARAM_CLASS(KSize, cv::Size)
cv::Mat getInnerROI(cv::InputArray m_, cv::Size ksize)
{ {
cv::Mat m = getMat(m_); IMPLEMENT_PARAM_CLASS(KSize, cv::Size)
cv::Rect roi(ksize.width, ksize.height, m.cols - 2 * ksize.width, m.rows - 2 * ksize.height); IMPLEMENT_PARAM_CLASS(Anchor, cv::Point)
return m(roi); IMPLEMENT_PARAM_CLASS(Deriv_X, int)
} IMPLEMENT_PARAM_CLASS(Deriv_Y, int)
IMPLEMENT_PARAM_CLASS(Iterations, int)
cv::Mat getInnerROI(cv::InputArray m, int ksize) cv::Mat getInnerROI(cv::InputArray m_, cv::Size ksize)
{ {
return getInnerROI(m, cv::Size(ksize, ksize)); cv::Mat m = getMat(m_);
cv::Rect roi(ksize.width, ksize.height, m.cols - 2 * ksize.width, m.rows - 2 * ksize.height);
return m(roi);
}
cv::Mat getInnerROI(cv::InputArray m, int ksize)
{
return getInnerROI(m, cv::Size(ksize, ksize));
}
} }
///////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////
// Blur // Blur
IMPLEMENT_PARAM_CLASS(Anchor, cv::Point)
PARAM_TEST_CASE(Blur, cv::gpu::DeviceInfo, cv::Size, MatType, KSize, Anchor, UseRoi) PARAM_TEST_CASE(Blur, cv::gpu::DeviceInfo, cv::Size, MatType, KSize, Anchor, UseRoi)
{ {
cv::gpu::DeviceInfo devInfo; cv::gpu::DeviceInfo devInfo;
...@@ -86,7 +89,7 @@ PARAM_TEST_CASE(Blur, cv::gpu::DeviceInfo, cv::Size, MatType, KSize, Anchor, Use ...@@ -86,7 +89,7 @@ PARAM_TEST_CASE(Blur, cv::gpu::DeviceInfo, cv::Size, MatType, KSize, Anchor, Use
} }
}; };
TEST_P(Blur, Accuracy) GPU_TEST_P(Blur, Accuracy)
{ {
cv::Mat src = randomMat(size, type); cv::Mat src = randomMat(size, type);
...@@ -110,36 +113,39 @@ INSTANTIATE_TEST_CASE_P(GPU_Filter, Blur, testing::Combine( ...@@ -110,36 +113,39 @@ INSTANTIATE_TEST_CASE_P(GPU_Filter, Blur, testing::Combine(
///////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////
// Sobel // Sobel
IMPLEMENT_PARAM_CLASS(Deriv_X, int) PARAM_TEST_CASE(Sobel, cv::gpu::DeviceInfo, cv::Size, MatDepth, Channels, KSize, Deriv_X, Deriv_Y, BorderType, UseRoi)
IMPLEMENT_PARAM_CLASS(Deriv_Y, int)
PARAM_TEST_CASE(Sobel, cv::gpu::DeviceInfo, cv::Size, MatType, KSize, Deriv_X, Deriv_Y, BorderType, UseRoi)
{ {
cv::gpu::DeviceInfo devInfo; cv::gpu::DeviceInfo devInfo;
cv::Size size; cv::Size size;
int type; int depth;
int cn;
cv::Size ksize; cv::Size ksize;
int dx; int dx;
int dy; int dy;
int borderType; int borderType;
bool useRoi; bool useRoi;
int type;
virtual void SetUp() virtual void SetUp()
{ {
devInfo = GET_PARAM(0); devInfo = GET_PARAM(0);
size = GET_PARAM(1); size = GET_PARAM(1);
type = GET_PARAM(2); depth = GET_PARAM(2);
ksize = GET_PARAM(3); cn = GET_PARAM(3);
dx = GET_PARAM(4); ksize = GET_PARAM(4);
dy = GET_PARAM(5); dx = GET_PARAM(5);
borderType = GET_PARAM(6); dy = GET_PARAM(6);
useRoi = GET_PARAM(7); borderType = GET_PARAM(7);
useRoi = GET_PARAM(8);
cv::gpu::setDevice(devInfo.deviceID()); cv::gpu::setDevice(devInfo.deviceID());
type = CV_MAKE_TYPE(depth, cn);
} }
}; };
TEST_P(Sobel, Accuracy) GPU_TEST_P(Sobel, Accuracy)
{ {
if (dx == 0 && dy == 0) if (dx == 0 && dy == 0)
return; return;
...@@ -152,13 +158,14 @@ TEST_P(Sobel, Accuracy) ...@@ -152,13 +158,14 @@ TEST_P(Sobel, Accuracy)
cv::Mat dst_gold; cv::Mat dst_gold;
cv::Sobel(src, dst_gold, -1, dx, dy, ksize.width, 1.0, 0.0, borderType); cv::Sobel(src, dst_gold, -1, dx, dy, ksize.width, 1.0, 0.0, borderType);
EXPECT_MAT_NEAR(dst_gold, dst, CV_MAT_DEPTH(type) < CV_32F ? 0.0 : 0.1); EXPECT_MAT_NEAR(getInnerROI(dst_gold, ksize), getInnerROI(dst, ksize), CV_MAT_DEPTH(type) < CV_32F ? 0.0 : 0.1);
} }
INSTANTIATE_TEST_CASE_P(GPU_Filter, Sobel, testing::Combine( INSTANTIATE_TEST_CASE_P(GPU_Filter, Sobel, testing::Combine(
ALL_DEVICES, ALL_DEVICES,
DIFFERENT_SIZES, DIFFERENT_SIZES,
testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4), MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)), testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_16S), MatDepth(CV_32F)),
IMAGE_CHANNELS,
testing::Values(KSize(cv::Size(3, 3)), KSize(cv::Size(5, 5)), KSize(cv::Size(7, 7))), testing::Values(KSize(cv::Size(3, 3)), KSize(cv::Size(5, 5)), KSize(cv::Size(7, 7))),
testing::Values(Deriv_X(0), Deriv_X(1), Deriv_X(2)), testing::Values(Deriv_X(0), Deriv_X(1), Deriv_X(2)),
testing::Values(Deriv_Y(0), Deriv_Y(1), Deriv_Y(2)), testing::Values(Deriv_Y(0), Deriv_Y(1), Deriv_Y(2)),
...@@ -171,31 +178,37 @@ INSTANTIATE_TEST_CASE_P(GPU_Filter, Sobel, testing::Combine( ...@@ -171,31 +178,37 @@ INSTANTIATE_TEST_CASE_P(GPU_Filter, Sobel, testing::Combine(
///////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////
// Scharr // Scharr
PARAM_TEST_CASE(Scharr, cv::gpu::DeviceInfo, cv::Size, MatType, Deriv_X, Deriv_Y, BorderType, UseRoi) PARAM_TEST_CASE(Scharr, cv::gpu::DeviceInfo, cv::Size, MatDepth, Channels, Deriv_X, Deriv_Y, BorderType, UseRoi)
{ {
cv::gpu::DeviceInfo devInfo; cv::gpu::DeviceInfo devInfo;
cv::Size size; cv::Size size;
int type; int depth;
int cn;
int dx; int dx;
int dy; int dy;
int borderType; int borderType;
bool useRoi; bool useRoi;
int type;
virtual void SetUp() virtual void SetUp()
{ {
devInfo = GET_PARAM(0); devInfo = GET_PARAM(0);
size = GET_PARAM(1); size = GET_PARAM(1);
type = GET_PARAM(2); depth = GET_PARAM(2);
dx = GET_PARAM(3); cn = GET_PARAM(3);
dy = GET_PARAM(4); dx = GET_PARAM(4);
borderType = GET_PARAM(5); dy = GET_PARAM(5);
useRoi = GET_PARAM(6); borderType = GET_PARAM(6);
useRoi = GET_PARAM(7);
cv::gpu::setDevice(devInfo.deviceID()); cv::gpu::setDevice(devInfo.deviceID());
type = CV_MAKE_TYPE(depth, cn);
} }
}; };
TEST_P(Scharr, Accuracy) GPU_TEST_P(Scharr, Accuracy)
{ {
if (dx + dy != 1) if (dx + dy != 1)
return; return;
...@@ -208,13 +221,14 @@ TEST_P(Scharr, Accuracy) ...@@ -208,13 +221,14 @@ TEST_P(Scharr, Accuracy)
cv::Mat dst_gold; cv::Mat dst_gold;
cv::Scharr(src, dst_gold, -1, dx, dy, 1.0, 0.0, borderType); cv::Scharr(src, dst_gold, -1, dx, dy, 1.0, 0.0, borderType);
EXPECT_MAT_NEAR(dst_gold, dst, CV_MAT_DEPTH(type) < CV_32F ? 0.0 : 0.1); EXPECT_MAT_NEAR(getInnerROI(dst_gold, cv::Size(3, 3)), getInnerROI(dst, cv::Size(3, 3)), CV_MAT_DEPTH(type) < CV_32F ? 0.0 : 0.1);
} }
INSTANTIATE_TEST_CASE_P(GPU_Filter, Scharr, testing::Combine( INSTANTIATE_TEST_CASE_P(GPU_Filter, Scharr, testing::Combine(
ALL_DEVICES, ALL_DEVICES,
DIFFERENT_SIZES, DIFFERENT_SIZES,
testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4), MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)), testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_16S), MatDepth(CV_32F)),
IMAGE_CHANNELS,
testing::Values(Deriv_X(0), Deriv_X(1)), testing::Values(Deriv_X(0), Deriv_X(1)),
testing::Values(Deriv_Y(0), Deriv_Y(1)), testing::Values(Deriv_Y(0), Deriv_Y(1)),
testing::Values(BorderType(cv::BORDER_REFLECT101), testing::Values(BorderType(cv::BORDER_REFLECT101),
...@@ -226,29 +240,35 @@ INSTANTIATE_TEST_CASE_P(GPU_Filter, Scharr, testing::Combine( ...@@ -226,29 +240,35 @@ INSTANTIATE_TEST_CASE_P(GPU_Filter, Scharr, testing::Combine(
///////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////
// GaussianBlur // GaussianBlur
PARAM_TEST_CASE(GaussianBlur, cv::gpu::DeviceInfo, cv::Size, MatType, KSize, BorderType, UseRoi) PARAM_TEST_CASE(GaussianBlur, cv::gpu::DeviceInfo, cv::Size, MatDepth, Channels, KSize, BorderType, UseRoi)
{ {
cv::gpu::DeviceInfo devInfo; cv::gpu::DeviceInfo devInfo;
cv::Size size; cv::Size size;
int type; int depth;
int cn;
cv::Size ksize; cv::Size ksize;
int borderType; int borderType;
bool useRoi; bool useRoi;
int type;
virtual void SetUp() virtual void SetUp()
{ {
devInfo = GET_PARAM(0); devInfo = GET_PARAM(0);
size = GET_PARAM(1); size = GET_PARAM(1);
type = GET_PARAM(2); depth = GET_PARAM(2);
ksize = GET_PARAM(3); cn = GET_PARAM(3);
borderType = GET_PARAM(4); ksize = GET_PARAM(4);
useRoi = GET_PARAM(5); borderType = GET_PARAM(5);
useRoi = GET_PARAM(6);
cv::gpu::setDevice(devInfo.deviceID()); cv::gpu::setDevice(devInfo.deviceID());
type = CV_MAKE_TYPE(depth, cn);
} }
}; };
TEST_P(GaussianBlur, Accuracy) GPU_TEST_P(GaussianBlur, Accuracy)
{ {
cv::Mat src = randomMat(size, type); cv::Mat src = randomMat(size, type);
double sigma1 = randomDouble(0.1, 1.0); double sigma1 = randomDouble(0.1, 1.0);
...@@ -281,7 +301,8 @@ TEST_P(GaussianBlur, Accuracy) ...@@ -281,7 +301,8 @@ TEST_P(GaussianBlur, Accuracy)
INSTANTIATE_TEST_CASE_P(GPU_Filter, GaussianBlur, testing::Combine( INSTANTIATE_TEST_CASE_P(GPU_Filter, GaussianBlur, testing::Combine(
ALL_DEVICES, ALL_DEVICES,
DIFFERENT_SIZES, DIFFERENT_SIZES,
testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4), MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)), testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_16S), MatDepth(CV_32F)),
IMAGE_CHANNELS,
testing::Values(KSize(cv::Size(3, 3)), testing::Values(KSize(cv::Size(3, 3)),
KSize(cv::Size(5, 5)), KSize(cv::Size(5, 5)),
KSize(cv::Size(7, 7)), KSize(cv::Size(7, 7)),
...@@ -326,7 +347,7 @@ PARAM_TEST_CASE(Laplacian, cv::gpu::DeviceInfo, cv::Size, MatType, KSize, UseRoi ...@@ -326,7 +347,7 @@ PARAM_TEST_CASE(Laplacian, cv::gpu::DeviceInfo, cv::Size, MatType, KSize, UseRoi
} }
}; };
TEST_P(Laplacian, Accuracy) GPU_TEST_P(Laplacian, Accuracy)
{ {
cv::Mat src = randomMat(size, type); cv::Mat src = randomMat(size, type);
...@@ -349,8 +370,6 @@ INSTANTIATE_TEST_CASE_P(GPU_Filter, Laplacian, testing::Combine( ...@@ -349,8 +370,6 @@ INSTANTIATE_TEST_CASE_P(GPU_Filter, Laplacian, testing::Combine(
///////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////
// Erode // Erode
IMPLEMENT_PARAM_CLASS(Iterations, int)
PARAM_TEST_CASE(Erode, cv::gpu::DeviceInfo, cv::Size, MatType, Anchor, Iterations, UseRoi) PARAM_TEST_CASE(Erode, cv::gpu::DeviceInfo, cv::Size, MatType, Anchor, Iterations, UseRoi)
{ {
cv::gpu::DeviceInfo devInfo; cv::gpu::DeviceInfo devInfo;
...@@ -373,7 +392,7 @@ PARAM_TEST_CASE(Erode, cv::gpu::DeviceInfo, cv::Size, MatType, Anchor, Iteration ...@@ -373,7 +392,7 @@ PARAM_TEST_CASE(Erode, cv::gpu::DeviceInfo, cv::Size, MatType, Anchor, Iteration
} }
}; };
TEST_P(Erode, Accuracy) GPU_TEST_P(Erode, Accuracy)
{ {
cv::Mat src = randomMat(size, type); cv::Mat src = randomMat(size, type);
cv::Mat kernel = cv::Mat::ones(3, 3, CV_8U); cv::Mat kernel = cv::Mat::ones(3, 3, CV_8U);
...@@ -422,7 +441,7 @@ PARAM_TEST_CASE(Dilate, cv::gpu::DeviceInfo, cv::Size, MatType, Anchor, Iteratio ...@@ -422,7 +441,7 @@ PARAM_TEST_CASE(Dilate, cv::gpu::DeviceInfo, cv::Size, MatType, Anchor, Iteratio
} }
}; };
TEST_P(Dilate, Accuracy) GPU_TEST_P(Dilate, Accuracy)
{ {
cv::Mat src = randomMat(size, type); cv::Mat src = randomMat(size, type);
cv::Mat kernel = cv::Mat::ones(3, 3, CV_8U); cv::Mat kernel = cv::Mat::ones(3, 3, CV_8U);
...@@ -476,7 +495,7 @@ PARAM_TEST_CASE(MorphEx, cv::gpu::DeviceInfo, cv::Size, MatType, MorphOp, Anchor ...@@ -476,7 +495,7 @@ PARAM_TEST_CASE(MorphEx, cv::gpu::DeviceInfo, cv::Size, MatType, MorphOp, Anchor
} }
}; };
TEST_P(MorphEx, Accuracy) GPU_TEST_P(MorphEx, Accuracy)
{ {
cv::Mat src = randomMat(size, type); cv::Mat src = randomMat(size, type);
cv::Mat kernel = cv::Mat::ones(3, 3, CV_8U); cv::Mat kernel = cv::Mat::ones(3, 3, CV_8U);
...@@ -530,7 +549,7 @@ PARAM_TEST_CASE(Filter2D, cv::gpu::DeviceInfo, cv::Size, MatType, KSize, Anchor, ...@@ -530,7 +549,7 @@ PARAM_TEST_CASE(Filter2D, cv::gpu::DeviceInfo, cv::Size, MatType, KSize, Anchor,
} }
}; };
TEST_P(Filter2D, Accuracy) GPU_TEST_P(Filter2D, Accuracy)
{ {
cv::Mat src = randomMat(size, type); cv::Mat src = randomMat(size, type);
cv::Mat kernel = randomMat(cv::Size(ksize.width, ksize.height), CV_32FC1, 0.0, 1.0); cv::Mat kernel = randomMat(cv::Size(ksize.width, ksize.height), CV_32FC1, 0.0, 1.0);
...@@ -553,6 +572,4 @@ INSTANTIATE_TEST_CASE_P(GPU_Filter, Filter2D, testing::Combine( ...@@ -553,6 +572,4 @@ INSTANTIATE_TEST_CASE_P(GPU_Filter, Filter2D, testing::Combine(
testing::Values(BorderType(cv::BORDER_REFLECT101), BorderType(cv::BORDER_REPLICATE), BorderType(cv::BORDER_CONSTANT), BorderType(cv::BORDER_REFLECT)), testing::Values(BorderType(cv::BORDER_REFLECT101), BorderType(cv::BORDER_REPLICATE), BorderType(cv::BORDER_CONSTANT), BorderType(cv::BORDER_REFLECT)),
WHOLE_SUBMAT)); WHOLE_SUBMAT));
} // namespace
#endif // HAVE_CUDA #endif // HAVE_CUDA
...@@ -51,7 +51,7 @@ struct CompactPoints : testing::TestWithParam<gpu::DeviceInfo> ...@@ -51,7 +51,7 @@ struct CompactPoints : testing::TestWithParam<gpu::DeviceInfo>
virtual void SetUp() { gpu::setDevice(GetParam().deviceID()); } virtual void SetUp() { gpu::setDevice(GetParam().deviceID()); }
}; };
TEST_P(CompactPoints, CanCompactizeSmallInput) GPU_TEST_P(CompactPoints, CanCompactizeSmallInput)
{ {
Mat src0(1, 3, CV_32FC2); Mat src0(1, 3, CV_32FC2);
src0.at<Point2f>(0,0) = Point2f(0,0); src0.at<Point2f>(0,0) = Point2f(0,0);
......
...@@ -44,8 +44,6 @@ ...@@ -44,8 +44,6 @@
#ifdef HAVE_CUDA #ifdef HAVE_CUDA
namespace {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// SetTo // SetTo
...@@ -67,7 +65,7 @@ PARAM_TEST_CASE(SetTo, cv::gpu::DeviceInfo, cv::Size, MatType, UseRoi) ...@@ -67,7 +65,7 @@ PARAM_TEST_CASE(SetTo, cv::gpu::DeviceInfo, cv::Size, MatType, UseRoi)
} }
}; };
TEST_P(SetTo, Zero) GPU_TEST_P(SetTo, Zero)
{ {
cv::Scalar zero = cv::Scalar::all(0); cv::Scalar zero = cv::Scalar::all(0);
...@@ -77,7 +75,7 @@ TEST_P(SetTo, Zero) ...@@ -77,7 +75,7 @@ TEST_P(SetTo, Zero)
EXPECT_MAT_NEAR(cv::Mat::zeros(size, type), mat, 0.0); EXPECT_MAT_NEAR(cv::Mat::zeros(size, type), mat, 0.0);
} }
TEST_P(SetTo, SameVal) GPU_TEST_P(SetTo, SameVal)
{ {
cv::Scalar val = cv::Scalar::all(randomDouble(0.0, 255.0)); cv::Scalar val = cv::Scalar::all(randomDouble(0.0, 255.0));
...@@ -102,7 +100,7 @@ TEST_P(SetTo, SameVal) ...@@ -102,7 +100,7 @@ TEST_P(SetTo, SameVal)
} }
} }
TEST_P(SetTo, DifferentVal) GPU_TEST_P(SetTo, DifferentVal)
{ {
cv::Scalar val = randomScalar(0.0, 255.0); cv::Scalar val = randomScalar(0.0, 255.0);
...@@ -127,7 +125,7 @@ TEST_P(SetTo, DifferentVal) ...@@ -127,7 +125,7 @@ TEST_P(SetTo, DifferentVal)
} }
} }
TEST_P(SetTo, Masked) GPU_TEST_P(SetTo, Masked)
{ {
cv::Scalar val = randomScalar(0.0, 255.0); cv::Scalar val = randomScalar(0.0, 255.0);
cv::Mat mat_gold = randomMat(size, type); cv::Mat mat_gold = randomMat(size, type);
...@@ -184,7 +182,7 @@ PARAM_TEST_CASE(CopyTo, cv::gpu::DeviceInfo, cv::Size, MatType, UseRoi) ...@@ -184,7 +182,7 @@ PARAM_TEST_CASE(CopyTo, cv::gpu::DeviceInfo, cv::Size, MatType, UseRoi)
} }
}; };
TEST_P(CopyTo, WithOutMask) GPU_TEST_P(CopyTo, WithOutMask)
{ {
cv::Mat src = randomMat(size, type); cv::Mat src = randomMat(size, type);
...@@ -195,7 +193,7 @@ TEST_P(CopyTo, WithOutMask) ...@@ -195,7 +193,7 @@ TEST_P(CopyTo, WithOutMask)
EXPECT_MAT_NEAR(src, dst, 0.0); EXPECT_MAT_NEAR(src, dst, 0.0);
} }
TEST_P(CopyTo, Masked) GPU_TEST_P(CopyTo, Masked)
{ {
cv::Mat src = randomMat(size, type); cv::Mat src = randomMat(size, type);
cv::Mat mask = randomMat(size, CV_8UC1, 0.0, 2.0); cv::Mat mask = randomMat(size, CV_8UC1, 0.0, 2.0);
...@@ -255,7 +253,7 @@ PARAM_TEST_CASE(ConvertTo, cv::gpu::DeviceInfo, cv::Size, MatDepth, MatDepth, Us ...@@ -255,7 +253,7 @@ PARAM_TEST_CASE(ConvertTo, cv::gpu::DeviceInfo, cv::Size, MatDepth, MatDepth, Us
} }
}; };
TEST_P(ConvertTo, WithOutScaling) GPU_TEST_P(ConvertTo, WithOutScaling)
{ {
cv::Mat src = randomMat(size, depth1); cv::Mat src = randomMat(size, depth1);
...@@ -285,7 +283,7 @@ TEST_P(ConvertTo, WithOutScaling) ...@@ -285,7 +283,7 @@ TEST_P(ConvertTo, WithOutScaling)
} }
} }
TEST_P(ConvertTo, WithScaling) GPU_TEST_P(ConvertTo, WithScaling)
{ {
cv::Mat src = randomMat(size, depth1); cv::Mat src = randomMat(size, depth1);
double a = randomDouble(0.0, 1.0); double a = randomDouble(0.0, 1.0);
...@@ -324,6 +322,4 @@ INSTANTIATE_TEST_CASE_P(GPU_GpuMat, ConvertTo, testing::Combine( ...@@ -324,6 +322,4 @@ INSTANTIATE_TEST_CASE_P(GPU_GpuMat, ConvertTo, testing::Combine(
ALL_DEPTH, ALL_DEPTH,
WHOLE_SUBMAT)); WHOLE_SUBMAT));
} // namespace
#endif // HAVE_CUDA #endif // HAVE_CUDA
...@@ -43,8 +43,6 @@ ...@@ -43,8 +43,6 @@
#ifdef HAVE_CUDA #ifdef HAVE_CUDA
namespace {
/////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////
// HoughLines // HoughLines
...@@ -79,7 +77,7 @@ PARAM_TEST_CASE(HoughLines, cv::gpu::DeviceInfo, cv::Size, UseRoi) ...@@ -79,7 +77,7 @@ PARAM_TEST_CASE(HoughLines, cv::gpu::DeviceInfo, cv::Size, UseRoi)
} }
}; };
TEST_P(HoughLines, Accuracy) GPU_TEST_P(HoughLines, Accuracy)
{ {
const cv::gpu::DeviceInfo devInfo = GET_PARAM(0); const cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::gpu::setDevice(devInfo.deviceID()); cv::gpu::setDevice(devInfo.deviceID());
...@@ -87,7 +85,7 @@ TEST_P(HoughLines, Accuracy) ...@@ -87,7 +85,7 @@ TEST_P(HoughLines, Accuracy)
const bool useRoi = GET_PARAM(2); const bool useRoi = GET_PARAM(2);
const float rho = 1.0f; const float rho = 1.0f;
const float theta = 1.5f * CV_PI / 180.0f; const float theta = (float) (1.5 * CV_PI / 180.0);
const int threshold = 100; const int threshold = 100;
cv::Mat src(size, CV_8UC1); cv::Mat src(size, CV_8UC1);
...@@ -124,7 +122,7 @@ PARAM_TEST_CASE(HoughCircles, cv::gpu::DeviceInfo, cv::Size, UseRoi) ...@@ -124,7 +122,7 @@ PARAM_TEST_CASE(HoughCircles, cv::gpu::DeviceInfo, cv::Size, UseRoi)
} }
}; };
TEST_P(HoughCircles, Accuracy) GPU_TEST_P(HoughCircles, Accuracy)
{ {
const cv::gpu::DeviceInfo devInfo = GET_PARAM(0); const cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::gpu::setDevice(devInfo.deviceID()); cv::gpu::setDevice(devInfo.deviceID());
...@@ -188,7 +186,7 @@ PARAM_TEST_CASE(GeneralizedHough, cv::gpu::DeviceInfo, UseRoi) ...@@ -188,7 +186,7 @@ PARAM_TEST_CASE(GeneralizedHough, cv::gpu::DeviceInfo, UseRoi)
{ {
}; };
TEST_P(GeneralizedHough, POSITION) GPU_TEST_P(GeneralizedHough, POSITION)
{ {
const cv::gpu::DeviceInfo devInfo = GET_PARAM(0); const cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::gpu::setDevice(devInfo.deviceID()); cv::gpu::setDevice(devInfo.deviceID());
...@@ -251,6 +249,4 @@ INSTANTIATE_TEST_CASE_P(GPU_ImgProc, GeneralizedHough, testing::Combine( ...@@ -251,6 +249,4 @@ INSTANTIATE_TEST_CASE_P(GPU_ImgProc, GeneralizedHough, testing::Combine(
ALL_DEVICES, ALL_DEVICES,
WHOLE_SUBMAT)); WHOLE_SUBMAT));
} // namespace
#endif // HAVE_CUDA #endif // HAVE_CUDA
This diff is collapsed.
...@@ -43,8 +43,8 @@ ...@@ -43,8 +43,8 @@
#ifdef HAVE_CUDA #ifdef HAVE_CUDA
namespace { namespace
{
struct GreedyLabeling struct GreedyLabeling
{ {
struct dot struct dot
...@@ -82,7 +82,7 @@ namespace { ...@@ -82,7 +82,7 @@ namespace {
int cc = -1; int cc = -1;
int* dist_labels = (int*)labels.data; int* dist_labels = (int*)labels.data;
int pitch = labels.step1(); int pitch = (int) labels.step1();
unsigned char* source = (unsigned char*)image.data; unsigned char* source = (unsigned char*)image.data;
int width = image.cols; int width = image.cols;
...@@ -166,7 +166,7 @@ struct Labeling : testing::TestWithParam<cv::gpu::DeviceInfo> ...@@ -166,7 +166,7 @@ struct Labeling : testing::TestWithParam<cv::gpu::DeviceInfo>
} }
}; };
TEST_P(Labeling, ConnectedComponents) GPU_TEST_P(Labeling, DISABLED_ConnectedComponents)
{ {
cv::Mat image; cv::Mat image;
cvtColor(loat_image(), image, CV_BGR2GRAY); cvtColor(loat_image(), image, CV_BGR2GRAY);
...@@ -186,11 +186,11 @@ TEST_P(Labeling, ConnectedComponents) ...@@ -186,11 +186,11 @@ TEST_P(Labeling, ConnectedComponents)
cv::gpu::connectivityMask(cv::gpu::GpuMat(image), mask, cv::Scalar::all(0), cv::Scalar::all(2)); cv::gpu::connectivityMask(cv::gpu::GpuMat(image), mask, cv::Scalar::all(0), cv::Scalar::all(2));
ASSERT_NO_THROW(cv::gpu::labelComponents(mask, components)); cv::gpu::labelComponents(mask, components);
host.checkCorrectness(cv::Mat(components)); host.checkCorrectness(cv::Mat(components));
} }
INSTANTIATE_TEST_CASE_P(ConnectedComponents, Labeling, ALL_DEVICES); INSTANTIATE_TEST_CASE_P(GPU_ConnectedComponents, Labeling, ALL_DEVICES);
#endif // HAVE_CUDA #endif // HAVE_CUDA
...@@ -41,11 +41,9 @@ ...@@ -41,11 +41,9 @@
#include "test_precomp.hpp" #include "test_precomp.hpp"
#if defined HAVE_CUDA #ifdef HAVE_CUDA
OutputLevel nvidiaTestOutputLevel = OutputLevelNone;
#endif
#if defined HAVE_CUDA && !defined(CUDA_DISABLER) OutputLevel nvidiaTestOutputLevel = OutputLevelNone;
using namespace cvtest; using namespace cvtest;
using namespace testing; using namespace testing;
...@@ -69,77 +67,77 @@ struct NVidiaTest : TestWithParam<cv::gpu::DeviceInfo> ...@@ -69,77 +67,77 @@ struct NVidiaTest : TestWithParam<cv::gpu::DeviceInfo>
struct NPPST : NVidiaTest {}; struct NPPST : NVidiaTest {};
struct NCV : NVidiaTest {}; struct NCV : NVidiaTest {};
//TEST_P(NPPST, Integral) GPU_TEST_P(NPPST, Integral)
//{ {
// bool res = nvidia_NPPST_Integral_Image(path, nvidiaTestOutputLevel); bool res = nvidia_NPPST_Integral_Image(_path, nvidiaTestOutputLevel);
// ASSERT_TRUE(res); ASSERT_TRUE(res);
//} }
TEST_P(NPPST, SquaredIntegral) GPU_TEST_P(NPPST, SquaredIntegral)
{ {
bool res = nvidia_NPPST_Squared_Integral_Image(_path, nvidiaTestOutputLevel); bool res = nvidia_NPPST_Squared_Integral_Image(_path, nvidiaTestOutputLevel);
ASSERT_TRUE(res); ASSERT_TRUE(res);
} }
TEST_P(NPPST, RectStdDev) GPU_TEST_P(NPPST, RectStdDev)
{ {
bool res = nvidia_NPPST_RectStdDev(_path, nvidiaTestOutputLevel); bool res = nvidia_NPPST_RectStdDev(_path, nvidiaTestOutputLevel);
ASSERT_TRUE(res); ASSERT_TRUE(res);
} }
TEST_P(NPPST, Resize) GPU_TEST_P(NPPST, Resize)
{ {
bool res = nvidia_NPPST_Resize(_path, nvidiaTestOutputLevel); bool res = nvidia_NPPST_Resize(_path, nvidiaTestOutputLevel);
ASSERT_TRUE(res); ASSERT_TRUE(res);
} }
TEST_P(NPPST, VectorOperations) GPU_TEST_P(NPPST, VectorOperations)
{ {
bool res = nvidia_NPPST_Vector_Operations(_path, nvidiaTestOutputLevel); bool res = nvidia_NPPST_Vector_Operations(_path, nvidiaTestOutputLevel);
ASSERT_TRUE(res); ASSERT_TRUE(res);
} }
TEST_P(NPPST, Transpose) GPU_TEST_P(NPPST, Transpose)
{ {
bool res = nvidia_NPPST_Transpose(_path, nvidiaTestOutputLevel); bool res = nvidia_NPPST_Transpose(_path, nvidiaTestOutputLevel);
ASSERT_TRUE(res); ASSERT_TRUE(res);
} }
TEST_P(NCV, VectorOperations) GPU_TEST_P(NCV, VectorOperations)
{ {
bool res = nvidia_NCV_Vector_Operations(_path, nvidiaTestOutputLevel); bool res = nvidia_NCV_Vector_Operations(_path, nvidiaTestOutputLevel);
ASSERT_TRUE(res); ASSERT_TRUE(res);
} }
TEST_P(NCV, HaarCascadeLoader) GPU_TEST_P(NCV, HaarCascadeLoader)
{ {
bool res = nvidia_NCV_Haar_Cascade_Loader(_path, nvidiaTestOutputLevel); bool res = nvidia_NCV_Haar_Cascade_Loader(_path, nvidiaTestOutputLevel);
ASSERT_TRUE(res); ASSERT_TRUE(res);
} }
TEST_P(NCV, HaarCascadeApplication) GPU_TEST_P(NCV, HaarCascadeApplication)
{ {
bool res = nvidia_NCV_Haar_Cascade_Application(_path, nvidiaTestOutputLevel); bool res = nvidia_NCV_Haar_Cascade_Application(_path, nvidiaTestOutputLevel);
ASSERT_TRUE(res); ASSERT_TRUE(res);
} }
TEST_P(NCV, HypothesesFiltration) GPU_TEST_P(NCV, HypothesesFiltration)
{ {
bool res = nvidia_NCV_Hypotheses_Filtration(_path, nvidiaTestOutputLevel); bool res = nvidia_NCV_Hypotheses_Filtration(_path, nvidiaTestOutputLevel);
ASSERT_TRUE(res); ASSERT_TRUE(res);
} }
TEST_P(NCV, Visualization) GPU_TEST_P(NCV, Visualization)
{ {
// this functionality doesn't used in gpu module // this functionality doesn't used in gpu module
bool res = nvidia_NCV_Visualization(_path, nvidiaTestOutputLevel); bool res = nvidia_NCV_Visualization(_path, nvidiaTestOutputLevel);
......
...@@ -43,8 +43,6 @@ ...@@ -43,8 +43,6 @@
#ifdef HAVE_CUDA #ifdef HAVE_CUDA
namespace {
//#define DUMP //#define DUMP
struct HOG : testing::TestWithParam<cv::gpu::DeviceInfo>, cv::gpu::HOGDescriptor struct HOG : testing::TestWithParam<cv::gpu::DeviceInfo>, cv::gpu::HOGDescriptor
...@@ -176,7 +174,7 @@ struct HOG : testing::TestWithParam<cv::gpu::DeviceInfo>, cv::gpu::HOGDescriptor ...@@ -176,7 +174,7 @@ struct HOG : testing::TestWithParam<cv::gpu::DeviceInfo>, cv::gpu::HOGDescriptor
}; };
// desabled while resize does not fixed // desabled while resize does not fixed
TEST_P(HOG, DISABLED_Detect) GPU_TEST_P(HOG, Detect)
{ {
cv::Mat img_rgb = readImage("hog/road.png"); cv::Mat img_rgb = readImage("hog/road.png");
ASSERT_FALSE(img_rgb.empty()); ASSERT_FALSE(img_rgb.empty());
...@@ -201,7 +199,7 @@ TEST_P(HOG, DISABLED_Detect) ...@@ -201,7 +199,7 @@ TEST_P(HOG, DISABLED_Detect)
f.close(); f.close();
} }
TEST_P(HOG, GetDescriptors) GPU_TEST_P(HOG, GetDescriptors)
{ {
// Load image (e.g. train data, composed from windows) // Load image (e.g. train data, composed from windows)
cv::Mat img_rgb = readImage("hog/train_data.png"); cv::Mat img_rgb = readImage("hog/train_data.png");
...@@ -288,6 +286,7 @@ TEST_P(HOG, GetDescriptors) ...@@ -288,6 +286,7 @@ TEST_P(HOG, GetDescriptors)
INSTANTIATE_TEST_CASE_P(GPU_ObjDetect, HOG, ALL_DEVICES); INSTANTIATE_TEST_CASE_P(GPU_ObjDetect, HOG, ALL_DEVICES);
//============== caltech hog tests =====================// //============== caltech hog tests =====================//
struct CalTech : public ::testing::TestWithParam<std::tr1::tuple<cv::gpu::DeviceInfo, std::string> > struct CalTech : public ::testing::TestWithParam<std::tr1::tuple<cv::gpu::DeviceInfo, std::string> >
{ {
cv::gpu::DeviceInfo devInfo; cv::gpu::DeviceInfo devInfo;
...@@ -303,7 +302,7 @@ struct CalTech : public ::testing::TestWithParam<std::tr1::tuple<cv::gpu::Device ...@@ -303,7 +302,7 @@ struct CalTech : public ::testing::TestWithParam<std::tr1::tuple<cv::gpu::Device
} }
}; };
TEST_P(CalTech, HOG) GPU_TEST_P(CalTech, HOG)
{ {
cv::gpu::GpuMat d_img(img); cv::gpu::GpuMat d_img(img);
cv::Mat markedImage(img.clone()); cv::Mat markedImage(img.clone());
...@@ -350,7 +349,7 @@ PARAM_TEST_CASE(LBP_Read_classifier, cv::gpu::DeviceInfo, int) ...@@ -350,7 +349,7 @@ PARAM_TEST_CASE(LBP_Read_classifier, cv::gpu::DeviceInfo, int)
} }
}; };
TEST_P(LBP_Read_classifier, Accuracy) GPU_TEST_P(LBP_Read_classifier, Accuracy)
{ {
cv::gpu::CascadeClassifier_GPU classifier; cv::gpu::CascadeClassifier_GPU classifier;
std::string classifierXmlPath = std::string(cvtest::TS::ptr()->get_data_path()) + "lbpcascade/lbpcascade_frontalface.xml"; std::string classifierXmlPath = std::string(cvtest::TS::ptr()->get_data_path()) + "lbpcascade/lbpcascade_frontalface.xml";
...@@ -372,7 +371,7 @@ PARAM_TEST_CASE(LBP_classify, cv::gpu::DeviceInfo, int) ...@@ -372,7 +371,7 @@ PARAM_TEST_CASE(LBP_classify, cv::gpu::DeviceInfo, int)
} }
}; };
TEST_P(LBP_classify, Accuracy) GPU_TEST_P(LBP_classify, Accuracy)
{ {
std::string classifierXmlPath = std::string(cvtest::TS::ptr()->get_data_path()) + "lbpcascade/lbpcascade_frontalface.xml"; std::string classifierXmlPath = std::string(cvtest::TS::ptr()->get_data_path()) + "lbpcascade/lbpcascade_frontalface.xml";
std::string imagePath = std::string(cvtest::TS::ptr()->get_data_path()) + "lbpcascade/er.png"; std::string imagePath = std::string(cvtest::TS::ptr()->get_data_path()) + "lbpcascade/er.png";
...@@ -422,6 +421,4 @@ TEST_P(LBP_classify, Accuracy) ...@@ -422,6 +421,4 @@ TEST_P(LBP_classify, Accuracy)
INSTANTIATE_TEST_CASE_P(GPU_ObjDetect, LBP_classify, INSTANTIATE_TEST_CASE_P(GPU_ObjDetect, LBP_classify,
testing::Combine(ALL_DEVICES, testing::Values<int>(0))); testing::Combine(ALL_DEVICES, testing::Values<int>(0)));
} // namespace
#endif // HAVE_CUDA #endif // HAVE_CUDA
This diff is collapsed.
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
#define __OPENCV_TEST_PRECOMP_HPP__ #define __OPENCV_TEST_PRECOMP_HPP__
#include <cmath> #include <cmath>
#include <ctime>
#include <cstdio> #include <cstdio>
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
......
...@@ -64,7 +64,7 @@ PARAM_TEST_CASE(PyrDown, cv::gpu::DeviceInfo, cv::Size, MatType, UseRoi) ...@@ -64,7 +64,7 @@ PARAM_TEST_CASE(PyrDown, cv::gpu::DeviceInfo, cv::Size, MatType, UseRoi)
} }
}; };
TEST_P(PyrDown, Accuracy) GPU_TEST_P(PyrDown, Accuracy)
{ {
cv::Mat src = randomMat(size, type); cv::Mat src = randomMat(size, type);
...@@ -104,7 +104,7 @@ PARAM_TEST_CASE(PyrUp, cv::gpu::DeviceInfo, cv::Size, MatType, UseRoi) ...@@ -104,7 +104,7 @@ PARAM_TEST_CASE(PyrUp, cv::gpu::DeviceInfo, cv::Size, MatType, UseRoi)
} }
}; };
TEST_P(PyrUp, Accuracy) GPU_TEST_P(PyrUp, Accuracy)
{ {
cv::Mat src = randomMat(size, type); cv::Mat src = randomMat(size, type);
......
...@@ -152,7 +152,7 @@ PARAM_TEST_CASE(Remap, cv::gpu::DeviceInfo, cv::Size, MatType, Interpolation, Bo ...@@ -152,7 +152,7 @@ PARAM_TEST_CASE(Remap, cv::gpu::DeviceInfo, cv::Size, MatType, Interpolation, Bo
} }
}; };
TEST_P(Remap, Accuracy) GPU_TEST_P(Remap, Accuracy)
{ {
cv::Mat src = randomMat(size, type); cv::Mat src = randomMat(size, type);
cv::Scalar val = randomScalar(0.0, 255.0); cv::Scalar val = randomScalar(0.0, 255.0);
......
...@@ -136,7 +136,7 @@ PARAM_TEST_CASE(Resize, cv::gpu::DeviceInfo, cv::Size, MatType, double, Interpol ...@@ -136,7 +136,7 @@ PARAM_TEST_CASE(Resize, cv::gpu::DeviceInfo, cv::Size, MatType, double, Interpol
} }
}; };
TEST_P(Resize, Accuracy) GPU_TEST_P(Resize, Accuracy)
{ {
cv::Mat src = randomMat(size, type); cv::Mat src = randomMat(size, type);
...@@ -157,8 +157,8 @@ INSTANTIATE_TEST_CASE_P(GPU_ImgProc, Resize, testing::Combine( ...@@ -157,8 +157,8 @@ INSTANTIATE_TEST_CASE_P(GPU_ImgProc, Resize, testing::Combine(
testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)), testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),
WHOLE_SUBMAT)); WHOLE_SUBMAT));
///////////////// /////////////////
PARAM_TEST_CASE(ResizeSameAsHost, cv::gpu::DeviceInfo, cv::Size, MatType, double, Interpolation, UseRoi) PARAM_TEST_CASE(ResizeSameAsHost, cv::gpu::DeviceInfo, cv::Size, MatType, double, Interpolation, UseRoi)
{ {
cv::gpu::DeviceInfo devInfo; cv::gpu::DeviceInfo devInfo;
...@@ -182,7 +182,7 @@ PARAM_TEST_CASE(ResizeSameAsHost, cv::gpu::DeviceInfo, cv::Size, MatType, double ...@@ -182,7 +182,7 @@ PARAM_TEST_CASE(ResizeSameAsHost, cv::gpu::DeviceInfo, cv::Size, MatType, double
}; };
// downscaling only: used for classifiers // downscaling only: used for classifiers
TEST_P(ResizeSameAsHost, Accuracy) GPU_TEST_P(ResizeSameAsHost, Accuracy)
{ {
cv::Mat src = randomMat(size, type); cv::Mat src = randomMat(size, type);
...@@ -224,7 +224,7 @@ PARAM_TEST_CASE(ResizeNPP, cv::gpu::DeviceInfo, MatType, double, Interpolation) ...@@ -224,7 +224,7 @@ PARAM_TEST_CASE(ResizeNPP, cv::gpu::DeviceInfo, MatType, double, Interpolation)
} }
}; };
TEST_P(ResizeNPP, Accuracy) GPU_TEST_P(ResizeNPP, Accuracy)
{ {
cv::Mat src = readImageType("stereobp/aloe-L.png", type); cv::Mat src = readImageType("stereobp/aloe-L.png", type);
ASSERT_FALSE(src.empty()); ASSERT_FALSE(src.empty());
......
...@@ -66,7 +66,7 @@ PARAM_TEST_CASE(Threshold, cv::gpu::DeviceInfo, cv::Size, MatType, ThreshOp, Use ...@@ -66,7 +66,7 @@ PARAM_TEST_CASE(Threshold, cv::gpu::DeviceInfo, cv::Size, MatType, ThreshOp, Use
} }
}; };
TEST_P(Threshold, Accuracy) GPU_TEST_P(Threshold, Accuracy)
{ {
cv::Mat src = randomMat(size, type); cv::Mat src = randomMat(size, type);
double maxVal = randomDouble(20.0, 127.0); double maxVal = randomDouble(20.0, 127.0);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#ifndef __OPENCV_GTESTCV_HPP__ #ifndef __OPENCV_GTESTCV_HPP__
#define __OPENCV_GTESTCV_HPP__ #define __OPENCV_GTESTCV_HPP__
#if HAVE_CVCONFIG_H #ifdef HAVE_CVCONFIG_H
#include "cvconfig.h" #include "cvconfig.h"
#endif #endif
#ifndef GTEST_CREATE_SHARED_LIBRARY #ifndef GTEST_CREATE_SHARED_LIBRARY
......
#include "precomp.hpp" #include "precomp.hpp"
#ifdef HAVE_CUDA
#include "opencv2/core/gpumat.hpp"
#endif
#ifdef ANDROID #ifdef ANDROID
# include <sys/time.h> # include <sys/time.h>
#endif #endif
...@@ -1160,6 +1164,10 @@ void TestBase::RunPerfTestBody() ...@@ -1160,6 +1164,10 @@ void TestBase::RunPerfTestBody()
catch(cv::Exception e) catch(cv::Exception e)
{ {
metrics.terminationReason = performance_metrics::TERM_EXCEPTION; metrics.terminationReason = performance_metrics::TERM_EXCEPTION;
#ifdef HAVE_CUDA
if (e.code == CV_GpuApiCallError)
cv::gpu::resetDevice();
#endif
FAIL() << "Expected: PerfTestBody() doesn't throw an exception.\n Actual: it throws cv::Exception:\n " << e.what(); FAIL() << "Expected: PerfTestBody() doesn't throw an exception.\n Actual: it throws cv::Exception:\n " << e.what();
} }
catch(std::exception e) catch(std::exception e)
......
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