--- file_not_specified_in_diff +++ file_not_specified_in_diff @@ -, +, @@ --- a/cmake/OpenCVPCHSupport.cmake +++ b/cmake/OpenCVPCHSupport.cmake @@ -51,6 +51,25 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags) ENDIF() endif() + IF(CMAKE_COMPILER_IS_GNUCXX) + + GET_PROPERTY(_definitions DIRECTORY PROPERTY COMPILE_DEFINITIONS) + if(_definitions) + foreach(_def ${_definitions}) + LIST(APPEND ${_out_compile_flags} "\"-D${_def}\"") + endforeach() + endif() + GET_TARGET_PROPERTY(_target_definitions ${_PCH_current_target} COMPILE_DEFINITIONS) + if(_target_definitions) + foreach(_def ${_target_definitions}) + LIST(APPEND ${_out_compile_flags} "\"-D${_def}\"") + endforeach() + endif() + + ELSE() + ## TODO ... ? or does it work out of the box + ENDIF() + GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES ) FOREACH(item ${DIRINC}) if(item MATCHES "^${OpenCV_SOURCE_DIR}/modules/") @@ -60,11 +79,15 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags) endif() ENDFOREACH(item) - GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS) - GET_DIRECTORY_PROPERTY(_global_definitions DIRECTORY ${OpenCV_SOURCE_DIR} DEFINITIONS) - #MESSAGE("_directory_flags ${_directory_flags} ${_global_definitions}" ) - LIST(APPEND ${_out_compile_flags} ${_directory_flags}) - LIST(APPEND ${_out_compile_flags} ${_global_definitions}) + get_target_property(DIRINC ${_PCH_current_target} INCLUDE_DIRECTORIES ) + FOREACH(item ${DIRINC}) + if(item MATCHES "^${OpenCV_SOURCE_DIR}/modules/") + LIST(APPEND ${_out_compile_flags} "${_PCH_include_prefix}\"${item}\"") + else() + LIST(APPEND ${_out_compile_flags} "${_PCH_isystem_prefix}\"${item}\"") + endif() + ENDFOREACH(item) + LIST(APPEND ${_out_compile_flags} ${CMAKE_CXX_FLAGS}) SEPARATE_ARGUMENTS(${_out_compile_flags}) @@ -146,9 +169,9 @@ MACRO(_PCH_GET_TARGET_COMPILE_FLAGS _cflags _header_name _pch_path _dowarn ) # if you have different versions of the headers for different build types # you may set _pch_dowarn IF (_dowarn) - set(${_cflags} "${PCH_ADDITIONAL_COMPILER_FLAGS} -Winvalid-pch") + SET(${_cflags} "${PCH_ADDITIONAL_COMPILER_FLAGS} -include \"${CMAKE_CURRENT_BINARY_DIR}/${_header_name}\" -Winvalid-pch " ) ELSE (_dowarn) - set(${_cflags} "${PCH_ADDITIONAL_COMPILER_FLAGS}") + SET(${_cflags} "${PCH_ADDITIONAL_COMPILER_FLAGS} -include \"${CMAKE_CURRENT_BINARY_DIR}/${_header_name}\" " ) ENDIF (_dowarn) ELSE(CMAKE_COMPILER_IS_GNUCXX) @@ -246,12 +269,15 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _input) endif() endif() + get_target_property(DIRINC ${_targetName} INCLUDE_DIRECTORIES) + set_target_properties(${_targetName}_pch_dephelp PROPERTIES INCLUDE_DIRECTORIES "${DIRINC}") + #MESSAGE("_compile_FLAGS: ${_compile_FLAGS}") #message("COMMAND ${CMAKE_CXX_COMPILER} ${_compile_FLAGS} -x c++-header -o ${_output} ${_input}") ADD_CUSTOM_COMMAND( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_name}" - COMMAND ${CMAKE_COMMAND} -E copy "${_input}" "${CMAKE_CURRENT_BINARY_DIR}/${_name}" # ensure same directory! Required by gcc + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_input}" "${CMAKE_CURRENT_BINARY_DIR}/${_name}" # ensure same directory! Required by gcc DEPENDS "${_input}" ) --- a/modules/calib3d/test/test_cameracalibration.cpp +++ a/modules/calib3d/test/test_cameracalibration.cpp @@ -1480,7 +1480,7 @@ void CV_StereoCalibrationTest::run( int ) if( norm(R1t*R1 - eye33) > 0.01 || norm(R2t*R2 - eye33) > 0.01 || - abs(determinant(F)) > 0.01) + std::abs(determinant(F)) > 0.01) { ts->printf( cvtest::TS::LOG, "The computed (by rectify) R1 and R2 are not orthogonal," "or the computed (by calibrate) F is not singular, testcase %d\n", testcase); @@ -1617,7 +1617,7 @@ void CV_StereoCalibrationTest::run( int ) perspectiveTransform( _imgpt1, rectifPoints1, _H1 ); perspectiveTransform( _imgpt2, rectifPoints2, _H2 ); - bool verticalStereo = abs(P2.at(0,3)) < abs(P2.at(1,3)); + bool verticalStereo = std::abs(P2.at(0,3)) < std::abs(P2.at(1,3)); double maxDiff_c = 0, maxDiff_uc = 0; for( int i = 0, k = 0; i < nframes; i++ ) { @@ -1627,9 +1627,9 @@ void CV_StereoCalibrationTest::run( int ) for( int j = 0; j < npoints; j++, k++ ) { - double diff_c = verticalStereo ? abs(temp[0][j].x - temp[1][j].x) : abs(temp[0][j].y - temp[1][j].y); + double diff_c = verticalStereo ? std::abs(temp[0][j].x - temp[1][j].x) : std::abs(temp[0][j].y - temp[1][j].y); Point2f d = rectifPoints1.at(k,0) - rectifPoints2.at(k,0); - double diff_uc = verticalStereo ? abs(d.x) : abs(d.y); + double diff_uc = verticalStereo ? std::abs(d.x) : std::abs(d.y); maxDiff_c = max(maxDiff_c, diff_c); maxDiff_uc = max(maxDiff_uc, diff_uc); if( maxDiff_c > maxScanlineDistErr_c ) --- a/modules/calib3d/test/test_fisheye.cpp +++ a/modules/calib3d/test/test_fisheye.cpp @@ -381,7 +381,7 @@ TEST_F(fisheyeTest, EtimateUncertainties) EXPECT_MAT_NEAR(errors.c, cv::Vec2d(0.890439368129246, 0.816096854937896), 1e-10); EXPECT_MAT_NEAR(errors.k, cv::Vec4d(0.00516248605191506, 0.0168181467500934, 0.0213118690274604, 0.00916010877545648), 1e-10); EXPECT_MAT_NEAR(err_std, cv::Vec2d(0.187475975266883, 0.185678953263995), 1e-10); - CV_Assert(abs(rms - 0.263782587133546) < 1e-10); + CV_Assert(std::abs(rms - 0.263782587133546) < 1e-10); CV_Assert(errors.alpha == 0); } --- a/modules/contrib/src/chamfermatching.cpp +++ a/modules/contrib/src/chamfermatching.cpp @@ -966,10 +966,8 @@ void ChamferMatcher::Matching::computeDistanceTransform(Mat& edges_img, Mat& dis for (int y=0;y(y,x)[0]=x; - annotate_img.at(y,x)[1]=y; - } + annotate_img.at(y,x)[0]=x; + annotate_img.at(y,x)[1]=y; uchar edge_val = edges_img.at(y,x); if( (edge_val!=0) ) { @@ -1013,10 +1011,8 @@ void ChamferMatcher::Matching::computeDistanceTransform(Mat& edges_img, Mat& dis dist_img.at(ny,nx) = dist; q.push(std::make_pair(nx,ny)); - if (&annotate_img!=NULL) { - annotate_img.at(ny,nx)[0]=annotate_img.at(y,x)[0]; - annotate_img.at(ny,nx)[1]=annotate_img.at(y,x)[1]; - } + annotate_img.at(ny,nx)[0]=annotate_img.at(y,x)[0]; + annotate_img.at(ny,nx)[1]=annotate_img.at(y,x)[1]; } } } @@ -1107,26 +1103,22 @@ ChamferMatcher::Match* ChamferMatcher::Matching::localChamferDistance(Point offs float cost = (sum_distance/truncate_)/addr.size(); + float* optr = orientation_img.ptr(y)+x; + float sum_orientation = 0; + int cnt_orientation = 0; - if (&orientation_img!=NULL) { - float* optr = orientation_img.ptr(y)+x; - float sum_orientation = 0; - int cnt_orientation = 0; + for (size_t i=0;iorientations[i]>=-CV_PI && (*(optr+addr[i]))>=-CV_PI) { - sum_orientation += orientation_diff(tpl->orientations[i], (*(optr+addr[i]))); - cnt_orientation++; - } + if(addr[i] < (orientation_img.cols*orientation_img.rows) - (offset.y*orientation_img.cols + offset.x)){ + if (tpl->orientations[i]>=-CV_PI && (*(optr+addr[i]))>=-CV_PI) { + sum_orientation += orientation_diff(tpl->orientations[i], (*(optr+addr[i]))); + cnt_orientation++; } } + } - if (cnt_orientation>0) { - cost = (float)(beta*cost+alpha*(sum_orientation/(2*CV_PI))/cnt_orientation); - } - + if (cnt_orientation>0) { + cost = (float)(beta*cost+alpha*(sum_orientation/(2*CV_PI))/cnt_orientation); } if(cost > 0){ --- a/modules/highgui/src/cap_avfoundation.mm +++ a/modules/highgui/src/cap_avfoundation.mm @@ -913,7 +913,7 @@ -(int) updateImage { } - AVAssetReaderTrackOutput * output = [mMovieReader.outputs objectAtIndex:0]; + AVAssetReaderOutput * output = [mMovieReader.outputs objectAtIndex:0]; CMSampleBufferRef sampleBuffer = [output copyNextSampleBuffer]; if (!sampleBuffer) { [localpool drain]; --- a/modules/highgui/src/cap_qtkit.mm +++ a/modules/highgui/src/cap_qtkit.mm @@ -297,7 +297,7 @@ - (IplImage*)getOutput; // method exits immediately" // using usleep() is not a good alternative, because it may block the GUI. // Create a dummy timer so that runUntilDate does not exit immediately: - [NSTimer scheduledTimerWithTimeInterval:100 target:nil selector:@selector(doFireTimer:) userInfo:nil repeats:YES]; + [NSTimer scheduledTimerWithTimeInterval:100 target:capture selector:@selector(doFireTimer:) userInfo:nil repeats:YES]; while (![capture updateImage] && (total += sleepTime)<=timeOut) { [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:sleepTime]]; } --- a/modules/java/CMakeLists.txt +++ a/modules/java/CMakeLists.txt @@ -247,7 +247,7 @@ if(ANDROID) # build the library project # normally we should do this after a native part, but for a library project we can build the java part first add_custom_command(OUTPUT "${JAR_FILE}" "${JAR_FILE}.dephelper" - COMMAND ${ANT_EXECUTABLE} -q -noinput -k debug + COMMAND ${ANT_EXECUTABLE} -q -noinput -k debug -Djava.target=1.6 -Djava.source=1.6 COMMAND ${CMAKE_COMMAND} -E touch "${JAR_FILE}.dephelper" # can not rely on classes.jar because different versions of SDK update timestamp at different times WORKING_DIRECTORY "${OpenCV_BINARY_DIR}" DEPENDS ${step3_depends} --- a/modules/java/android_test/CMakeLists.txt +++ a/modules/java/android_test/CMakeLists.txt @@ -43,7 +43,7 @@ list(APPEND opencv_test_java_file_deps ${android_proj_target_files}) add_custom_command( OUTPUT "${opencv_test_java_bin_dir}/bin/OpenCVTest-debug.apk" COMMAND ${CMAKE_COMMAND} -E copy "${OpenCV_BINARY_DIR}/lib/${ANDROID_NDK_ABI_NAME}/libopencv_java.so" "${opencv_test_java_bin_dir}/libs/${ANDROID_NDK_ABI_NAME}/libopencv_java.so" - COMMAND ${ANT_EXECUTABLE} -q -noinput -k debug + COMMAND ${ANT_EXECUTABLE} -q -noinput -k debug -Djava.target=1.6 -Djava.source=1.6 COMMAND ${CMAKE_COMMAND} -E touch "${opencv_test_java_bin_dir}/bin/OpenCVTest-debug.apk" # needed because ant does not update the timestamp of updated apk WORKING_DIRECTORY "${opencv_test_java_bin_dir}" MAIN_DEPENDENCY "${opencv_test_java_bin_dir}/${ANDROID_MANIFEST_FILE}" --- a/modules/ml/src/svm.cpp +++ a/modules/ml/src/svm.cpp @@ -1880,7 +1880,7 @@ bool CvSVM::train_auto( const CvMat* _train_data, const CvMat* _responses, qsort(ratios, k_fold, sizeof(ratios[0]), icvCmpIndexedratio); double old_dist = 0.0; for (int k=0; k 0.0) @@ -1897,7 +1897,7 @@ bool CvSVM::train_auto( const CvMat* _train_data, const CvMat* _responses, qsort(ratios, k_fold, sizeof(ratios[0]), icvCmpIndexedratio); new_dist = 0.0; for (int k=0; k(minLoc_); maxlocVal = src1_roi.at(maxLoc); maxlocVal_ = src1_roi.at(maxLoc_); - error0 = ::abs(src1_roi.at(minLoc_) - src1_roi.at(minLoc)); - error1 = ::abs(src1_roi.at(maxLoc_) - src1_roi.at(maxLoc)); + error0 = std::abs(src1_roi.at(minLoc_) - src1_roi.at(minLoc)); + error1 = std::abs(src1_roi.at(maxLoc_) - src1_roi.at(maxLoc)); } if (oneDepth == 6) { @@ -888,8 +888,8 @@ OCL_TEST_P(MinMaxLoc, MAT) minlocVal_ = src1_roi.at(minLoc_); maxlocVal = src1_roi.at(maxLoc); maxlocVal_ = src1_roi.at(maxLoc_); - error0 = ::abs(src1_roi.at(minLoc_) - src1_roi.at(minLoc)); - error1 = ::abs(src1_roi.at(maxLoc_) - src1_roi.at(maxLoc)); + error0 = std::abs(src1_roi.at(minLoc_) - src1_roi.at(minLoc)); + error1 = std::abs(src1_roi.at(maxLoc_) - src1_roi.at(maxLoc)); } EXPECT_DOUBLE_EQ(minVal_, minVal); @@ -993,8 +993,8 @@ OCL_TEST_P(MinMaxLoc, MASK) minlocVal_ = src1_roi.at(minLoc_); maxlocVal = src1_roi.at(maxLoc); maxlocVal_ = src1_roi.at(maxLoc_); - error0 = ::abs(src1_roi.at(minLoc_) - src1_roi.at(minLoc)); - error1 = ::abs(src1_roi.at(maxLoc_) - src1_roi.at(maxLoc)); + error0 = std::abs(src1_roi.at(minLoc_) - src1_roi.at(minLoc)); + error1 = std::abs(src1_roi.at(maxLoc_) - src1_roi.at(maxLoc)); } if (oneDepth == 6) { @@ -1002,8 +1002,8 @@ OCL_TEST_P(MinMaxLoc, MASK) minlocVal_ = src1_roi.at(minLoc_); maxlocVal = src1_roi.at(maxLoc); maxlocVal_ = src1_roi.at(maxLoc_); - error0 = ::abs(src1_roi.at(minLoc_) - src1_roi.at(minLoc)); - error1 = ::abs(src1_roi.at(maxLoc_) - src1_roi.at(maxLoc)); + error0 = std::abs(src1_roi.at(minLoc_) - src1_roi.at(minLoc)); + error1 = std::abs(src1_roi.at(maxLoc_) - src1_roi.at(maxLoc)); } EXPECT_DOUBLE_EQ(minVal_, minVal); --- a/modules/ts/src/gpu_test.cpp +++ a/modules/ts/src/gpu_test.cpp @@ -418,8 +418,8 @@ namespace cvtest if (dist < maxPtDif && fabs(p1.size - p2.size) < maxSizeDif && - abs(p1.angle - p2.angle) < maxAngleDif && - abs(p1.response - p2.response) < maxResponseDif && + std::abs(p1.angle - p2.angle) < maxAngleDif && + std::abs(p1.response - p2.response) < maxResponseDif && p1.octave == p2.octave && p1.class_id == p2.class_id) { --- a/platforms/android/android.toolchain.cmake +++ a/platforms/android/android.toolchain.cmake @@ -1613,13 +1613,13 @@ endmacro() macro( ANDROID_GET_ABI_RAWNAME TOOLCHAIN_FLAG VAR ) - if( "${TOOLCHAIN_FLAG}" STREQUAL "ARMEABI" ) + if( "x${TOOLCHAIN_FLAG}" STREQUAL "xARMEABI" ) set( ${VAR} "armeabi" ) - elseif( "${TOOLCHAIN_FLAG}" STREQUAL "ARMEABI_V7A" ) + elseif( "x${TOOLCHAIN_FLAG}" STREQUAL "xARMEABI_V7A" ) set( ${VAR} "armeabi-v7a" ) - elseif( "${TOOLCHAIN_FLAG}" STREQUAL "X86" ) + elseif( "x${TOOLCHAIN_FLAG}" STREQUAL "xX86" ) set( ${VAR} "x86" ) - elseif( "${TOOLCHAIN_FLAG}" STREQUAL "MIPS" ) + elseif( "x${TOOLCHAIN_FLAG}" STREQUAL "xMIPS" ) set( ${VAR} "mips" ) else() set( ${VAR} "unknown" ) @@ -1652,7 +1652,7 @@ if( NOT PROJECT_NAME STREQUAL "CMAKE_TRY_COMPILE" ) ANDROID_APP_PIE ) if( DEFINED ${__var} ) - if( "${__var}" MATCHES " ") + if( "${${__var}}" MATCHES " ") set( __toolchain_config "${__toolchain_config}set( ${__var} \"${${__var}}\" CACHE INTERNAL \"\" )\n" ) else() set( __toolchain_config "${__toolchain_config}set( ${__var} ${${__var}} CACHE INTERNAL \"\" )\n" ) --- a/samples/gpu/farneback_optical_flow.cpp +++ a/samples/gpu/farneback_optical_flow.cpp @@ -24,8 +24,8 @@ static void colorizeFlow(const Mat &u, const Mat &v, Mat &dst) minMaxLoc(u, &uMin, &uMax, 0, 0); double vMin, vMax; minMaxLoc(v, &vMin, &vMax, 0, 0); - uMin = ::abs(uMin); uMax = ::abs(uMax); - vMin = ::abs(vMin); vMax = ::abs(vMax); + uMin = std::abs(uMin); uMax = std::abs(uMax); + vMin = std::abs(vMin); vMax = std::abs(vMax); float dMax = static_cast(::max(::max(uMin, uMax), ::max(vMin, vMax))); dst.create(u.size(), CV_8UC3);