Merge pull request #2347 from Chechli:master
This commit is contained in:
commit
2409812803
@ -133,6 +133,7 @@ namespace
|
|||||||
GpuMat dx_, dy_;
|
GpuMat dx_, dy_;
|
||||||
GpuMat edges_;
|
GpuMat edges_;
|
||||||
GpuMat accum_;
|
GpuMat accum_;
|
||||||
|
Mat tt; //CPU copy of accum_
|
||||||
GpuMat list_;
|
GpuMat list_;
|
||||||
GpuMat result_;
|
GpuMat result_;
|
||||||
Ptr<cuda::Filter> filterDx_;
|
Ptr<cuda::Filter> filterDx_;
|
||||||
@ -140,6 +141,8 @@ namespace
|
|||||||
Ptr<cuda::CannyEdgeDetector> canny_;
|
Ptr<cuda::CannyEdgeDetector> canny_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool centersCompare(Vec3f a, Vec3f b) {return (a[2] > b[2]);}
|
||||||
|
|
||||||
HoughCirclesDetectorImpl::HoughCirclesDetectorImpl(float dp, float minDist, int cannyThreshold, int votesThreshold,
|
HoughCirclesDetectorImpl::HoughCirclesDetectorImpl(float dp, float minDist, int cannyThreshold, int votesThreshold,
|
||||||
int minRadius, int maxRadius, int maxCircles) :
|
int minRadius, int maxRadius, int maxCircles) :
|
||||||
dp_(dp), minDist_(minDist), cannyThreshold_(cannyThreshold), votesThreshold_(votesThreshold),
|
dp_(dp), minDist_(minDist), cannyThreshold_(cannyThreshold), votesThreshold_(votesThreshold),
|
||||||
@ -193,6 +196,8 @@ namespace
|
|||||||
|
|
||||||
circlesAccumCenters_gpu(srcPoints, pointsCount, dx_, dy_, accum_, minRadius_, maxRadius_, idp);
|
circlesAccumCenters_gpu(srcPoints, pointsCount, dx_, dy_, accum_, minRadius_, maxRadius_, idp);
|
||||||
|
|
||||||
|
accum_.download(tt);
|
||||||
|
|
||||||
int centersCount = buildCentersList_gpu(accum_, centers, votesThreshold_);
|
int centersCount = buildCentersList_gpu(accum_, centers, votesThreshold_);
|
||||||
if (centersCount == 0)
|
if (centersCount == 0)
|
||||||
{
|
{
|
||||||
@ -219,9 +224,21 @@ namespace
|
|||||||
|
|
||||||
const float minDist2 = minDist_ * minDist_;
|
const float minDist2 = minDist_ * minDist_;
|
||||||
|
|
||||||
|
vector<Vec3f> sortBuf;
|
||||||
|
for(int i=0; i<centersCount; i++){
|
||||||
|
Vec3f temp;
|
||||||
|
temp[0] = oldBuf[i].x;
|
||||||
|
temp[1] = oldBuf[i].y;
|
||||||
|
temp[2] = tt.at<int>(temp[1]+1, temp[0]+1);
|
||||||
|
sortBuf.push_back(temp);
|
||||||
|
}
|
||||||
|
std::sort(sortBuf.begin(), sortBuf.end(), centersCompare);
|
||||||
|
|
||||||
for (int i = 0; i < centersCount; ++i)
|
for (int i = 0; i < centersCount; ++i)
|
||||||
{
|
{
|
||||||
ushort2 p = oldBuf[i];
|
ushort2 p;
|
||||||
|
p.x = sortBuf[i][0];
|
||||||
|
p.y = sortBuf[i][1];
|
||||||
|
|
||||||
bool good = true;
|
bool good = true;
|
||||||
|
|
||||||
|
@ -60,5 +60,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#endif /* __OPENCV_PRECOMP_H__ */
|
#endif /* __OPENCV_PRECOMP_H__ */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user