From a70bdfc13f8279ee86be1a0281fbd9ee357245b7 Mon Sep 17 00:00:00 2001 From: yao Date: Tue, 3 Sep 2013 15:02:18 +0800 Subject: [PATCH] a little fix to tests and sample --- modules/ocl/test/test_imgproc.cpp | 24 ++++++++++-------------- samples/ocl/clahe.cpp | 4 ++++ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/modules/ocl/test/test_imgproc.cpp b/modules/ocl/test/test_imgproc.cpp index 46cd257..f723e13 100644 --- a/modules/ocl/test/test_imgproc.cpp +++ b/modules/ocl/test/test_imgproc.cpp @@ -1396,14 +1396,10 @@ TEST_P(calcHist, Mat) } /////////////////////////////////////////////////////////////////////////////////////////////////////// // CLAHE -namespace -{ - IMPLEMENT_PARAM_CLASS(ClipLimit, double) -} -PARAM_TEST_CASE(CLAHE, cv::Size, ClipLimit) +PARAM_TEST_CASE(CLAHE, cv::Size, double) { - cv::Size size; + cv::Size gridSize; double clipLimit; cv::Mat src; @@ -1414,22 +1410,22 @@ PARAM_TEST_CASE(CLAHE, cv::Size, ClipLimit) virtual void SetUp() { - size = GET_PARAM(0); + gridSize = GET_PARAM(0); clipLimit = GET_PARAM(1); cv::RNG &rng = TS::ptr()->get_rng(); - src = randomMat(rng, size, CV_8UC1, 0, 256, false); + src = randomMat(rng, cv::Size(MWIDTH, MHEIGHT), CV_8UC1, 0, 256, false); g_src.upload(src); } }; TEST_P(CLAHE, Accuracy) { - cv::Ptr clahe = cv::ocl::createCLAHE(clipLimit); + cv::Ptr clahe = cv::ocl::createCLAHE(clipLimit, gridSize); clahe->apply(g_src, g_dst); cv::Mat dst(g_dst); - cv::Ptr clahe_gold = cv::createCLAHE(clipLimit); + cv::Ptr clahe_gold = cv::createCLAHE(clipLimit, gridSize); clahe_gold->apply(src, dst_gold); EXPECT_MAT_NEAR(dst_gold, dst, 1.0); @@ -1725,10 +1721,10 @@ INSTANTIATE_TEST_CASE_P(histTestBase, calcHist, Combine( ONE_TYPE(CV_32SC1) //no use )); -INSTANTIATE_TEST_CASE_P(ImgProc, CLAHE, Combine( - Values(cv::Size(128, 128), cv::Size(113, 113), cv::Size(1300, 1300)), - Values(0.0, 40.0))); +INSTANTIATE_TEST_CASE_P(Imgproc, CLAHE, Combine( + Values(cv::Size(4, 4), cv::Size(32, 8), cv::Size(8, 64)), + Values(0.0, 10.0, 62.0, 300.0))); -INSTANTIATE_TEST_CASE_P(OCL_ImgProc, ColumnSum, DIFFERENT_SIZES); +INSTANTIATE_TEST_CASE_P(Imgproc, ColumnSum, DIFFERENT_SIZES); #endif // HAVE_OPENCL diff --git a/samples/ocl/clahe.cpp b/samples/ocl/clahe.cpp index c2f4b27..1fbf49f 100644 --- a/samples/ocl/clahe.cpp +++ b/samples/ocl/clahe.cpp @@ -44,6 +44,10 @@ int main(int argc, char** argv) namedWindow("CLAHE"); createTrackbar("Tile Size", "CLAHE", &tilesize, 32, (TrackbarCallback)TSize_Callback); createTrackbar("Clip Limit", "CLAHE", &cliplimit, 20, (TrackbarCallback)Clip_Callback); + + vector info; + CV_Assert(ocl::getDevice(info)); + Mat frame, outframe; ocl::oclMat d_outframe; -- 2.7.4