Commit 6b6c7ccf authored by Alexander Karsakov's avatar Alexander Karsakov

Added accuracy tests with real and generated data

parent f7aadd07
...@@ -53,10 +53,45 @@ PARAM_TEST_CASE(HoughLinesTestBase, double, double, int) ...@@ -53,10 +53,45 @@ PARAM_TEST_CASE(HoughLinesTestBase, double, double, int)
src.copyTo(usrc); src.copyTo(usrc);
} }
virtual void readRealTestData()
{
Mat img = readImage("shared/pic5.png", IMREAD_GRAYSCALE);
Canny(img, src, 100, 150, 3);
src.copyTo(usrc);
}
virtual void Near(double eps = 0.)
{
EXPECT_EQ(dst.size(), udst.size());
if (dst.total() > 0)
{
Mat lines_cpu, lines_gpu;
dst.copyTo(lines_cpu);
udst.copyTo(lines_gpu);
std::sort(lines_cpu.begin<Vec2f>(), lines_cpu.end<Vec2f>(), Vec2fComparator());
std::sort(lines_gpu.begin<Vec2f>(), lines_gpu.end<Vec2f>(), Vec2fComparator());
EXPECT_LE(TestUtils::checkNorm2(lines_cpu, lines_gpu), eps);
}
}
}; };
typedef HoughLinesTestBase HoughLines; typedef HoughLinesTestBase HoughLines;
OCL_TEST_P(HoughLines, RealImage)
{
readRealTestData();
OCL_OFF(cv::HoughLines(src, dst, rhoStep, thetaStep, threshold));
OCL_ON(cv::HoughLines(usrc, udst, rhoStep, thetaStep, threshold));
Near(1e-5);
}
OCL_TEST_P(HoughLines, GeneratedImage) OCL_TEST_P(HoughLines, GeneratedImage)
{ {
for (int j = 0; j < test_loop_times; j++) for (int j = 0; j < test_loop_times; j++)
......
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