Merge pull request #6989 from mself:gftt-deterministic-sort

This commit is contained in:
Vadim Pisarevsky 2016-07-28 15:27:39 +00:00
commit 3b1803f6b1

View File

@ -54,7 +54,8 @@ struct greaterThanPtr :
public std::binary_function<const float *, const float *, bool> public std::binary_function<const float *, const float *, bool>
{ {
bool operator () (const float * a, const float * b) const bool operator () (const float * a, const float * b) const
{ return *a > *b; } // Ensure a fully deterministic result of the sort
{ return (*a > *b) ? true : (*a < *b) ? false : (a > b); }
}; };
#ifdef HAVE_OPENCL #ifdef HAVE_OPENCL
@ -66,7 +67,8 @@ struct Corner
short x; short x;
bool operator < (const Corner & c) const bool operator < (const Corner & c) const
{ return val > c.val; } // Ensure a fully deterministic result of the sort
{ return (val > c.val) ? true : (val < c.val) ? false : (y > c.y) ? true : (y < c.y) ? false : (x > c.x); }
}; };
static bool ocl_goodFeaturesToTrack( InputArray _image, OutputArray _corners, static bool ocl_goodFeaturesToTrack( InputArray _image, OutputArray _corners,