From: Chechli Date: Sat, 15 Feb 2014 16:31:14 +0000 (+0100) Subject: Update hough_circles.cpp X-Git-Tag: submit/tizen_ivi/20141117.190038~2^2~605^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=72e4f72a7593bb51cf962d02b2e313c8d32bdd67;p=profile%2Fivi%2Fopencv.git Update hough_circles.cpp --- diff --git a/modules/cudaimgproc/src/hough_circles.cpp b/modules/cudaimgproc/src/hough_circles.cpp index 0cf94a6..c3ca971 100644 --- a/modules/cudaimgproc/src/hough_circles.cpp +++ b/modules/cudaimgproc/src/hough_circles.cpp @@ -41,6 +41,7 @@ //M*/ #include "precomp.hpp" +#include using namespace cv; using namespace cv::cuda; @@ -139,6 +140,8 @@ namespace Ptr filterDy_; Ptr canny_; }; + + bool centersCompare(Vec3f a, Vec3f b) {return (a[2] > b[2]);} HoughCirclesDetectorImpl::HoughCirclesDetectorImpl(float dp, float minDist, int cannyThreshold, int votesThreshold, int minRadius, int maxRadius, int maxCircles) : @@ -219,9 +222,21 @@ namespace const float minDist2 = minDist_ * minDist_; + vector sortBuf; + for(int i=0; i(temp[1]+1, temp[0]+1); + sortBuf.push_back(temp); + } + std::sort(sortBuf.begin(), sortBuf.end(), centersCompare); + 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;