From 8e24552f6ce0c81b5972286abacd78deecb63e64 Mon Sep 17 00:00:00 2001 From: Alexander Stohr Date: Wed, 22 Jul 2015 11:34:43 +0200 Subject: [PATCH 1/4] make sources compile again on MSVC 2012 (VC 11) by adding round() --- modules/line_descriptor/src/binary_descriptor.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/line_descriptor/src/binary_descriptor.cpp b/modules/line_descriptor/src/binary_descriptor.cpp index f5739b661..59ce1a8bf 100644 --- a/modules/line_descriptor/src/binary_descriptor.cpp +++ b/modules/line_descriptor/src/binary_descriptor.cpp @@ -41,6 +41,19 @@ #include "precomp.hpp" +#ifdef _MSC_VER + #if (__cplusplus <= 199711L) + /* This function rounds x to the nearest integer, but rounds halfway cases away from zero. */ + static inline double round(double x) + { + if (x < 0.0) + return ceil(x - 0.5); + else + return floor(x + 0.5); + } + #endif +#endif + #define NUM_OF_BANDS 9 #define Horizontal 255//if |dx|<|dy|; #define Vertical 0//if |dy|<=|dx|; From 024d8486a4c35dc2932c6b30390e84bf20ead60f Mon Sep 17 00:00:00 2001 From: Alexander Stohr Date: Wed, 22 Jul 2015 11:42:39 +0200 Subject: [PATCH 2/4] fix suffix that was in-compatible with MSVC 2012 (VC 11) --- modules/line_descriptor/src/bitops.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/line_descriptor/src/bitops.hpp b/modules/line_descriptor/src/bitops.hpp index 8bc0f3fe6..02ccb98cb 100644 --- a/modules/line_descriptor/src/bitops.hpp +++ b/modules/line_descriptor/src/bitops.hpp @@ -101,7 +101,7 @@ inline void split( UINT64 *chunks, UINT8 *code, int m, int mplus, int b ) UINT64 temp = 0x0; int nbits = 0; int nbyte = 0; - UINT64 mask = b == 64 ? 0xFFFFFFFFFFFFFFFFLLU : ( ( UINT64_1 << b ) - UINT64_1 ); + UINT64 mask = (b == 64) ? 0xFFFFFFFFFFFFFFFFull : ( ( UINT64_1 << b ) - UINT64_1 ); for ( int i = 0; i < m; i++ ) { From df88c318920b5237d4281cfdddd83295f5ffd92f Mon Sep 17 00:00:00 2001 From: Alexander Stohr Date: Wed, 22 Jul 2015 13:05:10 +0200 Subject: [PATCH 3/4] eliminate some warnings --- modules/saliency/src/motionSaliencyBinWangApr2014.cpp | 4 ++-- modules/tracking/src/tldDataset.cpp | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/saliency/src/motionSaliencyBinWangApr2014.cpp b/modules/saliency/src/motionSaliencyBinWangApr2014.cpp index 7a08e6a7f..ed244f1a5 100644 --- a/modules/saliency/src/motionSaliencyBinWangApr2014.cpp +++ b/modules/saliency/src/motionSaliencyBinWangApr2014.cpp @@ -479,7 +479,7 @@ bool MotionSaliencyBinWangApr2014::templateReplacement( const Mat& finalBFMask, /////////////////// REPLACEMENT of backgroundModel template /////////////////// //replace TA with current TK backgroundModel[backgroundModel.size() - 1]->at( i, j ) = potentialBackground.at( i, j ); - potentialBackground.at( i, j )[0] = NAN; + potentialBackground.at( i, j )[0] = (float)NAN; potentialBackground.at( i, j )[1] = 0; break; @@ -489,7 +489,7 @@ bool MotionSaliencyBinWangApr2014::templateReplacement( const Mat& finalBFMask, else { backgroundModel[backgroundModel.size() - 1]->at( i, j ) = potentialBackground.at( i, j ); - potentialBackground.at( i, j )[0] = NAN; + potentialBackground.at( i, j )[0] = (float)NAN; potentialBackground.at( i, j )[1] = 0; } } // close if of EVALUATION diff --git a/modules/tracking/src/tldDataset.cpp b/modules/tracking/src/tldDataset.cpp index 8432fc272..b93de2576 100644 --- a/modules/tracking/src/tldDataset.cpp +++ b/modules/tracking/src/tldDataset.cpp @@ -52,7 +52,10 @@ namespace cv cv::Rect2d tld_InitDataset(int datasetInd,const char* rootPath) { char* folderName = (char *)""; - int x, y, w, h; + int x = 0; + int y = 0; + int w = 0; + int h = 0; flagPNG = false; frameNum = 1; From 70a2b23a6d278a88f0743daea211927944164e4c Mon Sep 17 00:00:00 2001 From: Alexander Stohr Date: Wed, 22 Jul 2015 14:45:54 +0200 Subject: [PATCH 4/4] use better condition for checking if compiler supports round() --- modules/line_descriptor/src/binary_descriptor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/line_descriptor/src/binary_descriptor.cpp b/modules/line_descriptor/src/binary_descriptor.cpp index 59ce1a8bf..f409d1f50 100644 --- a/modules/line_descriptor/src/binary_descriptor.cpp +++ b/modules/line_descriptor/src/binary_descriptor.cpp @@ -42,7 +42,7 @@ #include "precomp.hpp" #ifdef _MSC_VER - #if (__cplusplus <= 199711L) + #if (_MSC_VER <= 1700) /* This function rounds x to the nearest integer, but rounds halfway cases away from zero. */ static inline double round(double x) {