Merge pull request #1097 from apavlenko:ocl_tests_fixes

This commit is contained in:
Roman Donchenko 2013-07-09 14:00:38 +04:00 committed by OpenCV Buildbot
commit b1f04c5388
7 changed files with 27 additions and 42 deletions

View File

@ -319,7 +319,7 @@ namespace cv
char clVersion[256];
for (unsigned i = 0; i < numPlatforms; ++i)
{
cl_uint numsdev;
cl_uint numsdev = 0;
cl_int status = clGetDeviceIDs(platforms[i], devicetype, 0, NULL, &numsdev);
if(status != CL_DEVICE_NOT_FOUND)
openCLVerifyCall(status);

View File

@ -73,14 +73,12 @@ void print_info()
#endif
}
std::string workdir;
int main(int argc, char **argv)
{
TS::ptr()->init("ocl");
TS::ptr()->init(".");
InitGoogleTest(&argc, argv);
const char *keys =
"{ h | help | false | print help message }"
"{ w | workdir | ../../../samples/c/| set working directory }"
"{ t | type | gpu | set device type:cpu or gpu}"
"{ p | platform | 0 | set platform id }"
"{ d | device | 0 | set device id }";
@ -92,7 +90,6 @@ int main(int argc, char **argv)
cmd.printParams();
return 0;
}
workdir = cmd.get<string>("workdir");
string type = cmd.get<string>("type");
unsigned int pid = cmd.get<unsigned int>("platform");
int device = cmd.get<int>("device");

View File

