mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 00:03:03 +04:00
Added getLines, fill_accum_local kernels
This commit is contained in:
@@ -13,49 +13,66 @@
|
||||
namespace cvtest {
|
||||
namespace ocl {
|
||||
|
||||
PARAM_TEST_CASE(HoughLinesTestBase, bool)
|
||||
struct Vec2fComparator
|
||||
{
|
||||
bool operator()(const cv::Vec2f& a, const cv::Vec2f b) const
|
||||
{
|
||||
if(a[0] != b[0]) return a[0] < b[0];
|
||||
else return a[1] < b[1];
|
||||
}
|
||||
};
|
||||
|
||||
PARAM_TEST_CASE(HoughLinesTestBase, double, double, int)
|
||||
{
|
||||
double rhoStep;
|
||||
double thetaStep;
|
||||
int threshold;
|
||||
bool useRoi;
|
||||
|
||||
Size src_size;
|
||||
Mat src, dst;
|
||||
UMat usrc, udst;
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
rhoStep = 10;
|
||||
thetaStep = 0.5;
|
||||
threshold = 80;
|
||||
useRoi = false;
|
||||
rhoStep = GET_PARAM(0);
|
||||
thetaStep = GET_PARAM(1);
|
||||
threshold = GET_PARAM(2);
|
||||
}
|
||||
|
||||
virtual void generateTestData()
|
||||
{
|
||||
//Mat image = readImage("shared/pic1.png", IMREAD_GRAYSCALE);
|
||||
src_size = randomSize(500, 1000);
|
||||
src.create(src_size, CV_8UC1);
|
||||
src.setTo(Scalar::all(0));
|
||||
line(src, Point(0, 100), Point(100, 100), Scalar::all(255), 1);
|
||||
line(src, Point(0, 200), Point(100, 200), Scalar::all(255), 1);
|
||||
line(src, Point(0, 400), Point(100, 400), Scalar::all(255), 1);
|
||||
line(src, Point(100, 0), Point(100, 200), Scalar::all(255), 1);
|
||||
line(src, Point(200, 0), Point(200, 200), Scalar::all(255), 1);
|
||||
line(src, Point(400, 0), Point(400, 200), Scalar::all(255), 1);
|
||||
|
||||
Mat image = randomMat(Size(20, 10), CV_8UC1, 0, 255, false);
|
||||
|
||||
cv::threshold(image, src, 127, 255, THRESH_BINARY);
|
||||
//Canny(image, src, 100, 150, 3);
|
||||
src.copyTo(usrc);
|
||||
}
|
||||
};
|
||||
|
||||
typedef HoughLinesTestBase HoughLines;
|
||||
|
||||
OCL_TEST_P(HoughLines, RealImage)
|
||||
OCL_TEST_P(HoughLines, GeneratedImage)
|
||||
{
|
||||
generateTestData();
|
||||
for (int j = 0; j < test_loop_times; j++)
|
||||
{
|
||||
generateTestData();
|
||||
|
||||
//std::cout << src << std::endl;
|
||||
OCL_OFF(cv::HoughLines(src, dst, rhoStep, thetaStep, threshold));
|
||||
OCL_ON(cv::HoughLines(usrc, udst, rhoStep, thetaStep, threshold));
|
||||
|
||||
OCL_OFF(cv::HoughLines(src, dst, rhoStep, thetaStep, threshold, 0, 0));
|
||||
OCL_ON(cv::HoughLines(usrc, udst, rhoStep, thetaStep, threshold, 0, 0));
|
||||
//Near(1e-5);
|
||||
}
|
||||
}
|
||||
|
||||
OCL_INSTANTIATE_TEST_CASE_P(Imgproc, HoughLines, Values(true, false));
|
||||
OCL_INSTANTIATE_TEST_CASE_P(Imgproc, HoughLines, Combine(Values(1, 0.5), // rhoStep
|
||||
Values(CV_PI / 180.0, CV_PI / 360.0), // thetaStep
|
||||
Values(80, 150))); // threshold
|
||||
|
||||
} } // namespace cvtest::ocl
|
||||
|
||||
|
||||
Reference in New Issue
Block a user