mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 00:03:03 +04:00
Merge pull request #720 from taka-no-me:drop_sort
This commit is contained in:
@@ -92,7 +92,7 @@ void cv::goodFeaturesToTrack( InputArray _image, OutputArray _corners,
|
||||
}
|
||||
}
|
||||
|
||||
sort( tmpCorners, greaterThanPtr<float>() );
|
||||
std::sort( tmpCorners.begin(), tmpCorners.end(), greaterThanPtr<float>() );
|
||||
std::vector<Point2f> corners;
|
||||
size_t i, j, total = tmpCorners.size(), ncorners = 0;
|
||||
|
||||
|
||||
@@ -157,8 +157,13 @@ namespace
|
||||
releaseVector(voteOutBuf);
|
||||
}
|
||||
|
||||
#define votes_cmp_gt(l1, l2) (aux[l1][0] > aux[l2][0])
|
||||
static CV_IMPLEMENT_QSORT_EX( sortIndexies, size_t, votes_cmp_gt, const Vec3i* )
|
||||
class Vec3iGreaterThanIdx
|
||||
{
|
||||
public:
|
||||
Vec3iGreaterThanIdx( const Vec3i* _arr ) : arr(_arr) {}
|
||||
bool operator()(size_t a, size_t b) const { return arr[a][0] > arr[b][0]; }
|
||||
const Vec3i* arr;
|
||||
};
|
||||
|
||||
void GHT_Pos::filterMinDist()
|
||||
{
|
||||
@@ -173,7 +178,7 @@ namespace
|
||||
std::vector<size_t> indexies(oldSize);
|
||||
for (size_t i = 0; i < oldSize; ++i)
|
||||
indexies[i] = i;
|
||||
sortIndexies(&indexies[0], oldSize, &oldVoteBuf[0]);
|
||||
std::sort(indexies.begin(), indexies.end(), Vec3iGreaterThanIdx(&oldVoteBuf[0]));
|
||||
|
||||
posOutBuf.clear();
|
||||
voteOutBuf.clear();
|
||||
|
||||
@@ -56,7 +56,10 @@ struct LinePolar
|
||||
struct hough_cmp_gt
|
||||
{
|
||||
hough_cmp_gt(const int* _aux) : aux(_aux) {}
|
||||
bool operator()(int l1, int l2) const { return aux[l1] > aux[l2]; }
|
||||
bool operator()(int l1, int l2) const
|
||||
{
|
||||
return aux[l1] > aux[l2] || (aux[l1] == aux[l2] && l1 < l2);
|
||||
}
|
||||
const int* aux;
|
||||
};
|
||||
|
||||
@@ -128,7 +131,7 @@ HoughLinesStandard( const Mat& img, float rho, float theta,
|
||||
}
|
||||
|
||||
// stage 3. sort the detected lines by accumulator value
|
||||
cv::sort(_sort_buf, hough_cmp_gt(accum));
|
||||
std::sort(_sort_buf.begin(), _sort_buf.end(), hough_cmp_gt(accum));
|
||||
|
||||
// stage 4. store the first min(total,linesMax) lines to the output buffer
|
||||
linesMax = std::min(linesMax, (int)_sort_buf.size());
|
||||
|
||||
Reference in New Issue
Block a user