Commit 0e4dde17 authored by Alexander Alekhin's avatar Alexander Alekhin Committed by GitHub

Merge pull request #7872 from alalek:merge-2.4

parent a206e121
......@@ -418,8 +418,13 @@ if(MSVC)
string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
if(NOT ENABLE_NOISY_WARNINGS AND MSVC_VERSION EQUAL 1400)
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4510 /wd4610 /wd4312 /wd4201 /wd4244 /wd4328 /wd4267)
if(NOT ENABLE_NOISY_WARNINGS)
if(MSVC_VERSION EQUAL 1400)
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4510 /wd4610 /wd4312 /wd4201 /wd4244 /wd4328 /wd4267)
endif()
if(MSVC_VERSION LESS 1900) # MSVS2015
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127) # warning C4127: conditional expression is constant
endif()
endif()
# allow extern "C" functions throw exceptions
......
......@@ -691,8 +691,11 @@ function(ocv_install_target)
set(${__package}_TARGETS "${${__package}_TARGETS}" CACHE INTERNAL "List of ${__package} targets")
endif()
if(INSTALL_CREATE_DISTRIB)
if(MSVC AND NOT BUILD_SHARED_LIBS)
if(MSVS)
if(NOT INSTALL_IGNORE_PDB AND
(INSTALL_PDB OR
(INSTALL_CREATE_DISTRIB AND NOT BUILD_SHARED_LIBS)
))
set(__target "${ARGV0}")
set(isArchive 0)
......@@ -720,13 +723,13 @@ function(ocv_install_target)
get_target_property(fname ${__target} LOCATION_DEBUG)
if(fname MATCHES "\\.lib$")
string(REGEX REPLACE "\\.lib$" ".pdb" fname "${fname}")
install(FILES "${fname}" DESTINATION "${__dst}" CONFIGURATIONS Debug)
install(FILES "${fname}" DESTINATION "${__dst}" CONFIGURATIONS Debug OPTIONAL)
endif()
get_target_property(fname ${__target} LOCATION_RELEASE)
if(fname MATCHES "\\.lib$")
string(REGEX REPLACE "\\.lib$" ".pdb" fname "${fname}")
install(FILES "${fname}" DESTINATION "${__dst}" CONFIGURATIONS Release)
install(FILES "${fname}" DESTINATION "${__dst}" CONFIGURATIONS Release OPTIONAL)
endif()
else()
# CMake 2.8.12 broke PDB support for STATIC libraries from MSVS, fix was introduced in CMake 3.1.0.
......
......@@ -242,4 +242,18 @@ void CV_ChessboardSubpixelTest::generateIntrinsicParams()
TEST(Calib3d_ChessboardSubPixDetector, accuracy) { CV_ChessboardSubpixelTest test; test.safe_run(); }
TEST(Calib3d_CornerSubPix, regression_7204)
{
cv::Mat image(cv::Size(70, 38), CV_8UC1, cv::Scalar::all(0));
image(cv::Rect(65, 26, 5, 5)).setTo(cv::Scalar::all(255));
image(cv::Rect(55, 31, 8, 1)).setTo(cv::Scalar::all(255));
image(cv::Rect(56, 35, 14, 2)).setTo(cv::Scalar::all(255));
image(cv::Rect(66, 24, 4, 2)).setTo(cv::Scalar::all(255));
image.at<uchar>(24, 69) = 0;
std::vector<cv::Point2f> corners;
corners.push_back(cv::Point2f(65, 30));
cv::cornerSubPix(image, corners, cv::Size(3, 3), cv::Size(-1, -1),
cv::TermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 30, 0.1));
}
/* End of file. */
......@@ -483,8 +483,10 @@ public:
@param pts The points array for storing rectangle vertices.
*/
void points(Point2f pts[]) const;
//! returns the minimal up-right rectangle containing the rotated rectangle
//! returns the minimal up-right integer rectangle containing the rotated rectangle
Rect boundingRect() const;
//! returns the minimal (exact) floating point rectangle containing the rotated rectangle, not intended for use with images
Rect_<float> boundingRect2f() const;
Point2f center; //< the rectangle mass center
Size2f size; //< width and height of the rectangle
......
This diff is collapsed.
......@@ -5566,6 +5566,16 @@ Rect RotatedRect::boundingRect() const
return r;
}
Rect_<float> RotatedRect::boundingRect2f() const
{
Point2f pt[4];
points(pt);
Rect_<float> r(Point_<float>(min(min(min(pt[0].x, pt[1].x), pt[2].x), pt[3].x), min(min(min(pt[0].y, pt[1].y), pt[2].y), pt[3].y)),
Point_<float>(max(max(max(pt[0].x, pt[1].x), pt[2].x), pt[3].x), max(max(max(pt[0].y, pt[1].y), pt[2].y), pt[3].y)));
return r;
}
}
// glue
......
......@@ -419,9 +419,6 @@ static void fixCCS( Mat& mat, int cols, int flags )
}
}
#if defined _MSC_VER && _MSC_VER >= 1700
#pragma optimize("", off)
#endif
static void mulComplex( const Mat& src1, const Mat& src2, Mat& dst, int flags )
{
dst.create(src1.rows, src1.cols, src1.type());
......@@ -430,12 +427,27 @@ static void mulComplex( const Mat& src1, const Mat& src2, Mat& dst, int flags )
CV_Assert( src1.size == src2.size && src1.type() == src2.type() &&
(src1.type() == CV_32FC2 || src1.type() == CV_64FC2) );
const Mat* src1_ = &src1;
Mat src1_tmp;
if (dst.data == src1.data)
{
src1_tmp = src1.clone();
src1_ = &src1_tmp;
}
const Mat* src2_ = &src2;
Mat src2_tmp;
if (dst.data == src2.data)
{
src2_tmp = src2.clone();
src2_ = &src2_tmp;
}
for( i = 0; i < dst.rows; i++ )
{
if( depth == CV_32F )
{
const float* a = src1.ptr<float>(i);
const float* b = src2.ptr<float>(i);
const float* a = src1_->ptr<float>(i);
const float* b = src2_->ptr<float>(i);
float* c = dst.ptr<float>(i);
if( !(flags & CV_DXT_MUL_CONJ) )
......@@ -459,8 +471,8 @@ static void mulComplex( const Mat& src1, const Mat& src2, Mat& dst, int flags )
}
else
{
const double* a = src1.ptr<double>(i);
const double* b = src2.ptr<double>(i);
const double* a = src1_->ptr<double>(i);
const double* b = src2_->ptr<double>(i);
double* c = dst.ptr<double>(i);
if( !(flags & CV_DXT_MUL_CONJ) )
......@@ -484,9 +496,6 @@ static void mulComplex( const Mat& src1, const Mat& src2, Mat& dst, int flags )
}
}
}
#if defined _MSC_VER && _MSC_VER >= 1700
#pragma optimize("", on)
#endif
}
......@@ -778,9 +787,7 @@ public:
protected:
void run_func();
void prepare_to_validation( int test_case_idx );
#if defined(__aarch64__) && defined(NDEBUG)
double get_success_error_level( int test_case_idx, int i, int j );
#endif
};
......@@ -788,31 +795,19 @@ CxCore_MulSpectrumsTest::CxCore_MulSpectrumsTest() : CxCore_DXTBaseTest( true, t
{
}
#if defined(__aarch64__) && defined(NDEBUG)
double CxCore_MulSpectrumsTest::get_success_error_level( int test_case_idx, int i, int j )
{
(void)test_case_idx;
CV_Assert(i == OUTPUT);
CV_Assert(j == 0);
int elem_depth = CV_MAT_DEPTH(cvGetElemType(test_array[i][j]));
if( elem_depth <= CV_32F )
{
return ArrayTest::get_success_error_level( test_case_idx, i, j );
}
switch( test_case_idx )
{
// Usual threshold is too strict for these test cases due to the difference of fmsub and fsub
case 399:
case 420:
return DBL_EPSILON * 20000;
case 65:
case 161:
case 287:
case 351:
case 458:
return DBL_EPSILON * 10000;
default:
return ArrayTest::get_success_error_level( test_case_idx, i, j );
}
CV_Assert(elem_depth == CV_32F || elem_depth == CV_64F);
element_wise_relative_error = false;
double maxInputValue = 1000; // ArrayTest::get_minmax_bounds
double err = 8 * maxInputValue; // result = A*B + C*D
return (elem_depth == CV_32F ? FLT_EPSILON : DBL_EPSILON) * err;
}
#endif
void CxCore_MulSpectrumsTest::run_func()
{
......
......@@ -167,6 +167,9 @@ static void divSpectrums( InputArray _srcA, InputArray _srcB, OutputArray _dst,
_dst.create( srcA.rows, srcA.cols, type );
Mat dst = _dst.getMat();
CV_Assert(dst.data != srcA.data); // non-inplace check
CV_Assert(dst.data != srcB.data); // non-inplace check
bool is_1d = (flags & DFT_ROWS) || (rows == 1 || (cols == 1 &&
srcA.isContinuous() && srcB.isContinuous() && dst.isContinuous()));
......
......@@ -63,6 +63,7 @@ static bool log_power_checkpoints;
#include <sys/syscall.h>
#include <pthread.h>
#include <cerrno>
static void setCurrentThreadAffinityMask(int mask)
{
pid_t pid=gettid();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment