From 5777689fe96bcdec6d3a3b16ced0dc13600f2b88 Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Sun, 25 Mar 2012 22:05:58 +0000 Subject: [PATCH] fixed build errors & warnings on VS2010 --- modules/contrib/src/colormap.cpp | 6 +++++- modules/contrib/src/facerec.cpp | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/contrib/src/colormap.cpp b/modules/contrib/src/colormap.cpp index fad3498..a5c84ed 100644 --- a/modules/contrib/src/colormap.cpp +++ b/modules/contrib/src/colormap.cpp @@ -18,13 +18,17 @@ #include "precomp.hpp" #include +#if defined _MSC_VER && _MSC_VER >= 1400 +#pragma warning( disable: 4305 ) +#endif + namespace cv { static Mat linspace(float x0, float x1, int n) { Mat pts(n, 1, CV_32FC1); - float step = (x1-x0)/floor(n-1); + float step = (x1-x0)/(n-1); for(int i = 0; i < n; i++) pts.at(i,0) = x0+i*step; return pts; diff --git a/modules/contrib/src/facerec.cpp b/modules/contrib/src/facerec.cpp index 26fc35a..e614064 100644 --- a/modules/contrib/src/facerec.cpp +++ b/modules/contrib/src/facerec.cpp @@ -57,7 +57,7 @@ static Mat asRowMatrix(InputArrayOfArrays src, int rtype, double alpha=1, double if(n == 0) return Mat(); // dimensionality of samples - int d = src.getMat(0).total(); + int d = (int)src.getMat(0).total(); // create data matrix Mat data(n, d, rtype); // copy data @@ -588,8 +588,8 @@ static Mat spatial_histogram(InputArray _src, int numPatterns, { Mat src = _src.getMat(); // calculate LBP patch size - int width = static_cast(floor(src.cols/grid_x)); - int height = static_cast(floor(src.rows/grid_y)); + int width = src.cols/grid_x; + int height = src.rows/grid_y; // allocate memory for the spatial histogram Mat result = Mat::zeros(grid_x * grid_y, numPatterns, CV_32FC1); // return matrix with zeros if no data was given -- 2.7.4