1) gpu test refactoring.

2) fixed gpu bm test fail
3) CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3)
This commit is contained in:
Anatoly Baksheev 2010-11-26 17:24:12 +00:00
parent 7e2cc1be1b
commit fbdb4f4ab5
8 changed files with 103 additions and 94 deletions

View File

@ -7,8 +7,8 @@
# CUDA_NPP_LIBRARIES -- NPP libraries. # CUDA_NPP_LIBRARIES -- NPP libraries.
# NPP_VERSION -- NPP version in format "major.minor.build". # NPP_VERSION -- NPP version in format "major.minor.build".
# #
# If not found automatically, please set CUDA_NPP_LIBRARY_ROOT_DIR or # If not found automatically, please set CUDA_NPP_LIBRARY_ROOT_DIR
# set enviroment varivabe $CUDA_NPP_ROOT # in CMake or set enviroment varivabe $CUDA_NPP_ROOT
# #
# Author: Anatoly Baksheev, Itseez Ltd. # Author: Anatoly Baksheev, Itseez Ltd.
# #
@ -35,9 +35,8 @@
# #
############################################################################### ###############################################################################
# We need to have at least this version to support the VERSION_LESS argument to 'if' (2.6.2) and unset (2.6.3)
cmake_policy(PUSH) cmake_policy(PUSH)
cmake_minimum_required(VERSION 2.6.3) cmake_minimum_required(VERSION 2.8.3)
cmake_policy(POP) cmake_policy(POP)
if(NOT "${CUDA_NPP_LIBRARY_ROOT_DIR}" STREQUAL "${CUDA_NPP_LIBRARY_ROOT_DIR_INTERNAL}") if(NOT "${CUDA_NPP_LIBRARY_ROOT_DIR}" STREQUAL "${CUDA_NPP_LIBRARY_ROOT_DIR_INTERNAL}")

View File

