Suppressed hundreds of useless MSVC warnings (can be reenabled setting cmake variable ENABLE_NOISY_WARNINGS to ON). Fixed some of remaining warnings.
This commit is contained in:
@@ -166,7 +166,7 @@ namespace colormap
|
||||
static Mat linear_colormap(InputArray X,
|
||||
InputArray r, InputArray g, InputArray b,
|
||||
float begin, float end, float n) {
|
||||
return linear_colormap(X,r,g,b,linspace(begin,end,n));
|
||||
return linear_colormap(X,r,g,b,linspace(begin,end, cvRound(n)));
|
||||
}
|
||||
|
||||
// Interpolates from a base colormap.
|
||||
|
@@ -117,7 +117,7 @@ public:
|
||||
void train(InputArray src, InputArray labels);
|
||||
|
||||
// Predicts the label of a query image in src.
|
||||
int predict(const InputArray src) const;
|
||||
int predict(InputArray src) const;
|
||||
|
||||
// See FaceRecognizer::load.
|
||||
void load(const FileStorage& fs);
|
||||
@@ -495,8 +495,8 @@ inline void elbp_(InputArray _src, OutputArray _dst, int radius, int neighbors)
|
||||
dst.setTo(0);
|
||||
for(int n=0; n<neighbors; n++) {
|
||||
// sample points
|
||||
float x = static_cast<float>(-radius) * sin(2.0*CV_PI*n/static_cast<float>(neighbors));
|
||||
float y = static_cast<float>(radius) * cos(2.0*CV_PI*n/static_cast<float>(neighbors));
|
||||
float x = static_cast<float>(-radius * sin(2.0*CV_PI*n/static_cast<float>(neighbors)));
|
||||
float y = static_cast<float>(radius * cos(2.0*CV_PI*n/static_cast<float>(neighbors)));
|
||||
// relative indices
|
||||
int fx = static_cast<int>(floor(x));
|
||||
int fy = static_cast<int>(floor(y));
|
||||
@@ -514,7 +514,7 @@ inline void elbp_(InputArray _src, OutputArray _dst, int radius, int neighbors)
|
||||
for(int i=radius; i < src.rows-radius;i++) {
|
||||
for(int j=radius;j < src.cols-radius;j++) {
|
||||
// calculate interpolated value
|
||||
float t = w1*src.at<_Tp>(i+fy,j+fx) + w2*src.at<_Tp>(i+fy,j+cx) + w3*src.at<_Tp>(i+cy,j+fx) + w4*src.at<_Tp>(i+cy,j+cx);
|
||||
float t = static_cast<float>(w1*src.at<_Tp>(i+fy,j+fx) + w2*src.at<_Tp>(i+fy,j+cx) + w3*src.at<_Tp>(i+cy,j+fx) + w4*src.at<_Tp>(i+cy,j+cx));
|
||||
// floating point precision, so check some machine-dependent epsilon
|
||||
dst.at<int>(i-radius,j-radius) += ((t > src.at<_Tp>(i,j)) || (std::abs(t-src.at<_Tp>(i,j)) < std::numeric_limits<float>::epsilon())) << n;
|
||||
}
|
||||
@@ -543,7 +543,7 @@ histc_(const Mat& src, int minVal=0, int maxVal=255, bool normed=false)
|
||||
// Establish the number of bins.
|
||||
int histSize = maxVal-minVal+1;
|
||||
// Set the ranges.
|
||||
float range[] = { minVal, maxVal } ;
|
||||
float range[] = { static_cast<float>(minVal), static_cast<float>(maxVal) };
|
||||
const float* histRange = { range };
|
||||
// calc histogram
|
||||
calcHist(&src, 1, 0, Mat(), result, 1, &histSize, &histRange, true, false);
|
||||
|
@@ -442,7 +442,7 @@ void cv::Mesh3D::clearOctree(){ octree = Octree(); }
|
||||
|
||||
float cv::Mesh3D::estimateResolution(float tryRatio)
|
||||
{
|
||||
#if 0
|
||||
#if 0
|
||||
const int neighbors = 3;
|
||||
const int minReasonable = 10;
|
||||
|
||||
@@ -476,10 +476,10 @@ float cv::Mesh3D::estimateResolution(float tryRatio)
|
||||
sort(dist, less<double>());
|
||||
|
||||
return resolution = (float)dist[ dist.size() / 2 ];
|
||||
#else
|
||||
#else
|
||||
CV_Error(CV_StsNotImplemented, "");
|
||||
return 1.f;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1182,14 +1182,14 @@ private:
|
||||
left.erase(pos);
|
||||
}
|
||||
else
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
if (group.size() >= 4)
|
||||
groups.push_back(group);
|
||||
groups.push_back(group);
|
||||
}
|
||||
|
||||
/* converting the data to final result */
|
||||
/* converting the data to final result */
|
||||
for(size_t i = 0; i < groups.size(); ++i)
|
||||
{
|
||||
const group_t& group = groups[i];
|
||||
@@ -1197,7 +1197,7 @@ private:
|
||||
vector< Vec2i > outgrp;
|
||||
for(citer pos = group.begin(); pos != group.end(); ++pos)
|
||||
{
|
||||
const Match& m = allMatches[*pos];
|
||||
const Match& m = allMatches[*pos];
|
||||
outgrp.push_back(Vec2i(subset[m.modelInd], scene.subset[m.sceneInd]));
|
||||
}
|
||||
result.push_back(outgrp);
|
||||
|
@@ -3012,8 +3012,8 @@ public:
|
||||
size_t remaining = it->remaining, cn = DataType<_Tp>::channels;
|
||||
int _fmt = DataType<_Tp>::fmt;
|
||||
char fmt[] = { (char)((_fmt>>8)+'1'), (char)_fmt, '\0' };
|
||||
size_t remaining1 = remaining/cn;
|
||||
count = count < remaining1 ? count : remaining1;
|
||||
size_t remaining1 = remaining/cn;
|
||||
count = count < remaining1 ? count : remaining1;
|
||||
vec.resize(count);
|
||||
it->readRaw( string(fmt), !vec.empty() ? (uchar*)&vec[0] : 0, count*sizeof(_Tp) );
|
||||
}
|
||||
@@ -3030,8 +3030,13 @@ read( FileNodeIterator& it, vector<_Tp>& vec, size_t maxCount=(size_t)INT_MAX )
|
||||
template<typename _Tp> static inline void
|
||||
read( const FileNode& node, vector<_Tp>& vec, const vector<_Tp>& default_value=vector<_Tp>() )
|
||||
{
|
||||
FileNodeIterator it = node.begin();
|
||||
read( it, vec );
|
||||
if(!node.node)
|
||||
vec = default_value;
|
||||
else
|
||||
{
|
||||
FileNodeIterator it = node.begin();
|
||||
read( it, vec );
|
||||
}
|
||||
}
|
||||
|
||||
inline FileNodeIterator FileNode::begin() const
|
||||
|
@@ -195,7 +195,7 @@ DenseFeatureDetector::DenseFeatureDetector( float _initFeatureScale, int _featur
|
||||
|
||||
void DenseFeatureDetector::detectImpl( const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask ) const
|
||||
{
|
||||
float curScale = initFeatureScale;
|
||||
float curScale = static_cast<float>(initFeatureScale);
|
||||
int curStep = initXyStep;
|
||||
int curBound = initImgBound;
|
||||
for( int curLevel = 0; curLevel < featureScaleLevels; curLevel++ )
|
||||
@@ -208,7 +208,7 @@ void DenseFeatureDetector::detectImpl( const Mat& image, vector<KeyPoint>& keypo
|
||||
}
|
||||
}
|
||||
|
||||
curScale = curScale * featureScaleMul;
|
||||
curScale = static_cast<float>(curScale * featureScaleMul);
|
||||
if( varyXyStepWithScale ) curStep = static_cast<int>( curStep * featureScaleMul + 0.5f );
|
||||
if( varyImgBoundWithScale ) curBound = static_cast<int>( curBound * featureScaleMul + 0.5f );
|
||||
}
|
||||
|
@@ -33,18 +33,20 @@ if (HAVE_CUDA)
|
||||
#set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-keep")
|
||||
#set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;/EHsc-;")
|
||||
|
||||
foreach(var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG)
|
||||
string(REPLACE "/W4" "/W3" ${var} "${${var}}")
|
||||
endforeach()
|
||||
|
||||
if(MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4211 /wd4201 /wd4100 /wd4505 /wd4408 /wd4251")
|
||||
if(NOT ENABLE_NOISY_WARNINGS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4211 /wd4201 /wd4100 /wd4505 /wd4408")
|
||||
|
||||
foreach(var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG)
|
||||
string(REPLACE "/W4" "/W3" ${var} "${${var}}")
|
||||
endforeach()
|
||||
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler /wd4251)
|
||||
endif()
|
||||
|
||||
foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG)
|
||||
string(REPLACE "/EHsc-" "/EHs" ${var} "${${var}}")
|
||||
endforeach()
|
||||
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler /wd4251)
|
||||
endif()
|
||||
|
||||
OCV_CUDA_COMPILE(cuda_objs ${lib_cuda} ${ncv_cuda})
|
||||
|
@@ -195,7 +195,7 @@ Mat getMat(InputArray arr)
|
||||
return arr.getMat();
|
||||
}
|
||||
|
||||
double checkNorm(InputArray m1, const InputArray m2)
|
||||
double checkNorm(InputArray m1, InputArray m2)
|
||||
{
|
||||
return norm(getMat(m1), getMat(m2), NORM_INF);
|
||||
}
|
||||
|
@@ -267,7 +267,7 @@ set_target_properties(${the_module} PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||
|
||||
ocv_add_precompiled_headers(${the_module})
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX AND NOT ENABLE_NOISY_WARNINGS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
|
||||
endif()
|
||||
|
||||
|
@@ -3321,9 +3321,9 @@ bool CvCaptureCAM_DShow::setProperty( int property_id, double value )
|
||||
{
|
||||
if( width != VI.getWidth(index) || height != VI.getHeight(index) )//|| fourcc != VI.getFourcc(index) )
|
||||
{
|
||||
int fps = VI.getFPS(index);
|
||||
int fps = static_cast<int>(VI.getFPS(index));
|
||||
VI.stopDevice(index);
|
||||
VI.setIdealFramerate(index,fps);
|
||||
VI.setIdealFramerate(index, fps);
|
||||
VI.setupDeviceFourcc(index, width, height, fourcc);
|
||||
}
|
||||
width = height = fourcc = -1;
|
||||
|
@@ -308,7 +308,7 @@ pyrDown_( const Mat& _src, Mat& _dst, int borderType )
|
||||
|
||||
|
||||
template<class CastOp, class VecOp> void
|
||||
pyrUp_( const Mat& _src, Mat& _dst, int borderType )
|
||||
pyrUp_( const Mat& _src, Mat& _dst, int)
|
||||
{
|
||||
const int PU_SZ = 3;
|
||||
typedef typename CastOp::type1 WT;
|
||||
|
@@ -70,7 +70,13 @@ set_target_properties(${the_module} PROPERTIES
|
||||
|
||||
if(MSVC AND NOT BUILD_SHARED_LIBS)
|
||||
set_target_properties(${the_module} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3")
|
||||
endif()
|
||||
|
||||
if(MSVC AND NOT ENABLE_NOISY_WARNINGS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4100") #unreferenced formal parameter
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4127") #conditional expression is constant
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4505") #unreferenced local function has been removed
|
||||
string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
|
@@ -3,7 +3,7 @@ if(IOS)
|
||||
endif()
|
||||
|
||||
if(MINGW)
|
||||
set(OPENCV_MODULE_TYPE STATIC)
|
||||
set(OPENCV_MODULE_TYPE STATIC)
|
||||
endif()
|
||||
|
||||
set(the_description "The ts module")
|
||||
@@ -13,12 +13,12 @@ ocv_module_include_directories()
|
||||
ocv_create_module()
|
||||
|
||||
if(BUILD_SHARED_LIBS AND NOT MINGW)
|
||||
add_definitions(-DGTEST_CREATE_SHARED_LIBRARY=1)
|
||||
if (MSVC)
|
||||
add_definitions( "/wd4251 /wd4275")
|
||||
endif()
|
||||
add_definitions(-DGTEST_CREATE_SHARED_LIBRARY=1)
|
||||
if (MSVC AND NOT ENABLE_NOISY_WARNINGS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4275")
|
||||
endif()
|
||||
else()
|
||||
add_definitions(-DGTEST_CREATE_SHARED_LIBRARY=0)
|
||||
add_definitions(-DGTEST_CREATE_SHARED_LIBRARY=0)
|
||||
endif()
|
||||
|
||||
ocv_add_precompiled_headers(${the_module})
|
||||
|
@@ -147,7 +147,7 @@ void Regression::init(const std::string& testSuitName, const std::string& ext)
|
||||
storageOutPath += ext;
|
||||
}
|
||||
}
|
||||
catch(cv::Exception& ex)
|
||||
catch(cv::Exception&)
|
||||
{
|
||||
LOGE("Failed to open sanity data for reading: %s", storageInPath.c_str());
|
||||
}
|
||||
|
@@ -105,7 +105,8 @@ void FastMarchingMethod::heapDown(int idx)
|
||||
if (l < size_ && narrowBand_[l] < narrowBand_[smallest]) smallest = l;
|
||||
if (r < size_ && narrowBand_[r] < narrowBand_[smallest]) smallest = r;
|
||||
|
||||
if (smallest == idx) break;
|
||||
if (smallest == idx)
|
||||
break;
|
||||
else
|
||||
{
|
||||
std::swap(indexOf(narrowBand_[idx]), indexOf(narrowBand_[smallest]));
|
||||
|
@@ -292,7 +292,9 @@ public:
|
||||
}
|
||||
|
||||
Point3_<uchar> cp = frame1(py1,px1), cq = frame1(qy1,qx1);
|
||||
float distColor = sqr(cp.x-cq.x) + sqr(cp.y-cq.y) + sqr(cp.z-cq.z);
|
||||
float distColor = sqr(static_cast<float>(cp.x-cq.x))
|
||||
+ sqr(static_cast<float>(cp.y-cq.y))
|
||||
+ sqr(static_cast<float>(cp.z-cq.z));
|
||||
float w = 1.f / (sqrt(distColor * (dx*dx + dy*dy)) + eps);
|
||||
|
||||
uEst += w * (flowX(qy0,qx0) - dudx*dx - dudy*dy);
|
||||
|
Reference in New Issue
Block a user