|
|
|
@ -59,18 +59,6 @@ void cv::ocl::HoughCirclesDownload(const oclMat&, OutputArray) { throw_nogpu(); |
|
|
|
|
namespace cv { namespace ocl { |
|
|
|
|
///////////////////////////OpenCL kernel strings///////////////////////////
|
|
|
|
|
extern const char *imgproc_hough; |
|
|
|
|
|
|
|
|
|
namespace hough |
|
|
|
|
{ |
|
|
|
|
int buildPointList_gpu(const oclMat& src, oclMat& list); |
|
|
|
|
void circlesAccumCenters_gpu(const unsigned int* list, int count, const oclMat& dx, const oclMat& dy, oclMat& accum, int minRadius, int maxRadius, float idp); |
|
|
|
|
int buildCentersList_gpu(const oclMat& accum, oclMat& centers, int threshold); |
|
|
|
|
|
|
|
|
|
int circlesAccumRadius_gpu(const oclMat& centers, int centersCount, |
|
|
|
|
const oclMat& list, int count, |
|
|
|
|
oclMat& circles, int maxCircles, |
|
|
|
|
float dp, int minRadius, int maxRadius, int threshold); |
|
|
|
|
} |
|
|
|
|
}} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -78,7 +66,7 @@ namespace cv { namespace ocl { |
|
|
|
|
//////////////////////////////////////////////////////////
|
|
|
|
|
// common functions
|
|
|
|
|
|
|
|
|
|
namespace cv { namespace ocl { namespace hough |
|
|
|
|
namespace |
|
|
|
|
{ |
|
|
|
|
int buildPointList_gpu(const oclMat& src, oclMat& list) |
|
|
|
|
{ |
|
|
|
@ -116,12 +104,12 @@ namespace cv { namespace ocl { namespace hough |
|
|
|
|
|
|
|
|
|
return totalCount; |
|
|
|
|
} |
|
|
|
|
}}} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////
|
|
|
|
|
// HoughCircles
|
|
|
|
|
|
|
|
|
|
namespace cv { namespace ocl { namespace hough |
|
|
|
|
namespace |
|
|
|
|
{ |
|
|
|
|
void circlesAccumCenters_gpu(const oclMat& list, int count, const oclMat& dx, const oclMat& dy, oclMat& accum, int minRadius, int maxRadius, float idp) |
|
|
|
|
{ |
|
|
|
@ -239,7 +227,7 @@ namespace cv { namespace ocl { namespace hough |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}}} // namespace cv { namespace ocl { namespace hough
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -267,7 +255,7 @@ void cv::ocl::HoughCircles(const oclMat& src, oclMat& circles, HoughCirclesBuf& |
|
|
|
|
cv::ocl::Canny(src, buf.cannyBuf, buf.edges, std::max(cannyThreshold / 2, 1), cannyThreshold); |
|
|
|
|
|
|
|
|
|
ensureSizeIsEnough(1, src.size().area(), CV_32SC1, buf.srcPoints); |
|
|
|
|
const int pointsCount = hough::buildPointList_gpu(buf.edges, buf.srcPoints); |
|
|
|
|
const int pointsCount = buildPointList_gpu(buf.edges, buf.srcPoints); |
|
|
|
|
if (pointsCount == 0) |
|
|
|
|
{ |
|
|
|
|
circles.release(); |
|
|
|
@ -277,10 +265,10 @@ void cv::ocl::HoughCircles(const oclMat& src, oclMat& circles, HoughCirclesBuf& |
|
|
|
|
ensureSizeIsEnough(cvCeil(src.rows * idp) + 2, cvCeil(src.cols * idp) + 2, CV_32SC1, buf.accum); |
|
|
|
|
buf.accum.setTo(Scalar::all(0)); |
|
|
|
|
|
|
|
|
|
hough::circlesAccumCenters_gpu(buf.srcPoints, pointsCount, buf.cannyBuf.dx, buf.cannyBuf.dy, buf.accum, minRadius, maxRadius, idp); |
|
|
|
|
circlesAccumCenters_gpu(buf.srcPoints, pointsCount, buf.cannyBuf.dx, buf.cannyBuf.dy, buf.accum, minRadius, maxRadius, idp); |
|
|
|
|
|
|
|
|
|
ensureSizeIsEnough(1, src.size().area(), CV_32SC1, buf.centers); |
|
|
|
|
int centersCount = hough::buildCentersList_gpu(buf.accum, buf.centers, votesThreshold); |
|
|
|
|
int centersCount = buildCentersList_gpu(buf.accum, buf.centers, votesThreshold); |
|
|
|
|
if (centersCount == 0) |
|
|
|
|
{ |
|
|
|
|
circles.release(); |
|
|
|
@ -384,7 +372,7 @@ void cv::ocl::HoughCircles(const oclMat& src, oclMat& circles, HoughCirclesBuf& |
|
|
|
|
|
|
|
|
|
ensureSizeIsEnough(1, maxCircles, CV_32FC3, circles); |
|
|
|
|
|
|
|
|
|
const int circlesCount = hough::circlesAccumRadius_gpu(buf.centers, centersCount, |
|
|
|
|
const int circlesCount = circlesAccumRadius_gpu(buf.centers, centersCount, |
|
|
|
|
buf.srcPoints, pointsCount, |
|
|
|
|
circles, maxCircles, |
|
|
|
|
dp, minRadius, maxRadius, votesThreshold); |
|
|
|
|