mirror of
https://github.com/opencv/opencv.git
synced 2025-06-20 10:00:51 +08:00
Added accuracy tests with real and generated data
This commit is contained in:
parent
f7aadd07f6
commit
6b6c7ccfea
@ -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++)
|
||||||
|
Loading…
Reference in New Issue
Block a user