@ -117,13 +117,13 @@ void CV_GpuArithmTest::run( int )
try try
{ {
const int types[] = {CV_8UC1, CV_8UC3, CV_8UC4, CV_32FC1}; const int types[] = {CV_8UC1, CV_8UC3, CV_8UC4, CV_32FC1};
const char* type_names[] = {"CV_8UC1", "CV_8UC3", "CV_8UC4", "CV_32FC1"}; const char* type_names[] = {"CV_8UC1 ", "CV_8UC3 ", "CV_8UC4 ", "CV_32FC1"};
const int type_count = sizeof(types)/sizeof(types[0]); const int type_count = sizeof(types)/sizeof(types[0]);
//run tests //run tests
for (int t = 0; t < type_count; ++t) for (int t = 0; t < type_count; ++t)
{ {
ts->printf(CvTS::LOG, "========Start test %s========\n", type_names[t]); ts->printf(CvTS::LOG, "Start testing %s", type_names[t]);
if (CvTS::OK == test(types[t])) if (CvTS::OK == test(types[t]))
ts->printf(CvTS::LOG, "SUCCESS\n"); ts->printf(CvTS::LOG, "SUCCESS\n");
@ -155,7 +155,7 @@ struct CV_GpuNppImageAddTest : public CV_GpuArithmTest
{ {
if (mat1.type() != CV_8UC1 && mat1.type() != CV_8UC4 && mat1.type() != CV_32FC1) if (mat1.type() != CV_8UC1 && mat1.type() != CV_8UC4 && mat1.type() != CV_32FC1)
{ {
ts->printf(CvTS::LOG, "\nUnsupported type\n"); ts->printf(CvTS::LOG, "\tUnsupported type\t");
return CvTS::OK; return CvTS::OK;
} }
@ -181,7 +181,7 @@ struct CV_GpuNppImageSubtractTest : public CV_GpuArithmTest
{ {
if (mat1.type() != CV_8UC1 && mat1.type() != CV_8UC4 && mat1.type() != CV_32FC1) if (mat1.type() != CV_8UC1 && mat1.type() != CV_8UC4 && mat1.type() != CV_32FC1)
{ {
ts->printf(CvTS::LOG, "\nUnsupported type\n"); ts->printf(CvTS::LOG, "\tUnsupported type\t");
return CvTS::OK; return CvTS::OK;
} }
@ -207,7 +207,7 @@ struct CV_GpuNppImageMultiplyTest : public CV_GpuArithmTest
{ {
if (mat1.type() != CV_8UC1 && mat1.type() != CV_8UC4 && mat1.type() != CV_32FC1) if (mat1.type() != CV_8UC1 && mat1.type() != CV_8UC4 && mat1.type() != CV_32FC1)
{ {
ts->printf(CvTS::LOG, "\nUnsupported type\n"); ts->printf(CvTS::LOG, "\tUnsupported type\t");
return CvTS::OK; return CvTS::OK;
} }
@ -233,7 +233,7 @@ struct CV_GpuNppImageDivideTest : public CV_GpuArithmTest
{ {
if (mat1.type() != CV_8UC1 && mat1.type() != CV_8UC4 && mat1.type() != CV_32FC1) if (mat1.type() != CV_8UC1 && mat1.type() != CV_8UC4 && mat1.type() != CV_32FC1)
{ {
ts->printf(CvTS::LOG, "\nUnsupported type\n"); ts->printf(CvTS::LOG, "\tUnsupported type\t");
return CvTS::OK; return CvTS::OK;
} }
@ -259,7 +259,7 @@ struct CV_GpuNppImageTransposeTest : public CV_GpuArithmTest
{ {
if (mat1.type() != CV_8UC1) if (mat1.type() != CV_8UC1)
{ {
ts->printf(CvTS::LOG, "\nUnsupported type\n"); ts->printf(CvTS::LOG, "\tUnsupported type\t");
return CvTS::OK; return CvTS::OK;
} }
@ -284,7 +284,7 @@ struct CV_GpuNppImageAbsdiffTest : public CV_GpuArithmTest
{ {
if (mat1.type() != CV_8UC1 && mat1.type() != CV_8UC4 && mat1.type() != CV_32FC1) if (mat1.type() != CV_8UC1 && mat1.type() != CV_8UC4 && mat1.type() != CV_32FC1)
{ {
ts->printf(CvTS::LOG, "\nUnsupported type\n"); ts->printf(CvTS::LOG, "\tUnsupported type\t");
return CvTS::OK; return CvTS::OK;
} }
@ -310,7 +310,7 @@ struct CV_GpuNppImageCompareTest : public CV_GpuArithmTest
{ {
if (mat1.type() != CV_32FC1) if (mat1.type() != CV_32FC1)
{ {
ts->printf(CvTS::LOG, "\nUnsupported type\n"); ts->printf(CvTS::LOG, "\tUnsupported type\t");
return CvTS::OK; return CvTS::OK;
} }
@ -350,7 +350,7 @@ struct CV_GpuNppImageMeanStdDevTest : public CV_GpuArithmTest
{ {
if (mat1.type() != CV_8UC1) if (mat1.type() != CV_8UC1)
{ {
ts->printf(CvTS::LOG, "\nUnsupported type\n"); ts->printf(CvTS::LOG, "\tUnsupported type\t");
return CvTS::OK; return CvTS::OK;
} }
@ -391,7 +391,7 @@ struct CV_GpuNppImageNormTest : public CV_GpuArithmTest
{ {
if (mat1.type() != CV_8UC1) if (mat1.type() != CV_8UC1)
{ {
ts->printf(CvTS::LOG, "\nUnsupported type\n"); ts->printf(CvTS::LOG, "\tUnsupported type\t");
return CvTS::OK; return CvTS::OK;
} }
@ -429,7 +429,7 @@ struct CV_GpuNppImageFlipTest : public CV_GpuArithmTest
{ {
if (mat1.type() != CV_8UC1 && mat1.type() != CV_8UC4) if (mat1.type() != CV_8UC1 && mat1.type() != CV_8UC4)
{ {
ts->printf(CvTS::LOG, "\nUnsupported type\n"); ts->printf(CvTS::LOG, "\tUnsupported type\t");
return CvTS::OK; return CvTS::OK;
} }
@ -468,7 +468,7 @@ struct CV_GpuNppImageSumTest : public CV_GpuArithmTest
{ {
if (mat1.type() != CV_8UC1 && mat1.type() != CV_8UC4) if (mat1.type() != CV_8UC1 && mat1.type() != CV_8UC4)
{ {
ts->printf(CvTS::LOG, "\nUnsupported type\n"); ts->printf(CvTS::LOG, "\tUnsupported type\t");
return CvTS::OK; return CvTS::OK;
} }
@ -491,7 +491,7 @@ struct CV_GpuNppImageLUTTest : public CV_GpuArithmTest
{ {
if (mat1.type() != CV_8UC1 && mat1.type() != CV_8UC3) if (mat1.type() != CV_8UC1 && mat1.type() != CV_8UC3)
{ {
ts->printf(CvTS::LOG, "\nUnsupported type\n"); ts->printf(CvTS::LOG, "\tUnsupported type\t");
return CvTS::OK; return CvTS::OK;
} }
@ -519,7 +519,7 @@ struct CV_GpuNppImageExpTest : public CV_GpuArithmTest
{ {
if (mat1.type() != CV_32FC1) if (mat1.type() != CV_32FC1)
{ {
ts->printf(CvTS::LOG, "\nUnsupported type\n"); ts->printf(CvTS::LOG, "\tUnsupported type\t");
return CvTS::OK; return CvTS::OK;
} }
@ -544,7 +544,7 @@ struct CV_GpuNppImageLogTest : public CV_GpuArithmTest
{ {
if (mat1.type() != CV_32FC1) if (mat1.type() != CV_32FC1)
{ {
ts->printf(CvTS::LOG, "\nUnsupported type\n"); ts->printf(CvTS::LOG, "\tUnsupported type\t");
return CvTS::OK; return CvTS::OK;
} }
@ -569,7 +569,7 @@ struct CV_GpuNppImageMagnitudeTest : public CV_GpuArithmTest
{ {
if (mat1.type() != CV_32FC1) if (mat1.type() != CV_32FC1)
{ {
ts->printf(CvTS::LOG, "\nUnsupported type\n"); ts->printf(CvTS::LOG, "\tUnsupported type\t");
return CvTS::OK; return CvTS::OK;
} }
@ -595,7 +595,7 @@ struct CV_GpuNppImagePhaseTest : public CV_GpuArithmTest
{ {
if (mat1.type() != CV_32FC1) if (mat1.type() != CV_32FC1)
{ {
ts->printf(CvTS::LOG, "\nUnsupported type\n"); ts->printf(CvTS::LOG, "\tUnsupported type\t");
return CvTS::OK; return CvTS::OK;
} }
@ -621,7 +621,7 @@ struct CV_GpuNppImageCartToPolarTest : public CV_GpuArithmTest
{ {
if (mat1.type() != CV_32FC1) if (mat1.type() != CV_32FC1)
{ {
ts->printf(CvTS::LOG, "\nUnsupported type\n"); ts->printf(CvTS::LOG, "\tUnsupported type\t");
return CvTS::OK; return CvTS::OK;
} }
@ -650,7 +650,7 @@ struct CV_GpuNppImagePolarToCartTest : public CV_GpuArithmTest
{ {
if (mat1.type() != CV_32FC1) if (mat1.type() != CV_32FC1)
{ {
ts->printf(CvTS::LOG, "\nUnsupported type\n"); ts->printf(CvTS::LOG, "\tUnsupported type\t");
return CvTS::OK; return CvTS::OK;
} }

View File

@ -83,7 +83,7 @@ protected:
if (res <= 1) if (res <= 1)
return CvTS::OK; return CvTS::OK;
ts->printf(CvTS::LOG, "\nNorm: %f\n", res); ts->printf(CvTS::LOG, "Norm: %f\n", res);
return CvTS::FAIL_GENERIC; return CvTS::FAIL_GENERIC;
} }
}; };
@ -244,7 +244,7 @@ struct CV_GpuNppImageGaussianBlurTest : public CV_GpuNppFilterTest
{ {
cv::Size ksize(ksizes[i], ksizes[j]); cv::Size ksize(ksizes[i], ksizes[j]);
ts->printf(CvTS::LOG, "\nksize = (%dx%d)\n", ksizes[i], ksizes[j]); ts->printf(CvTS::LOG, "ksize = (%dx%d)\t", ksizes[i], ksizes[j]);
Mat cpudst; Mat cpudst;
cv::GaussianBlur(img, cpudst, ksize, sigma1); cv::GaussianBlur(img, cpudst, ksize, sigma1);

View File

@ -45,7 +45,7 @@ CvTS test_system("gpu");
const char* blacklist[] = const char* blacklist[] =
{ {
"GPU-MatOperatorAsyncCall", // crash "GPU-AsyncGpuMatOperator", // crash
"GPU-NppImageSum", // crash, probably npp bug "GPU-NppImageSum", // crash, probably npp bug

View File

@ -112,7 +112,7 @@ int CV_GpuImageProcTest::CheckNorm(const Mat& m1, const Mat& m2)
} }
else else
{ {
ts->printf(CvTS::LOG, "\nNorm: %f\n", ret); ts->printf(CvTS::LOG, "Norm: %f\n", ret);
return CvTS::FAIL_GENERIC; return CvTS::FAIL_GENERIC;
} }
} }
@ -134,37 +134,37 @@ void CV_GpuImageProcTest::run( int )
//run tests //run tests
ts->printf(CvTS::LOG, "\n========Start test 8UC1========\n"); ts->printf(CvTS::LOG, "\n========Start test 8UC1========\n");
if (test8UC1(img) == CvTS::OK) if (test8UC1(img) == CvTS::OK)
ts->printf(CvTS::LOG, "\nSUCCESS\n"); ts->printf(CvTS::LOG, "SUCCESS\n");
else else
{ {
ts->printf(CvTS::LOG, "\nFAIL\n"); ts->printf(CvTS::LOG, "FAIL\n");
testResult = CvTS::FAIL_GENERIC; testResult = CvTS::FAIL_GENERIC;
} }
ts->printf(CvTS::LOG, "\n========Start test 8UC4========\n"); ts->printf(CvTS::LOG, "\n========Start test 8UC4========\n");
if (test8UC4(img) == CvTS::OK) if (test8UC4(img) == CvTS::OK)
ts->printf(CvTS::LOG, "\nSUCCESS\n"); ts->printf(CvTS::LOG, "SUCCESS\n");
else else
{ {
ts->printf(CvTS::LOG, "\nFAIL\n"); ts->printf(CvTS::LOG, "FAIL\n");
testResult = CvTS::FAIL_GENERIC; testResult = CvTS::FAIL_GENERIC;
} }
ts->printf(CvTS::LOG, "\n========Start test 32SC1========\n"); ts->printf(CvTS::LOG, "\n========Start test 32SC1========\n");
if (test32SC1(img) == CvTS::OK) if (test32SC1(img) == CvTS::OK)
ts->printf(CvTS::LOG, "\nSUCCESS\n"); ts->printf(CvTS::LOG, "SUCCESS\n");
else else
{ {
ts->printf(CvTS::LOG, "\nFAIL\n"); ts->printf(CvTS::LOG, "FAIL\n");
testResult = CvTS::FAIL_GENERIC; testResult = CvTS::FAIL_GENERIC;
} }
ts->printf(CvTS::LOG, "\n========Start test 32FC1========\n"); ts->printf(CvTS::LOG, "\n========Start test 32FC1========\n");
if (test32FC1(img) == CvTS::OK) if (test32FC1(img) == CvTS::OK)
ts->printf(CvTS::LOG, "\nSUCCESS\n"); ts->printf(CvTS::LOG, "SUCCESS\n");
else else
{ {
ts->printf(CvTS::LOG, "\nFAIL\n"); ts->printf(CvTS::LOG, "FAIL\n");
testResult = CvTS::FAIL_GENERIC; testResult = CvTS::FAIL_GENERIC;
} }
} }
@ -216,7 +216,7 @@ struct CV_GpuNppImageResizeTest : public CV_GpuImageProcTest
{ {
if (img.type() != CV_8UC1 && img.type() != CV_8UC4) if (img.type() != CV_8UC1 && img.type() != CV_8UC4)
{ {
ts->printf(CvTS::LOG, "\nUnsupported type\n"); ts->printf(CvTS::LOG, "Unsupported type\n");
return CvTS::OK; return CvTS::OK;
} }
@ -228,7 +228,7 @@ struct CV_GpuNppImageResizeTest : public CV_GpuImageProcTest
for (int i = 0; i < interpolations_num; ++i) for (int i = 0; i < interpolations_num; ++i)
{ {
ts->printf(CvTS::LOG, "\nInterpolation type: %s\n", interpolations_str[i]); ts->printf(CvTS::LOG, "Interpolation: %s\n", interpolations_str[i]);
Mat cpu_res; Mat cpu_res;
cv::resize(img, cpu_res, Size(), 0.5, 0.5, interpolations[i]); cv::resize(img, cpu_res, Size(), 0.5, 0.5, interpolations[i]);

View File

@ -52,16 +52,16 @@ using namespace cv;
using namespace std; using namespace std;
using namespace gpu; using namespace gpu;
class CV_GpuMatAsyncCallTest : public CvTest class CV_AsyncGpuMatTest : public CvTest
{ {
public: public:
CV_GpuMatAsyncCallTest() : CvTest( "GPU-MatOperatorAsyncCall", "async" ) CV_AsyncGpuMatTest() : CvTest( "GPU-AsyncGpuMatOperator", "async" )
{ {
rows = 234; rows = 234;
cols = 123; cols = 123;
} }
~CV_GpuMatAsyncCallTest() {} ~CV_AsyncGpuMatTest() {}
protected: protected:
void run(int); void run(int);
@ -75,9 +75,9 @@ class CV_GpuMatAsyncCallTest : public CvTest
}; };
template<typename T> template<typename T>
void CV_GpuMatAsyncCallTest::print_mat(const T & mat, const std::string & name) const { cv::imshow(name, mat); } void CV_AsyncGpuMatTest::print_mat(const T & mat, const std::string & name) const { cv::imshow(name, mat); }
bool CV_GpuMatAsyncCallTest::compare_matrix(cv::Mat & cpumat) bool CV_AsyncGpuMatTest::compare_matrix(cv::Mat & cpumat)
{ {
Mat cmat(cpumat.size(), cpumat.type(), Scalar::all(0)); Mat cmat(cpumat.size(), cpumat.type(), Scalar::all(0));
GpuMat gmat0(cmat); GpuMat gmat0(cmat);
@ -125,7 +125,7 @@ bool CV_GpuMatAsyncCallTest::compare_matrix(cv::Mat & cpumat)
} }
} }
void CV_GpuMatAsyncCallTest::run( int /* start_from */) void CV_AsyncGpuMatTest::run( int /* start_from */)
{ {
bool is_test_good = true; bool is_test_good = true;
@ -155,4 +155,4 @@ void CV_GpuMatAsyncCallTest::run( int /* start_from */)
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
CV_GpuMatAsyncCallTest CV_GpuMatAsyncCall_test; CV_AsyncGpuMatTest CV_AsyncGpuMatTest_test;

View File

@ -43,6 +43,7 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include "opencv2/highgui/highgui.hpp"
struct CV_GpuStereoBMTest : public CvTest struct CV_GpuStereoBMTest : public CvTest
{ {
@ -70,6 +71,15 @@ struct CV_GpuStereoBMTest : public CvTest
disp.convertTo(disp, img_reference.type()); disp.convertTo(disp, img_reference.type());
double norm = cv::norm(disp, img_reference, cv::NORM_INF); double norm = cv::norm(disp, img_reference, cv::NORM_INF);
//cv::imwrite(std::string(ts->get_data_path()) + "stereobm/aloe-disp.png", disp);
/*cv::imshow("disp", disp);
cv::imshow("img_reference", img_reference);
cv::Mat diff = (cv::Mat)disp - (cv::Mat)img_reference;
cv::imshow("diff", diff);
cv::waitKey();*/
if (norm >= 100) if (norm >= 100)
{ {
ts->printf(CvTS::LOG, "\nStereoBM norm = %f\n", norm); ts->printf(CvTS::LOG, "\nStereoBM norm = %f\n", norm);

View File

@ -44,11 +44,11 @@
using namespace cv; using namespace cv;
using namespace std; using namespace std;
struct CV_GpuMatAsyncCallStereoBMTest : public CvTest struct CV_AsyncStereoBMTest : public CvTest
{ {
public: public:
CV_GpuMatAsyncCallStereoBMTest() : CvTest( "GPU-MatAsyncCallStereoBM", "asyncStereoBM" ) {} CV_AsyncStereoBMTest() : CvTest( "GPU-AsyncStereoBM", "asyncStereoBM" ) {}
~CV_GpuMatAsyncCallStereoBMTest() {} ~CV_AsyncStereoBMTest() {}
void run( int /* start_from */) void run( int /* start_from */)
{ {
@ -100,4 +100,4 @@ struct CV_GpuMatAsyncCallStereoBMTest : public CvTest
/////////////////// tests registration ///////////////////////////////////// /////////////////// tests registration /////////////////////////////////////
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
CV_GpuMatAsyncCallStereoBMTest CV_GpuMatAsyncCallStereoBMTest_test; CV_AsyncStereoBMTest CV_AsyncStereoBMTest_test;