@ -50,7 +50,6 @@
using namespace cv;
extern std::string workdir;
PARAM_TEST_CASE(StereoMatchBM, int, int)
{
int n_disp;
@ -66,9 +65,9 @@ PARAM_TEST_CASE(StereoMatchBM, int, int)
TEST_P(StereoMatchBM, Regression)
{
Mat left_image = readImage("stereobm/aloe-L.png", IMREAD_GRAYSCALE);
Mat right_image = readImage("stereobm/aloe-R.png", IMREAD_GRAYSCALE);
Mat disp_gold = readImage("stereobm/aloe-disp.png", IMREAD_GRAYSCALE);
Mat left_image = readImage("gpu/stereobm/aloe-L.png", IMREAD_GRAYSCALE);
Mat right_image = readImage("gpu/stereobm/aloe-R.png", IMREAD_GRAYSCALE);
Mat disp_gold = readImage("gpu/stereobm/aloe-disp.png", IMREAD_GRAYSCALE);
ocl::oclMat d_left, d_right;
ocl::oclMat d_disp(left_image.size(), CV_8U);
Mat disp;
@ -113,9 +112,9 @@ PARAM_TEST_CASE(StereoMatchBP, int, int, int, float, float, float, float)
};
TEST_P(StereoMatchBP, Regression)
{
Mat left_image = readImage("stereobp/aloe-L.png");
Mat right_image = readImage("stereobp/aloe-R.png");
Mat disp_gold = readImage("stereobp/aloe-disp.png", IMREAD_GRAYSCALE);
Mat left_image = readImage("gpu/stereobp/aloe-L.png");
Mat right_image = readImage("gpu/stereobp/aloe-R.png");
Mat disp_gold = readImage("gpu/stereobp/aloe-disp.png", IMREAD_GRAYSCALE);
ocl::oclMat d_left, d_right;
ocl::oclMat d_disp;
Mat disp;
@ -166,9 +165,9 @@ PARAM_TEST_CASE(StereoMatchConstSpaceBP, int, int, int, int, float, float, float
};
TEST_P(StereoMatchConstSpaceBP, Regression)
{
Mat left_image = readImage("csstereobp/aloe-L.png");
Mat right_image = readImage("csstereobp/aloe-R.png");
Mat disp_gold = readImage("csstereobp/aloe-disp.png", IMREAD_GRAYSCALE);
Mat left_image = readImage("gpu/csstereobp/aloe-L.png");
Mat right_image = readImage("gpu/csstereobp/aloe-R.png");
Mat disp_gold = readImage("gpu/csstereobp/aloe-disp.png", IMREAD_GRAYSCALE);
ocl::oclMat d_left, d_right;
ocl::oclMat d_disp;

View File

@ -48,7 +48,6 @@
////////////////////////////////////////////////////////
// Canny
extern std::string workdir;
IMPLEMENT_PARAM_CLASS(AppertureSize, int);
IMPLEMENT_PARAM_CLASS(L2gradient, bool);
@ -67,7 +66,7 @@ PARAM_TEST_CASE(Canny, AppertureSize, L2gradient)
TEST_P(Canny, Accuracy)
{
cv::Mat img = readImage(workdir + "fruits.jpg", cv::IMREAD_GRAYSCALE);
cv::Mat img = readImage("cv/shared/fruits.png", cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(img.empty());
double low_thresh = 50.0;

View File

@ -45,7 +45,7 @@ TEST_P(MomentsTest, Mat)
{
if(test_contours)
{
Mat src = imread( workdir + "../cpp/pic3.png", IMREAD_GRAYSCALE );
Mat src = readImage( "cv/shared/pic3.png", IMREAD_GRAYSCALE );
ASSERT_FALSE(src.empty());
Mat canny_output;
vector<vector<Point> > contours;

View File

@ -63,11 +63,8 @@ PARAM_TEST_CASE(HOG, Size, int)
{
winSize = GET_PARAM(0);
type = GET_PARAM(1);
img_rgb = readImage(workdir + "../gpu/road.png");
if(img_rgb.empty())
{
std::cout << "Couldn't read road.png" << std::endl;
}
img_rgb = readImage("gpu/hog/road.png");
ASSERT_FALSE(img_rgb.empty());
}
};
@ -211,18 +208,11 @@ PARAM_TEST_CASE(Haar, int, CascadeName)
virtual void SetUp()
{
flags = GET_PARAM(0);
cascadeName = (workdir + "../../data/haarcascades/").append(GET_PARAM(1));
if( (!cascade.load( cascadeName )) || (!cpucascade.load(cascadeName)) )
{
std::cout << "ERROR: Could not load classifier cascade" << std::endl;
return;
}
img = readImage(workdir + "lena.jpg", IMREAD_GRAYSCALE);
if(img.empty())
{
std::cout << "Couldn't read lena.jpg" << std::endl;
return ;
}
cascadeName = (string(cvtest::TS::ptr()->get_data_path()) + "cv/cascadeandhog/cascades/").append(GET_PARAM(1));
ASSERT_TRUE(cascade.load( cascadeName ));
ASSERT_TRUE(cpucascade.load(cascadeName));
img = readImage("cv/shared/lena.png", IMREAD_GRAYSCALE);
ASSERT_FALSE(img.empty());
equalizeHist(img, img);
d_img.upload(img);
}

View File

@ -75,7 +75,7 @@ PARAM_TEST_CASE(GoodFeaturesToTrack, MinDistance)
TEST_P(GoodFeaturesToTrack, Accuracy)
{
cv::Mat frame = readImage(workdir + "../gpu/rubberwhale1.png", cv::IMREAD_GRAYSCALE);
cv::Mat frame = readImage("gpu/opticalflow/rubberwhale1.png", cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(frame.empty());
int maxCorners = 1000;
@ -146,10 +146,10 @@ PARAM_TEST_CASE(TVL1, bool)
TEST_P(TVL1, Accuracy)
{
cv::Mat frame0 = readImage(workdir + "../gpu/rubberwhale1.png", cv::IMREAD_GRAYSCALE);
cv::Mat frame0 = readImage("gpu/opticalflow/rubberwhale1.png", cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(frame0.empty());
cv::Mat frame1 = readImage(workdir + "../gpu/rubberwhale2.png", cv::IMREAD_GRAYSCALE);
cv::Mat frame1 = readImage("gpu/opticalflow/rubberwhale2.png", cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(frame1.empty());
cv::ocl::OpticalFlowDual_TVL1_OCL d_alg;
@ -188,10 +188,10 @@ PARAM_TEST_CASE(Sparse, bool, bool)
TEST_P(Sparse, Mat)
{
cv::Mat frame0 = readImage(workdir + "../gpu/rubberwhale1.png", useGray ? cv::IMREAD_GRAYSCALE : cv::IMREAD_COLOR);
cv::Mat frame0 = readImage("gpu/opticalflow/rubberwhale1.png", useGray ? cv::IMREAD_GRAYSCALE : cv::IMREAD_COLOR);
ASSERT_FALSE(frame0.empty());
cv::Mat frame1 = readImage(workdir + "../gpu/rubberwhale2.png", useGray ? cv::IMREAD_GRAYSCALE : cv::IMREAD_COLOR);
cv::Mat frame1 = readImage("gpu/opticalflow/rubberwhale2.png", useGray ? cv::IMREAD_GRAYSCALE : cv::IMREAD_COLOR);
ASSERT_FALSE(frame1.empty());
cv::Mat gray_frame;
@ -301,10 +301,10 @@ PARAM_TEST_CASE(Farneback, PyrScale, PolyN, FarnebackOptFlowFlags, UseInitFlow)
TEST_P(Farneback, Accuracy)
{
cv::Mat frame0 = imread(workdir + "/rubberwhale1.png", cv::IMREAD_GRAYSCALE);
cv::Mat frame0 = readImage("gpu/opticalflow/rubberwhale1.png", cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(frame0.empty());
cv::Mat frame1 = imread(workdir + "/rubberwhale2.png", cv::IMREAD_GRAYSCALE);
cv::Mat frame1 = readImage("gpu/opticalflow/rubberwhale2.png", cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(frame1.empty());
double polySigma = polyN <= 5 ? 1.1 : 1.5;