|
|
|
@ -44,6 +44,14 @@ |
|
|
|
|
|
|
|
|
|
using namespace cv; |
|
|
|
|
|
|
|
|
|
// std::isnan is a part of C++11 and it is not supported in MSVS2010/2012
|
|
|
|
|
#if defined _MSC_VER && _MSC_VER < 1800 /* MSVC 2013 */ |
|
|
|
|
#include <float.h> |
|
|
|
|
namespace std { |
|
|
|
|
template <typename T> bool isnan(T value) { return _isnan(value) != 0; } |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
template <typename T> struct pixelInfo_ |
|
|
|
|
{ |
|
|
|
|
static const int channels = 1; |
|
|
|
@ -130,7 +138,7 @@ class DistAbs |
|
|
|
|
if (std::isnan(w)) w = 1.0; // Handle h = 0.0
|
|
|
|
|
|
|
|
|
|
static const double WEIGHT_THRESHOLD = 0.001; |
|
|
|
|
WT weight = (WT)round(fixed_point_mult * w); |
|
|
|
|
WT weight = (WT)cvRound(fixed_point_mult * w); |
|
|
|
|
if (weight < WEIGHT_THRESHOLD * fixed_point_mult) weight = 0; |
|
|
|
|
|
|
|
|
|
return weight; |
|
|
|
@ -252,7 +260,7 @@ class DistSquared |
|
|
|
|
if (std::isnan(w)) w = 1.0; // Handle h = 0.0
|
|
|
|
|
|
|
|
|
|
static const double WEIGHT_THRESHOLD = 0.001; |
|
|
|
|
WT weight = (WT)round(fixed_point_mult * w); |
|
|
|
|
WT weight = (WT)cvRound(fixed_point_mult * w); |
|
|
|
|
if (weight < WEIGHT_THRESHOLD * fixed_point_mult) weight = 0; |
|
|
|
|
|
|
|
|
|
return weight; |
|
|
|
|