From 6085c416a781afe596a4955d6d53ef7e42743f30 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Fri, 18 Oct 2013 17:57:10 +0400 Subject: [PATCH 1/2] missed initialization of kernel size --- modules/ocl/test/test_filters.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/ocl/test/test_filters.cpp b/modules/ocl/test/test_filters.cpp index 1c7dd21fbf..3dcd4c7395 100644 --- a/modules/ocl/test/test_filters.cpp +++ b/modules/ocl/test/test_filters.cpp @@ -146,6 +146,7 @@ struct ErodeDilate : virtual void SetUp() { type = GET_PARAM(0); + ksize = GET_PARAM(1); iterations = GET_PARAM(3); useRoi = GET_PARAM(4); } From 9d923b50acc4e072378fb367e73ad0beec130d7b Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Sat, 19 Oct 2013 12:12:16 +0400 Subject: [PATCH 2/2] fixed ocl::Laplacian for case when scale != 1 --- modules/ocl/src/filtering.cpp | 2 +- modules/ocl/test/test_filters.cpp | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/ocl/src/filtering.cpp b/modules/ocl/src/filtering.cpp index 185bf74c9e..0a2562d8c5 100644 --- a/modules/ocl/src/filtering.cpp +++ b/modules/ocl/src/filtering.cpp @@ -1416,7 +1416,7 @@ void cv::ocl::Laplacian(const oclMat &src, oclMat &dst, int ddepth, int ksize, d CV_Assert(ksize == 1 || ksize == 3); - static const int K[2][9] = + int K[2][9] = { {0, 1, 0, 1, -4, 1, 0, 1, 0}, {2, 0, 2, 0, -8, 0, 2, 0, 2} diff --git a/modules/ocl/test/test_filters.cpp b/modules/ocl/test/test_filters.cpp index 3dcd4c7395..86eb8abb0c 100644 --- a/modules/ocl/test/test_filters.cpp +++ b/modules/ocl/test/test_filters.cpp @@ -128,8 +128,11 @@ OCL_TEST_P(LaplacianTest, Accuracy) { random_roi(); - Laplacian(src_roi, dst_roi, -1, ksize, 1); - ocl::Laplacian(gsrc_roi, gdst_roi, -1, ksize, 1); // TODO scale + // border type is used as a scale factor for the Laplacian kernel + double scale = static_cast(borderType); + + Laplacian(src_roi, dst_roi, -1, ksize, scale); + ocl::Laplacian(gsrc_roi, gdst_roi, -1, ksize, scale); Near(1e-5); } @@ -371,7 +374,7 @@ INSTANTIATE_TEST_CASE_P(Filter, LaplacianTest, Combine( Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_32FC1, CV_32FC3, CV_32FC4), Values(1, 3), Values(Size(0, 0)), // not used - Values(0), // not used + Values(1, 2), // value is used as scale factor for kernel Bool())); INSTANTIATE_TEST_CASE_P(Filter, Erode, Combine(