Commit 4ab650d1 authored by Andrey Kamaev's avatar Andrey Kamaev

Remove gcd function from core headers

parent c886afb5
...@@ -1036,18 +1036,7 @@ inline FileNode FileStorage::getFirstTopLevelNode() const ...@@ -1036,18 +1036,7 @@ inline FileNode FileStorage::getFirstTopLevelNode() const
//////////////////////////////////////// Various algorithms //////////////////////////////////// //////////////////////////////////////// Various algorithms ////////////////////////////////////
template<typename _Tp> static inline _Tp gcd(_Tp a, _Tp b)
{
if( a < b )
std::swap(a, b);
while( b > 0 )
{
_Tp r = a % b;
a = b;
b = r;
}
return a;
}
// This function splits the input sequence or set into one or more equivalence classes and // This function splits the input sequence or set into one or more equivalence classes and
// returns the vector of labels - 0-based class indexes for each element. // returns the vector of labels - 0-based class indexes for each element.
......
...@@ -1015,6 +1015,19 @@ Rect HOGCache::getWindow(const Size& imageSize, const Size& winStride, int idx) ...@@ -1015,6 +1015,19 @@ Rect HOGCache::getWindow(const Size& imageSize, const Size& winStride, int idx)
return Rect( x*winStride.width, y*winStride.height, winSize.width, winSize.height ); return Rect( x*winStride.width, y*winStride.height, winSize.width, winSize.height );
} }
static inline int gcd(int a, int b)
{
if( a < b )
std::swap(a, b);
while( b > 0 )
{
int r = a % b;
a = b;
b = r;
}
return a;
}
void HOGDescriptor::compute(const Mat& img, std::vector<float>& descriptors, void HOGDescriptor::compute(const Mat& img, std::vector<float>& descriptors,
Size winStride, Size padding, const std::vector<Point>& locations) const Size winStride, Size padding, const std::vector<Point>& locations) const
{ {
......
...@@ -995,6 +995,8 @@ inline bool HOGDescriptorTester::is_failed() const ...@@ -995,6 +995,8 @@ inline bool HOGDescriptorTester::is_failed() const
return failed; return failed;
} }
static inline int gcd(int a, int b) { return (a % b == 0) ? b : gcd (b, a % b); }
void HOGDescriptorTester::detect(const Mat& img, void HOGDescriptorTester::detect(const Mat& img,
vector<Point>& hits, vector<double>& weights, double hitThreshold, vector<Point>& hits, vector<double>& weights, double hitThreshold,
Size winStride, Size padding, const vector<Point>& locations) const Size winStride, Size padding, const vector<Point>& locations) const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment