mirror of
https://github.com/opencv/opencv.git
synced 2024-11-25 19:50:38 +08:00
commit
f7d956ea3e
@ -101,6 +101,10 @@ if(MINGW)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CV_ICC AND NOT ENABLE_FAST_MATH)
|
||||
add_extra_compiler_option("-fp-model precise")
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
# High level of warnings.
|
||||
add_extra_compiler_option(-W)
|
||||
@ -432,6 +436,13 @@ if(MSVC)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4275) # non dll-interface class 'std::exception' used as base for dll-interface class 'cv::Exception'
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4589) # Constructor of abstract class 'cv::ORB' ignores initializer for virtual base class 'cv::Algorithm'
|
||||
endif()
|
||||
|
||||
if(CV_ICC AND NOT ENABLE_NOISY_WARNINGS)
|
||||
foreach(flags CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_DEBUG)
|
||||
string(REGEX REPLACE "( |^)/W[0-9]+( |$)" "\\1\\2" ${flags} "${${flags}}")
|
||||
endforeach()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Qwd673") # PCH warning
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(APPLE AND NOT CMAKE_CROSSCOMPILING AND NOT DEFINED ENV{LDFLAGS} AND EXISTS "/usr/local/lib")
|
||||
|
@ -302,6 +302,7 @@ macro(ocv_warnings_disable)
|
||||
set(_flag_vars "")
|
||||
set(_msvc_warnings "")
|
||||
set(_gxx_warnings "")
|
||||
set(_icc_warnings "")
|
||||
foreach(arg ${ARGN})
|
||||
if(arg MATCHES "^CMAKE_")
|
||||
list(APPEND _flag_vars ${arg})
|
||||
@ -309,6 +310,8 @@ macro(ocv_warnings_disable)
|
||||
list(APPEND _msvc_warnings ${arg})
|
||||
elseif(arg MATCHES "^-W")
|
||||
list(APPEND _gxx_warnings ${arg})
|
||||
elseif(arg MATCHES "^-wd" OR arg MATCHES "^-Qwd" OR arg MATCHES "^/Qwd")
|
||||
list(APPEND _icc_warnings ${arg})
|
||||
endif()
|
||||
endforeach()
|
||||
if(MSVC AND _msvc_warnings AND _flag_vars)
|
||||
@ -331,9 +334,25 @@ macro(ocv_warnings_disable)
|
||||
endforeach()
|
||||
endforeach()
|
||||
endif()
|
||||
if(CV_ICC AND _icc_warnings AND _flag_vars)
|
||||
foreach(var ${_flag_vars})
|
||||
foreach(warning ${_icc_warnings})
|
||||
if(UNIX)
|
||||
string(REPLACE "-Qwd" "-wd" warning "${warning}")
|
||||
else()
|
||||
string(REPLACE "-wd" "-Qwd" warning "${warning}")
|
||||
endif()
|
||||
ocv_check_flag_support(${var} "${warning}" _varname)
|
||||
if(${_varname})
|
||||
set(${var} "${${var}} ${warning}")
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
endif()
|
||||
unset(_flag_vars)
|
||||
unset(_msvc_warnings)
|
||||
unset(_gxx_warnings)
|
||||
unset(_icc_warnings)
|
||||
endif(NOT ENABLE_NOISY_WARNINGS)
|
||||
endmacro()
|
||||
|
||||
|
@ -1,9 +1,5 @@
|
||||
#include "test_precomp.hpp"
|
||||
#include <cmath>
|
||||
#ifndef NAN
|
||||
#include <limits> // numeric_limits<T>::quiet_NaN()
|
||||
#define NAN std::numeric_limits<float>::quiet_NaN()
|
||||
#endif
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
@ -1895,7 +1891,7 @@ TEST(MinMaxLoc, regression_4955_nans)
|
||||
cv::Mat one_mat(2, 2, CV_32F, cv::Scalar(1));
|
||||
cv::minMaxLoc(one_mat, NULL, NULL, NULL, NULL);
|
||||
|
||||
cv::Mat nan_mat(2, 2, CV_32F, cv::Scalar(NAN));
|
||||
cv::Mat nan_mat(2, 2, CV_32F, cv::Scalar(std::numeric_limits<float>::quiet_NaN()));
|
||||
cv::minMaxLoc(nan_mat, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
|
@ -1087,7 +1087,7 @@ void HOGDescriptorTester::detect(const Mat& img,
|
||||
}
|
||||
|
||||
const double eps = FLT_EPSILON * 100;
|
||||
double diff_norm = cvtest::norm(actual_weights, weights, NORM_L2);
|
||||
double diff_norm = cvtest::norm(actual_weights, weights, NORM_L2 + NORM_RELATIVE);
|
||||
if (diff_norm > eps)
|
||||
{
|
||||
ts->printf(cvtest::TS::SUMMARY, "Weights for found locations aren't equal.\n"
|
||||
@ -1167,7 +1167,7 @@ void HOGDescriptorTester::compute(InputArray _img, vector<float>& descriptors,
|
||||
std::vector<float> actual_descriptors;
|
||||
actual_hog->compute(img, actual_descriptors, winStride, padding, locations);
|
||||
|
||||
double diff_norm = cvtest::norm(actual_descriptors, descriptors, NORM_L2);
|
||||
double diff_norm = cvtest::norm(actual_descriptors, descriptors, NORM_L2 + NORM_RELATIVE);
|
||||
const double eps = FLT_EPSILON * 100;
|
||||
if (diff_norm > eps)
|
||||
{
|
||||
@ -1316,7 +1316,7 @@ void HOGDescriptorTester::computeGradient(const Mat& img, Mat& grad, Mat& qangle
|
||||
const double eps = FLT_EPSILON * 100;
|
||||
for (i = 0; i < 2; ++i)
|
||||
{
|
||||
double diff_norm = cvtest::norm(reference_mats[i], actual_mats[i], NORM_L2);
|
||||
double diff_norm = cvtest::norm(actual_mats[i], reference_mats[i], NORM_L2 + NORM_RELATIVE);
|
||||
if (diff_norm > eps)
|
||||
{
|
||||
ts->printf(cvtest::TS::LOG, "%s matrices are not equal\n"
|
||||
|
Loading…
Reference in New Issue
Block a user