}
}
+namespace {
+ struct Vec3fComparator
+ {
+ bool operator()(const cv::Vec3f& a, const cv::Vec3f b) const
+ {
+ if(a[0] != b[0]) return a[0] < b[0];
+ else if(a[1] != b[1]) return a[1] < b[1];
+ else return a[2] < b[2];
+ }
+ };
+ 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];
+ }
+ };
+}
+
//////////////////////////////////////////////////////////////////////
// HoughLines
-PERF_TEST_P(Sz, DISABLED_ImgProc_HoughLines, GPU_TYPICAL_MAT_SIZES)
+PERF_TEST_P(Sz, ImgProc_HoughLines, GPU_TYPICAL_MAT_SIZES)
{
declare.time(30.0);
cv::gpu::HoughLines(d_src, d_lines, d_buf, rho, theta, threshold);
}
- GPU_SANITY_CHECK(d_lines);
+ cv::Mat h_lines(d_lines);
+ cv::Vec2f* begin = (cv::Vec2f*)(h_lines.ptr<char>(0));
+ cv::Vec2f* end = (cv::Vec2f*)(h_lines.ptr<char>(0) + (h_lines.cols) * 2 * sizeof(float));
+ std::sort(begin, end, Vec2fComparator());
+ SANITY_CHECK(h_lines);
}
else
{
cv::HoughLines(src, lines, rho, theta, threshold);
}
- CPU_SANITY_CHECK(lines);
+ std::sort(lines.begin(), lines.end(), Vec2fComparator());
+ SANITY_CHECK(lines);
}
}
cv::gpu::HoughCircles(d_src, d_circles, d_buf, CV_HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius);
}
- GPU_SANITY_CHECK(d_circles);
+ cv::Mat h_circles(d_circles);
+ cv::Vec3f* begin = (cv::Vec3f*)(h_circles.ptr<char>(0));
+ cv::Vec3f* end = (cv::Vec3f*)(h_circles.ptr<char>(0) + (h_circles.cols) * 3 * sizeof(float));
+ std::sort(begin, end, Vec3fComparator());
+ SANITY_CHECK(h_circles);
}
else
{
cv::HoughCircles(src, circles, CV_HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius);
}
- CPU_SANITY_CHECK(circles);
+ std::sort(circles.begin(), circles.end(), Vec3fComparator());
+ SANITY_CHECK(circles);
}
}