diff --git a/modules/photo/src/fast_nlmeans_denoising_invoker_commons.hpp b/modules/photo/src/fast_nlmeans_denoising_invoker_commons.hpp index 8f31e8b02..2322919ef 100644 --- a/modules/photo/src/fast_nlmeans_denoising_invoker_commons.hpp +++ b/modules/photo/src/fast_nlmeans_denoising_invoker_commons.hpp @@ -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 +namespace std { +template bool isnan(T value) { return _isnan(value) != 0; } +} +#endif + template 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;