diff --git a/CMakeLists.txt b/CMakeLists.txt index 02863f8a6..bc81d51cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -624,19 +624,23 @@ include(cmake/OpenCVGenConfig.cmake) include(cmake/OpenCVGenInfoPlist.cmake) # Generate environment setup file -if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH AND UNIX) +if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH) if(ANDROID) get_filename_component(TEST_PATH ${OPENCV_TEST_INSTALL_PATH} DIRECTORY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_android.sh.in" "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" @ONLY) install(PROGRAMS "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT tests) - else() + elseif(WIN32) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_windows.cmd.in" + "${CMAKE_BINARY_DIR}/win-install/opencv_run_all_tests.cmd" @ONLY) + install(PROGRAMS "${CMAKE_BINARY_DIR}/win-install/opencv_run_all_tests.cmd" + DESTINATION ${OPENCV_TEST_INSTALL_PATH} COMPONENT tests) + elseif(UNIX) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_unix.sh.in" "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" @ONLY) install(PROGRAMS "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" DESTINATION ${OPENCV_TEST_INSTALL_PATH} COMPONENT tests) - endif() endif() @@ -995,7 +999,7 @@ if(WITH_IPP AND HAVE_IPP) status(" linked:" BUILD_WITH_DYNAMIC_IPP THEN "dynamic" ELSE "static") endif() else() - status(" Use IPP:" WITH_IPP AND NOT HAVE_IPP THEN "IPP not found" ELSE NO) + status(" Use IPP:" WITH_IPP AND NOT HAVE_IPP THEN "IPP not found or implicitly disabled" ELSE NO) endif() if(DEFINED WITH_IPP_A) diff --git a/apps/annotation/opencv_annotation.cpp b/apps/annotation/opencv_annotation.cpp index 740dfb9a9..1eeb2ee34 100644 --- a/apps/annotation/opencv_annotation.cpp +++ b/apps/annotation/opencv_annotation.cpp @@ -154,6 +154,15 @@ void get_annotations(Mat input_image, stringstream* output_stream) int main( int argc, const char** argv ) { + // If no arguments are given, then supply some information on how this tool works + if( argc == 1 ){ + cout << "Usage: " << argv[0] << endl; + cout << " -images [example - /data/testimages/]" << endl; + cout << " -annotations [example - /data/annotations.txt]" << endl; + + return -1; + } + // Read in the input arguments string image_folder; string annotations; diff --git a/cmake/OpenCVDetectPython.cmake b/cmake/OpenCVDetectPython.cmake index eb2c7bccb..8ed425fb5 100644 --- a/cmake/OpenCVDetectPython.cmake +++ b/cmake/OpenCVDetectPython.cmake @@ -75,10 +75,10 @@ function(find_python preferred_version min_version library_env include_dir_env if(NOT ANDROID AND NOT IOS) ocv_check_environment_variables(${library_env} ${include_dir_env}) - if(${library}) + if(${${library_env}}) set(PYTHON_LIBRARY "${${library_env}}") endif() - if(${include_dir}) + if(${${include_dir_env}}) set(PYTHON_INCLUDE_DIR "${${include_dir_env}}") endif() diff --git a/cmake/OpenCVFindIPP.cmake b/cmake/OpenCVFindIPP.cmake index feb448461..76c73f3e0 100644 --- a/cmake/OpenCVFindIPP.cmake +++ b/cmake/OpenCVFindIPP.cmake @@ -34,6 +34,11 @@ unset(IPP_VERSION_MAJOR) unset(IPP_VERSION_MINOR) unset(IPP_VERSION_BUILD) +if (X86 AND UNIX AND NOT APPLE AND NOT ANDROID AND BUILD_SHARED_LIBS) + message(STATUS "On 32-bit Linux IPP can not currently be used with dynamic libs because of linker errors. Set BUILD_SHARED_LIBS=OFF") + return() +endif() + set(IPP_X64 0) if(CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8) set(IPP_X64 1) diff --git a/cmake/OpenCVPackaging.cmake b/cmake/OpenCVPackaging.cmake index 91f594096..d88826464 100644 --- a/cmake/OpenCVPackaging.cmake +++ b/cmake/OpenCVPackaging.cmake @@ -57,54 +57,54 @@ set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") set(CPACK_DEBIAN_PACKAGE_SECTION "libs") set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://opencv.org") +#display names +set(CPACK_COMPONENT_DEV_DISPLAY_NAME "Development files") +set(CPACK_COMPONENT_DOCS_DISPLAY_NAME "Documentation") +set(CPACK_COMPONENT_JAVA_DISPLAY_NAME "Java bindings") +set(CPACK_COMPONENT_LIBS_DISPLAY_NAME "Libraries and data") +set(CPACK_COMPONENT_PYTHON_DISPLAY_NAME "Python bindings") +set(CPACK_COMPONENT_SAMPLES_DISPLAY_NAME "Samples") +set(CPACK_COMPONENT_TESTS_DISPLAY_NAME "Tests") + #depencencies set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS TRUE) -set(CPACK_COMPONENT_samples_DEPENDS libs) -set(CPACK_COMPONENT_dev_DEPENDS libs) -set(CPACK_COMPONENT_docs_DEPENDS libs) -set(CPACK_COMPONENT_java_DEPENDS libs) -set(CPACK_COMPONENT_python_DEPENDS libs) -set(CPACK_COMPONENT_tests_DEPENDS libs) +set(CPACK_COMPONENT_LIBS_REQUIRED TRUE) +set(CPACK_COMPONENT_SAMPLES_DEPENDS libs) +set(CPACK_COMPONENT_DEV_DEPENDS libs) +set(CPACK_COMPONENT_DOCS_DEPENDS libs) +set(CPACK_COMPONENT_JAVA_DEPENDS libs) +set(CPACK_COMPONENT_PYTHON_DEPENDS libs) +set(CPACK_COMPONENT_TESTS_DEPENDS libs) if(HAVE_CUDA) string(REPLACE "." "-" cuda_version_suffix ${CUDA_VERSION}) - set(CPACK_DEB_libs_PACKAGE_DEPENDS "cuda-core-libs-${cuda_version_suffix}, cuda-extra-libs-${cuda_version_suffix}") - set(CPACK_COMPONENT_dev_DEPENDS libs) - set(CPACK_DEB_dev_PACKAGE_DEPENDS "cuda-headers-${cuda_version_suffix}") + set(CPACK_DEB_LIBS_PACKAGE_DEPENDS "cuda-core-libs-${cuda_version_suffix}, cuda-extra-libs-${cuda_version_suffix}") + set(CPACK_DEB_DEV_PACKAGE_DEPENDS "cuda-headers-${cuda_version_suffix}") endif() if(NOT OPENCV_CUSTOM_PACKAGE_INFO) - set(CPACK_COMPONENT_libs_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}") - set(CPACK_COMPONENT_libs_DESCRIPTION "Open Computer Vision Library") + set(CPACK_COMPONENT_LIBS_DESCRIPTION "Open Computer Vision Library") + set(CPACK_DEBIAN_COMPONENT_LIBS_NAME "lib${CMAKE_PROJECT_NAME}") - set(CPACK_COMPONENT_python_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}-python") - set(CPACK_COMPONENT_python_DESCRIPTION "Python bindings for Open Source Computer Vision Library") + set(CPACK_COMPONENT_PYTHON_DESCRIPTION "Python bindings for Open Source Computer Vision Library") + set(CPACK_DEBIAN_COMPONENT_PYTHON_NAME "lib${CMAKE_PROJECT_NAME}-python") - set(CPACK_COMPONENT_java_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}-java") - set(CPACK_COMPONENT_java_DESCRIPTION "Java bindings for Open Source Computer Vision Library") + set(CPACK_COMPONENT_JAVA_DESCRIPTION "Java bindings for Open Source Computer Vision Library") + set(CPACK_DEBIAN_COMPONENT_JAVA_NAME "lib${CMAKE_PROJECT_NAME}-java") - set(CPACK_COMPONENT_dev_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}-dev") - set(CPACK_COMPONENT_dev_DESCRIPTION "Development files for Open Source Computer Vision Library") + set(CPACK_COMPONENT_DEV_DESCRIPTION "Development files for Open Source Computer Vision Library") + set(CPACK_DEBIAN_COMPONENT_DEV_NAME "lib${CMAKE_PROJECT_NAME}-dev") - set(CPACK_COMPONENT_docs_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}-docs") - set(CPACK_COMPONENT_docs_DESCRIPTION "Documentation for Open Source Computer Vision Library") + set(CPACK_COMPONENT_DOCS_DESCRIPTION "Documentation for Open Source Computer Vision Library") + set(CPACK_DEBIAN_COMPONENT_DOCS_NAME "lib${CMAKE_PROJECT_NAME}-docs") - set(CPACK_COMPONENT_samples_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}-samples") - set(CPACK_COMPONENT_samples_DESCRIPTION "Samples for Open Source Computer Vision Library") + set(CPACK_COMPONENT_SAMPLES_DESCRIPTION "Samples for Open Source Computer Vision Library") + set(CPACK_DEBIAN_COMPONENT_SAMPLES_NAME "lib${CMAKE_PROJECT_NAME}-samples") - set(CPACK_COMPONENT_tests_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}-tests") - set(CPACK_COMPONENT_tests_DESCRIPTION "Accuracy and performance tests for Open Source Computer Vision Library") + set(CPACK_COMPONENT_TESTS_DESCRIPTION "Accuracy and performance tests for Open Source Computer Vision Library") + set(CPACK_DEBIAN_COMPONENT_TESTS_NAME "lib${CMAKE_PROJECT_NAME}-tests") endif(NOT OPENCV_CUSTOM_PACKAGE_INFO) -if(NOT OPENCV_CUSTOM_PACKAGE_LAYOUT) - set(CPACK_libs_COMPONENT_INSTALL TRUE) - set(CPACK_dev_COMPONENT_INSTALL TRUE) - set(CPACK_docs_COMPONENT_INSTALL TRUE) - set(CPACK_python_COMPONENT_INSTALL TRUE) - set(CPACK_java_COMPONENT_INSTALL TRUE) - set(CPACK_samples_COMPONENT_INSTALL TRUE) -endif(NOT OPENCV_CUSTOM_PACKAGE_LAYOUT) - include(CPack) ENDif(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") \ No newline at end of file diff --git a/cmake/templates/opencv_run_all_tests_windows.cmd.in b/cmake/templates/opencv_run_all_tests_windows.cmd.in new file mode 100644 index 000000000..42bb1432d --- /dev/null +++ b/cmake/templates/opencv_run_all_tests_windows.cmd.in @@ -0,0 +1,74 @@ +@echo OFF +setlocal ENABLEDELAYEDEXPANSION + +rem Process command line + +rem This script is designed to allow situations when the tests are installed in +rem a different directory from the library. + +set OPENCV_DIR=%~1 + +if "%OPENCV_DIR%" == "" ( + echo>&2 This script runs the OpenCV tests on Windows. + echo>&2 + echo>&2 usage: %0 ^ + exit /B 1 +) + +if NOT EXIST "%OPENCV_DIR%" ( + echo>&2 error: "%OPENCV_DIR%" doesn't exist +) + +rem Set up paths + +set PATH=%OPENCV_DIR%\@OPENCV_BIN_INSTALL_PATH@;%PATH% +set OPENCV_TEST_PATH=%~dp0 +set OPENCV_TEST_DATA_PATH=%OPENCV_TEST_PATH%\..\testdata + +rem Run tests + +set SUMMARY_STATUS=0 +set FAILED_TESTS= +set PASSED_TESTS= + +for %%t IN ("%OPENCV_TEST_PATH%\opencv_test_*.exe" "%OPENCV_TEST_PATH%\opencv_perf_*.exe") DO ( + set test_name=%%~nt + set report=!test_name!.xml + + set cmd="%%t" --perf_min_samples=1 --perf_force_samples=1 "--gtest_output=xml:!report!" + + echo [!test_name!] RUN : !cmd! + !cmd! + set ret=!errorlevel! + echo [!test_name!] RETURN_CODE : !ret! + + if !ret! EQU 0 ( + echo [!test_name!] OK + set PASSED_TESTS=!PASSED_TESTS! !test_name! + ) ELSE ( + echo [!test_name!] FAILED + set SUMMARY_STATUS=1 + set FAILED_TESTS=!FAILED_TESTS! !test_name! + ) + + echo. +) + +rem Remove temporary test files + +del /F /Q "%TMP%\ocv*.tmp*" + +rem Report final status + +echo =============================================================== +echo PASSED TESTS : %PASSED_TESTS% +echo FAILED TESTS : %FAILED_TESTS% +if %SUMMARY_STATUS% EQU 0 ( + echo STATUS : OK + echo STATUS : All OpenCV tests finished successfully +) ELSE ( + echo STATUS : FAIL + echo STATUS : OpenCV tests finished with status %SUMMARY_STATUS% +) + +exit /B %SUMMARY_STATUS% diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 269311251..bc5a0361a 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -4,7 +4,7 @@ file(GLOB LBP_CASCADES lbpcascades/*.xml) if(ANDROID) install(FILES ${HAAR_CASCADES} DESTINATION sdk/etc/haarcascades COMPONENT libs) install(FILES ${LBP_CASCADES} DESTINATION sdk/etc/lbpcascades COMPONENT libs) -elseif(NOT WIN32) +else() install(FILES ${HAAR_CASCADES} DESTINATION share/OpenCV/haarcascades COMPONENT libs) install(FILES ${LBP_CASCADES} DESTINATION share/OpenCV/lbpcascades COMPONENT libs) endif() diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index a9d6e22a4..866134fe1 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -2,7 +2,11 @@ # CMake file for OpenCV docs #----------------------- -set(HAVE_DOC_GENERATOR BUILD_DOCS AND DOXYGEN_FOUND) +if(BUILD_DOCS AND DOXYGEN_FOUND) + set(HAVE_DOC_GENERATOR TRUE) +else() + set(HAVE_DOC_GENERATOR FALSE) +endif() if(HAVE_DOC_GENERATOR) project(opencv_docs) diff --git a/doc/user_guide/ug_traincascade.markdown b/doc/user_guide/ug_traincascade.markdown index 059d25e8a..d35ec6f5f 100644 --- a/doc/user_guide/ug_traincascade.markdown +++ b/doc/user_guide/ug_traincascade.markdown @@ -7,7 +7,7 @@ Introduction The work with a cascade classifier inlcudes two major stages: training and detection. Detection stage is described in a documentation of objdetect module of general OpenCV documentation. Documentation gives some basic information about cascade classifier. Current guide is describing how -to train a cascade classifier: preparation of a training data and running the training application. +to train a cascade classifier: preparation of the training data and running the training application. ### Important notes @@ -58,9 +58,9 @@ Negative samples are taken from arbitrary images. These images must not contain Negative samples are enumerated in a special file. It is a text file in which each line contains an image filename (relative to the directory of the description file) of negative sample image. This file must be created manually. Note that negative samples and sample images are also called -background samples or background samples images, and are used interchangeably in this document. +background samples or background images, and are used interchangeably in this document. Described images may be of different sizes. But each image should be (but not nessesarily) larger -then a training window size, because these images are used to subsample negative image to the +than a training window size, because these images are used to subsample negative image to the training size. An example of description file: diff --git a/modules/core/include/opencv2/core/cvdef.h b/modules/core/include/opencv2/core/cvdef.h index bd0e44e7c..892c59d3b 100644 --- a/modules/core/include/opencv2/core/cvdef.h +++ b/modules/core/include/opencv2/core/cvdef.h @@ -196,6 +196,10 @@ # define CV_NEON 1 #endif +#if defined __GNUC__ && defined __arm__ && (defined __ARM_PCS_VFP || defined __ARM_VFPV3__) +# define CV_VFP 1 +#endif + #endif // __CUDACC__ #ifndef CV_POPCNT @@ -263,6 +267,10 @@ # define CV_NEON 0 #endif +#ifndef CV_VFP +# define CV_VFP 0 +#endif + /* primitive types */ /* schar - signed 1 byte integer @@ -437,6 +445,23 @@ typedef signed char schar; //! @addtogroup core_utils //! @{ +#if CV_VFP +// 1. general scheme +#define ARM_ROUND(_value, _asm_string) \ + int res; \ + float temp; \ + asm(_asm_string : [res] "=r" (res), [temp] "=w" (temp) : [value] "w" (_value)); \ + return res; +// 2. version for double +#ifdef __clang__ +#define ARM_ROUND_DBL(value) ARM_ROUND(value, "vcvtr.s32.f64 %[temp], %[value] \n vmov %[res], %[temp]") +#else +#define ARM_ROUND_DBL(value) ARM_ROUND(value, "vcvtr.s32.f64 %[temp], %P[value] \n vmov %[res], %[temp]") +#endif +// 3. version for float +#define ARM_ROUND_FLT(value) ARM_ROUND(value, "vcvtr.s32.f32 %[temp], %[value]\n vmov %[res], %[temp]") +#endif // CV_VFP + /** @brief Rounds floating-point number to the nearest integer @param value floating-point number. If the value is outside of INT_MIN ... INT_MAX range, the @@ -460,6 +485,8 @@ CV_INLINE int cvRound( double value ) #elif defined CV_ICC || defined __GNUC__ # ifdef HAVE_TEGRA_OPTIMIZATION TEGRA_ROUND(value); +# elif CV_VFP + ARM_ROUND_DBL(value) # else return (int)lrint(value); # endif @@ -473,6 +500,26 @@ CV_INLINE int cvRound( double value ) #endif } +#ifdef __cplusplus + +/** @overload */ +CV_INLINE int cvRound(float value) +{ +#if CV_VFP && !defined HAVE_TEGRA_OPTIMIZATION + ARM_ROUND_FLT(value) +#else + return cvRound((double)value); +#endif +} + +/** @overload */ +CV_INLINE int cvRound(int value) +{ + return value; +} + +#endif // __cplusplus + /** @brief Rounds floating-point number to the nearest integer not larger than the original. The function computes an integer i such that: diff --git a/modules/core/src/persistence.cpp b/modules/core/src/persistence.cpp index 5e14e81aa..002ff01d0 100644 --- a/modules/core/src/persistence.cpp +++ b/modules/core/src/persistence.cpp @@ -2651,7 +2651,6 @@ CV_IMPL CvFileStorage* cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, const char* encoding ) { CvFileStorage* fs = 0; - char* xml_buf = 0; int default_block_size = 1 << 18; bool append = (flags & 3) == CV_STORAGE_APPEND; bool mem = (flags & CV_STORAGE_MEMORY) != 0; @@ -2692,7 +2691,10 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co (dot_pos[3] == '\0' || (cv_isdigit(dot_pos[3]) && dot_pos[4] == '\0')) ) { if( append ) + { + cvReleaseFileStorage( &fs ); CV_Error(CV_StsNotImplemented, "Appending data to compressed file is not implemented" ); + } isGZ = true; compression = dot_pos[3]; if( compression ) @@ -2713,6 +2715,7 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co if( !fs->gzfile ) goto _exit_; #else + cvReleaseFileStorage( &fs ); CV_Error(CV_StsNotImplemented, "There is no compressed file storage support in this configuration"); #endif } @@ -2765,7 +2768,10 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co if( strcmp( encoding, "UTF-16" ) == 0 || strcmp( encoding, "utf-16" ) == 0 || strcmp( encoding, "Utf-16" ) == 0 ) + { + cvReleaseFileStorage( &fs ); CV_Error( CV_StsBadArg, "UTF-16 XML encoding is not supported! Use 8-bit encoding\n"); + } CV_Assert( strlen(encoding) < 1000 ); char buf[1100]; @@ -2783,7 +2789,7 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co int last_occurence = -1; xml_buf_size = MIN(xml_buf_size, int(file_size)); fseek( fs->file, -xml_buf_size, SEEK_END ); - xml_buf = (char*)cvAlloc( xml_buf_size+2 ); + char* xml_buf = (char*)cvAlloc( xml_buf_size+2 ); // find the last occurence of for(;;) { @@ -2801,8 +2807,12 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co ptr += strlen(substr); } } + cvFree( &xml_buf ); if( last_occurence < 0 ) + { + cvReleaseFileStorage( &fs ); CV_Error( CV_StsError, "Could not find in the end of file.\n" ); + } icvCloseFile( fs ); fs->file = fopen( fs->filename, "r+t" ); fseek( fs->file, last_occurence, SEEK_SET ); @@ -2876,10 +2886,18 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co //mode = cvGetErrMode(); //cvSetErrMode( CV_ErrModeSilent ); - if( fs->fmt == CV_STORAGE_FORMAT_XML ) - icvXMLParse( fs ); - else - icvYMLParse( fs ); + try + { + if( fs->fmt == CV_STORAGE_FORMAT_XML ) + icvXMLParse( fs ); + else + icvYMLParse( fs ); + } + catch (...) + { + cvReleaseFileStorage( &fs ); + throw; + } //cvSetErrMode( mode ); // release resources that we do not need anymore @@ -2904,7 +2922,6 @@ _exit_: } } - cvFree( &xml_buf ); return fs; } diff --git a/modules/core/src/stat.cpp b/modules/core/src/stat.cpp index a5f3e0636..41218904f 100644 --- a/modules/core/src/stat.cpp +++ b/modules/core/src/stat.cpp @@ -2320,7 +2320,10 @@ void cv::minMaxIdx(InputArray _src, double* minVal, depth == CV_8U ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_8u_C1R : depth == CV_8S ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_8s_C1R : depth == CV_16U ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_16u_C1R : - depth == CV_32F ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_32f_C1R : 0; + #if !((defined _MSC_VER && defined _M_IX86) || defined __i386__) + depth == CV_32F ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_32f_C1R : + #endif + 0; CV_SUPPRESS_DEPRECATED_END if( ippFuncC1 ) diff --git a/modules/highgui/src/window_QT.cpp b/modules/highgui/src/window_QT.cpp index 7f37e143a..c89918ee2 100644 --- a/modules/highgui/src/window_QT.cpp +++ b/modules/highgui/src/window_QT.cpp @@ -464,6 +464,7 @@ static int icvInitSystem(int* c, char** v) if (!QApplication::instance()) { new QApplication(*c, v); + setlocale(LC_NUMERIC,"C"); qDebug() << "init done"; diff --git a/modules/highgui/src/window_carbon.cpp b/modules/highgui/src/window_carbon.cpp index 93d9e4f7a..bbc600785 100644 --- a/modules/highgui/src/window_carbon.cpp +++ b/modules/highgui/src/window_carbon.cpp @@ -146,6 +146,7 @@ CV_IMPL int cvInitSystem( int argc, char** argv ) } wasInitialized = 1; } + setlocale(LC_NUMERIC,"C"); return 0; } diff --git a/modules/highgui/src/window_cocoa.mm b/modules/highgui/src/window_cocoa.mm index 414ed6475..b9efe35bb 100644 --- a/modules/highgui/src/window_cocoa.mm +++ b/modules/highgui/src/window_cocoa.mm @@ -156,6 +156,8 @@ CV_IMPL int cvInitSystem( int , char** ) //[application finishLaunching]; //atexit(icvCocoaCleanup); + setlocale(LC_NUMERIC,"C"); + return 0; } diff --git a/modules/highgui/src/window_w32.cpp b/modules/highgui/src/window_w32.cpp index 0878bff60..29b1e41ed 100644 --- a/modules/highgui/src/window_w32.cpp +++ b/modules/highgui/src/window_w32.cpp @@ -260,6 +260,8 @@ CV_IMPL int cvInitSystem( int, char** ) wasInitialized = 1; } + setlocale(LC_NUMERIC,"C"); + return 0; } diff --git a/modules/imgproc/src/imgwarp.cpp b/modules/imgproc/src/imgwarp.cpp index 79ab3eca2..8a1151538 100644 --- a/modules/imgproc/src/imgwarp.cpp +++ b/modules/imgproc/src/imgwarp.cpp @@ -5454,7 +5454,7 @@ static bool ocl_warpTransform(InputArray _src, OutputArray _dst, InputArray _M0, const ocl::Device & dev = ocl::Device::getDefault(); int type = _src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type); - double doubleSupport = dev.doubleFPConfig() > 0; + const bool doubleSupport = dev.doubleFPConfig() > 0; int interpolation = flags & INTER_MAX; if( interpolation == INTER_AREA ) diff --git a/modules/ml/include/opencv2/ml.hpp b/modules/ml/include/opencv2/ml.hpp index c7559aea5..8959c58d8 100644 --- a/modules/ml/include/opencv2/ml.hpp +++ b/modules/ml/include/opencv2/ml.hpp @@ -1339,7 +1339,7 @@ public: //! Regularization kinds enum RegKinds { - REG_NONE = -1, //!< Regularization disabled + REG_DISABLE = -1, //!< Regularization disabled REG_L1 = 0, //!< %L1 norm REG_L2 = 1 //!< %L2 norm }; diff --git a/modules/ml/src/lr.cpp b/modules/ml/src/lr.cpp index e62100998..5a057a205 100644 --- a/modules/ml/src/lr.cpp +++ b/modules/ml/src/lr.cpp @@ -322,7 +322,7 @@ double LogisticRegressionImpl::compute_cost(const Mat& _data, const Mat& _labels theta_b = _init_theta(Range(1, n), Range::all()); multiply(theta_b, theta_b, theta_c, 1); - if(params.norm != REG_NONE) + if (params.norm != REG_DISABLE) { llambda = 1; } @@ -377,7 +377,7 @@ Mat LogisticRegressionImpl::compute_batch_gradient(const Mat& _data, const Mat& m = _data.rows; n = _data.cols; - if(params.norm != REG_NONE) + if (params.norm != REG_DISABLE) { llambda = 1; } @@ -449,7 +449,7 @@ Mat LogisticRegressionImpl::compute_mini_batch_gradient(const Mat& _data, const Mat data_d; Mat labels_l; - if(params.norm != REG_NONE) + if (params.norm != REG_DISABLE) { lambda_l = 1; } diff --git a/modules/python/src2/cv2.cpp b/modules/python/src2/cv2.cpp index 59a4c67bc..ff53d733c 100644 --- a/modules/python/src2/cv2.cpp +++ b/modules/python/src2/cv2.cpp @@ -1235,7 +1235,9 @@ static void init_submodule(PyObject * root, const char * name, PyMethodDef * met submod = PyImport_AddModule(full_name.c_str()); PyDict_SetItemString(d, short_name.c_str(), submod); } - root = submod; + + if (short_name != "") + root = submod; } // populate module's dict diff --git a/modules/video/src/bgfg_KNN.cpp b/modules/video/src/bgfg_KNN.cpp index cddd62c15..334810b81 100755 --- a/modules/video/src/bgfg_KNN.cpp +++ b/modules/video/src/bgfg_KNN.cpp @@ -512,7 +512,7 @@ CV_INLINE void { for (long x = 0; x < _src.cols; x++) { - const uchar* data = _src.ptr(y, x); + const uchar* data = _src.ptr((int)y, (int)x); //update model+ background subtract uchar include=0; @@ -539,15 +539,15 @@ CV_INLINE void { case 0: //foreground - *_dst.ptr(y, x) = 255; + *_dst.ptr((int)y, (int)x) = 255; break; case 1: //background - *_dst.ptr(y, x) = 0; + *_dst.ptr((int)y, (int)x) = 0; break; case 2: //shadow - *_dst.ptr(y, x) = nShadowDetection; + *_dst.ptr((int)y, (int)x) = nShadowDetection; break; } i++; diff --git a/modules/videoio/src/cap_ffmpeg_impl.hpp b/modules/videoio/src/cap_ffmpeg_impl.hpp index 5870f4bc7..5e371d21e 100644 --- a/modules/videoio/src/cap_ffmpeg_impl.hpp +++ b/modules/videoio/src/cap_ffmpeg_impl.hpp @@ -302,7 +302,15 @@ void CvCapture_FFMPEG::close() } if( picture ) + { + // FFmpeg and Libav added avcodec_free_frame in different versions. +#if LIBAVCODEC_BUILD >= (LIBAVCODEC_VERSION_MICRO >= 100 \ + ? CALC_FFMPEG_VERSION(54, 59, 100) : CALC_FFMPEG_VERSION(54, 28, 0)) + avcodec_free_frame(&picture); +#else av_free(picture); +#endif + } if( video_st ) { diff --git a/modules/videoio/src/cap_gstreamer.cpp b/modules/videoio/src/cap_gstreamer.cpp index 3d76d1fdf..d0854ce07 100644 --- a/modules/videoio/src/cap_gstreamer.cpp +++ b/modules/videoio/src/cap_gstreamer.cpp @@ -574,7 +574,7 @@ bool CvCapture_GStreamer::open( int type, const char* filename ) return false; } g_object_unref(G_OBJECT(testfac)); - filename = "v4lsrc ! "COLOR_ELEM" ! appsink"; + filename = "v4lsrc ! " COLOR_ELEM " ! appsink"; } if (type == CV_CAP_GSTREAMER_V4L2){ testfac = gst_element_factory_find("v4l2src"); @@ -582,7 +582,7 @@ bool CvCapture_GStreamer::open( int type, const char* filename ) return false; } g_object_unref(G_OBJECT(testfac)); - filename = "v4l2src ! "COLOR_ELEM" ! appsink"; + filename = "v4l2src ! " COLOR_ELEM " ! appsink"; } diff --git a/platforms/winrt/readme.txt b/platforms/winrt/readme.txt index 9f7d19479..923c7487d 100644 --- a/platforms/winrt/readme.txt +++ b/platforms/winrt/readme.txt @@ -17,14 +17,29 @@ Install Visual Studio Express 2012 for Windows Desktop -To create all Windows Phone (8.0, 8.1) and Windows Store (8.0, 8.1) Visual Studio projects +To create and build all Windows Phone (8.0, 8.1) and Windows Store (8.0, 8.1) Visual Studio projects ========================================================================================== cd opencv/platforms/winrt -setup_winrt.bat "WP,WS" "8.0,8.1" "x86,ARM" +setup_winrt.bat "WP,WS" "8.0,8.1" "x86,ARM" -b If everything's fine, a few minutes later you will get the following output in the opencv/bin directory: bin + install + WP + 8.0 + ARM + x86 + 8.1 + ARM + x86 + WS + 8.0 + ARM + x86 + 8.1 + ARM + x86 WP 8.0 ARM @@ -40,7 +55,11 @@ bin ARM x86 -Build the OpenCV.sln for the particular platform you are targeting. Due to the current limitations of CMake, separate x86/x64/ARM projects must be generated for each platform. +"-b" flag in the command above builds each generated solutions in both "Debug" and "Release" configurations. It also builds the predefined "INSTALL" project within generated solutions. Building it creates a separate install location that accumulates binaries and includes for specified platforms. Default location is "\bin\install\". + +WinRT samples reference 'install' binaries and include files via "OPENCV_WINRT_INSTALL_DIR" environment variable. Please declare it and point to "\bin\install\" directory (note slash at the end) to resolve references within sample applications. + +If you don't want to build all configurations automatically, you can omit "-b" flag and build OpenCV.sln for the particular platform you are targeting manually. Due to the current limitations of CMake, separate x86/x64/ARM projects must be generated for each platform. You can also target a single specific configuration setup_winrt.bat "WP" "8.1" "x86" @@ -99,4 +118,4 @@ To generate Windows Phone 8.1 x86 project files in the opencv/bin dir mkdir bin cd bin -cmake -G "Visual Studio 12 2013" -DCMAKE_SYSTEM_NAME=WindowsPhone -DCMAKE_SYSTEM_VERSION=8.1 ../ \ No newline at end of file +cmake -G "Visual Studio 12 2013" -DCMAKE_SYSTEM_NAME=WindowsPhone -DCMAKE_SYSTEM_VERSION=8.1 ../ diff --git a/samples/cpp/train_HOG.cpp b/samples/cpp/train_HOG.cpp index 68c7f56aa..0a94e348c 100644 --- a/samples/cpp/train_HOG.cpp +++ b/samples/cpp/train_HOG.cpp @@ -403,7 +403,7 @@ void test_it( const Size & size ) int main( int argc, char** argv ) { - if( argc != 4 ) + if( argc != 5 ) { cout << "Wrong number of parameters." << endl << "Usage: " << argv[0] << " pos_dir pos.lst neg_dir neg.lst" << endl diff --git a/samples/cpp/tutorial_code/ml/introduction_to_pca/introduction_to_pca.cpp b/samples/cpp/tutorial_code/ml/introduction_to_pca/introduction_to_pca.cpp index 71a0b7263..52f9e49f4 100644 --- a/samples/cpp/tutorial_code/ml/introduction_to_pca/introduction_to_pca.cpp +++ b/samples/cpp/tutorial_code/ml/introduction_to_pca/introduction_to_pca.cpp @@ -23,7 +23,7 @@ void drawAxis(Mat& img, Point p, Point q, Scalar colour, const float scale = 0.2 double angle; double hypotenuse; angle = atan2( (double) p.y - q.y, (double) p.x - q.x ); // angle in radians - hypotenuse = sqrt( (p.y - q.y) * (p.y - q.y) + (p.x - q.x) * (p.x - q.x)); + hypotenuse = sqrt( (double) (p.y - q.y) * (p.y - q.y) + (p.x - q.x) * (p.x - q.x)); // double degrees = angle * 180 / CV_PI; // convert radians to degrees (0-180 range) // cout << "Degrees: " << abs(degrees - 180) << endl; // angle in 0-360 degrees range