From 9677bd7fcae170e09150f5fa69f02231e9c048ed Mon Sep 17 00:00:00 2001 From: Bleach666 Date: Fri, 18 Mar 2016 14:48:16 +0200 Subject: [PATCH] fix vs2010 samples build --- modules/line_descriptor/samples/knn_matching.cpp | 2 +- modules/optflow/samples/optical_flow_evaluation.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/line_descriptor/samples/knn_matching.cpp b/modules/line_descriptor/samples/knn_matching.cpp index 361813308..a59b6caba 100644 --- a/modules/line_descriptor/samples/knn_matching.cpp +++ b/modules/line_descriptor/samples/knn_matching.cpp @@ -111,7 +111,7 @@ uchar invertSingleBits( uchar dividend_char, int numBits ) /* reconvert to decimal */ uchar result = 0; for ( int i = (int) bin_vector.size() - 1; i >= 0; i-- ) - result += (uchar) ( bin_vector[i] * pow( 2, i ) ); + result += (uchar) ( bin_vector[i] * (1 << i) ); return result; } diff --git a/modules/optflow/samples/optical_flow_evaluation.cpp b/modules/optflow/samples/optical_flow_evaluation.cpp index 4ecc798d5..4891d13cc 100644 --- a/modules/optflow/samples/optical_flow_evaluation.cpp +++ b/modules/optflow/samples/optical_flow_evaluation.cpp @@ -2,6 +2,7 @@ #include "opencv2/video.hpp" #include "opencv2/optflow.hpp" #include +#include using namespace std; using namespace cv; @@ -40,7 +41,7 @@ static Mat endpointError( const Mat_& flow1, const Mat_& flow2 const Point2f diff = u1 - u2; result.at(i, j) = sqrt((float)diff.ddot(diff)); //distance } else - result.at(i, j) = NAN; + result.at(i, j) = std::numeric_limits::quiet_NaN(); } } return result; @@ -61,7 +62,7 @@ static Mat angularError( const Mat_& flow1, const Mat_& flow2 if ( isFlowCorrect(u1) && isFlowCorrect(u2) ) result.at(i, j) = acos((float)(u1.ddot(u2) / norm(u1) * norm(u2))); else - result.at(i, j) = NAN; + result.at(i, j) = std::numeric_limits::quiet_NaN(); } } return result;