From 7a52c3d9f18794c73b08ecb9a697a734695c2d5b Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Thu, 5 Mar 2015 18:58:54 +0300 Subject: [PATCH 01/30] 1) make sure Python 2.7 is detected on Ubuntu (including libs) when it's there. 2) disable IPP on 32-bit Linux when OpenCV is built as shared libs. Otherwise we get linker errors 3) disable IPP's minMaxIdx 32-bit floating-point flavor in a hope that it fixes some test failures --- CMakeLists.txt | 2 +- cmake/OpenCVDetectPython.cmake | 3 +++ cmake/OpenCVFindIPP.cmake | 5 +++++ modules/core/src/stat.cpp | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 02863f8a6..89b6cf719 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -995,7 +995,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/cmake/OpenCVDetectPython.cmake b/cmake/OpenCVDetectPython.cmake index eb2c7bccb..bcfdc5e0a 100644 --- a/cmake/OpenCVDetectPython.cmake +++ b/cmake/OpenCVDetectPython.cmake @@ -88,6 +88,9 @@ function(find_python preferred_version min_version library_env include_dir_env find_host_package(PythonLibs "${_version_major_minor}") else() find_host_package(PythonLibs "${_version_major_minor}.${_version_patch}" EXACT) + if(NOT PYTHONLIBS_FOUND) + find_host_package(PythonLibs "${_version_major_minor}.${_version_patch}") + endif() endif() if(PYTHONLIBS_FOUND) diff --git a/cmake/OpenCVFindIPP.cmake b/cmake/OpenCVFindIPP.cmake index feb448461..0242c1303 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. 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/modules/core/src/stat.cpp b/modules/core/src/stat.cpp index 348a68fd3..bd69e5dc7 100644 --- a/modules/core/src/stat.cpp +++ b/modules/core/src/stat.cpp @@ -2314,7 +2314,7 @@ 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; + /*depth == CV_32F ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_32f_C1R :*/ 0; CV_SUPPRESS_DEPRECATED_END if( ippFuncC1 ) From 5d8a1bf8136c3c46f92bce0987687f36e78e327d Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Fri, 6 Mar 2015 15:02:22 +0300 Subject: [PATCH 02/30] explained reason why IPP is disabled on 32-bit Linux. disable IPP's minMaxLoc_32f on 32-bit OSes only --- cmake/OpenCVFindIPP.cmake | 2 +- modules/core/src/stat.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmake/OpenCVFindIPP.cmake b/cmake/OpenCVFindIPP.cmake index 0242c1303..76c73f3e0 100644 --- a/cmake/OpenCVFindIPP.cmake +++ b/cmake/OpenCVFindIPP.cmake @@ -35,7 +35,7 @@ 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. Set BUILD_SHARED_LIBS=OFF") + 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() diff --git a/modules/core/src/stat.cpp b/modules/core/src/stat.cpp index bd69e5dc7..243d1f663 100644 --- a/modules/core/src/stat.cpp +++ b/modules/core/src/stat.cpp @@ -2314,7 +2314,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 ) From cef2cf285232b11e9f64ccc3ad25074f712aecde Mon Sep 17 00:00:00 2001 From: StevenPuttemans Date: Fri, 6 Mar 2015 12:59:26 +0100 Subject: [PATCH 03/30] fixing locale settings - making it universal --- modules/highgui/src/window_QT.cpp | 1 + modules/highgui/src/window_carbon.cpp | 1 + modules/highgui/src/window_cocoa.mm | 2 ++ modules/highgui/src/window_w32.cpp | 2 ++ 4 files changed, 6 insertions(+) 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; } From 4aa6d10a607dc5f64e3eac00176605088ccd9e34 Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Fri, 6 Mar 2015 15:48:36 +0300 Subject: [PATCH 04/30] added Maksim's fix as well; they both handle correctly more cases than each of them individually --- cmake/OpenCVDetectPython.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/OpenCVDetectPython.cmake b/cmake/OpenCVDetectPython.cmake index bcfdc5e0a..754c2f138 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() From a58bfbf3c72f3f896979ff2c72cf9cc4c9db3ccf Mon Sep 17 00:00:00 2001 From: StevenPuttemans Date: Fri, 6 Mar 2015 13:50:46 +0100 Subject: [PATCH 05/30] info on how to use the tool --- apps/annotation/opencv_annotation.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) 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; From 451972f3cfc5efb462bc175642e615ae2b819d34 Mon Sep 17 00:00:00 2001 From: Maksim Shabunin Date: Fri, 27 Feb 2015 18:59:55 +0300 Subject: [PATCH 06/30] Added ARM implementation in cvRound function - note: uses VFPv3 instructions - also added overloaded cvRound variants with float and int parameters - thanks to Marina Kolpakova from Itseez for idea - thanks to developers from #llvm IRC channel for help with inline asm --- modules/core/include/opencv2/core/cvdef.h | 47 +++++++++++++++++++++++ 1 file changed, 47 insertions(+) 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: From ee2d7a1f391dd66a4650131bfe8b9ca50d01499c Mon Sep 17 00:00:00 2001 From: Maksim Shabunin Date: Fri, 6 Mar 2015 16:16:57 +0300 Subject: [PATCH 07/30] Fixed warnings for iOS --- modules/video/src/bgfg_KNN.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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++; From 643bbb2d93a23390736942566fa1c01993927cdc Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Fri, 6 Mar 2015 16:57:38 +0300 Subject: [PATCH 08/30] looks like Maksim was right; the new fix does not do the second attempt to detect python libs, it finds it correctly with the first attempt --- cmake/OpenCVDetectPython.cmake | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/cmake/OpenCVDetectPython.cmake b/cmake/OpenCVDetectPython.cmake index 754c2f138..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_env}) + if(${${library_env}}) set(PYTHON_LIBRARY "${${library_env}}") endif() - if(${include_dir_env}) + if(${${include_dir_env}}) set(PYTHON_INCLUDE_DIR "${${include_dir_env}}") endif() @@ -88,9 +88,6 @@ function(find_python preferred_version min_version library_env include_dir_env find_host_package(PythonLibs "${_version_major_minor}") else() find_host_package(PythonLibs "${_version_major_minor}.${_version_patch}" EXACT) - if(NOT PYTHONLIBS_FOUND) - find_host_package(PythonLibs "${_version_major_minor}.${_version_patch}") - endif() endif() if(PYTHONLIBS_FOUND) From 135701feac1e6134b1e12e7e0eda1710150b5eb8 Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Fri, 6 Mar 2015 17:04:54 +0300 Subject: [PATCH 09/30] Double used as boolean for no reason --- modules/imgproc/src/imgwarp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ) From ee55e4595c254fef1cc997b177fedc014c1b84ea Mon Sep 17 00:00:00 2001 From: Nils Plath Date: Sun, 8 Mar 2015 00:19:25 +0100 Subject: [PATCH 10/30] - Fixed compile error that appeared with Clang 5.1 on Mac 10.8.5: modules/videoio/src/cap_gstreamer.cpp:577:31: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal] filename = "v4lsrc ! "COLOR_ELEM" ! appsink"; ^ modules/videoio/src/cap_gstreamer.cpp:585:32: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal] filename = "v4l2src ! "COLOR_ELEM" ! appsink"; --- modules/videoio/src/cap_gstreamer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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"; } From 0e5c7720a48e76155a89d73edcf02faf3f366766 Mon Sep 17 00:00:00 2001 From: guopei Date: Sun, 8 Mar 2015 18:51:48 +0800 Subject: [PATCH 11/30] grammar fix: a -> the --- doc/user_guide/ug_traincascade.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user_guide/ug_traincascade.markdown b/doc/user_guide/ug_traincascade.markdown index 059d25e8a..99831ba18 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 From f94b22fa5e6da5d1a8052d56678eeb4c25bce51f Mon Sep 17 00:00:00 2001 From: guopei Date: Sun, 8 Mar 2015 18:59:28 +0800 Subject: [PATCH 12/30] grammar fix: then -> than --- doc/user_guide/ug_traincascade.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/user_guide/ug_traincascade.markdown b/doc/user_guide/ug_traincascade.markdown index 059d25e8a..ae5e29a76 100644 --- a/doc/user_guide/ug_traincascade.markdown +++ b/doc/user_guide/ug_traincascade.markdown @@ -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: From 6b8ebf3e94dccd2c54056b6b8eee64ea6d99dbcd Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Tue, 9 Dec 2014 19:13:19 +0300 Subject: [PATCH 13/30] Fix memory leaks appearing when cvOpenFileStorage throws (cherry picked from commit 16ce114e0cad6c85efead4a0ebb07724d691407a) --- modules/core/src/persistence.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/modules/core/src/persistence.cpp b/modules/core/src/persistence.cpp index 5e14e81aa..5c8fd2f97 100644 --- a/modules/core/src/persistence.cpp +++ b/modules/core/src/persistence.cpp @@ -2692,7 +2692,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 +2716,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 +2769,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]; @@ -2802,7 +2809,10 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co } } 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 From 6274e1fc5fde32cf27aca5278b98676cd8c8a5f9 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Mon, 22 Dec 2014 18:54:39 +0300 Subject: [PATCH 14/30] cvOpenFileStorage: reduce the scope of xml_buf and make sure it's freed... ... before any exceptions occur. (cherry picked from commit 08da247a871ed40b868119a999af538da6526c6d) --- modules/core/src/persistence.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/core/src/persistence.cpp b/modules/core/src/persistence.cpp index 5c8fd2f97..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; @@ -2790,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(;;) { @@ -2808,6 +2807,7 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co ptr += strlen(substr); } } + cvFree( &xml_buf ); if( last_occurence < 0 ) { cvReleaseFileStorage( &fs ); @@ -2922,7 +2922,6 @@ _exit_: } } - cvFree( &xml_buf ); return fs; } From 1858b5cfba95b7dee7850d2c1c15c4a62aa58fcc Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Thu, 12 Feb 2015 16:51:26 +0300 Subject: [PATCH 15/30] Don't install documentation if it isn't built The HAVE_DOC_GENERATOR variable was always true. (cherry picked from commit 3d46c1f9602bea7e6c6a49db8b6f2421166ef65d) Conflicts: doc/CMakeLists.txt --- doc/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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) From 34ad2e0fa44340f5a7d2aec993ab541770a4be7d Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Fri, 13 Feb 2015 15:12:52 +0300 Subject: [PATCH 16/30] Fix a memory leak in CvCapture_FFMPEG::close FFmpeg now requires that frames allocated with avcodec_alloc_frame are freed with avcodec_free_frame. (cherry picked from commit 77578d415f4d2b22a4ee1989ef0afda73c9d649b) Conflicts: modules/highgui/src/cap_ffmpeg_impl.hpp --- modules/videoio/src/cap_ffmpeg_impl.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) 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 ) { From 1a3273a7e3f03feeadd242880f4aae9e40a03099 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Fri, 13 Feb 2015 15:31:19 +0300 Subject: [PATCH 17/30] Remove useless CPACK_*_COMPONENT_INSTALL variables They don't actually do anything. And even if they did, all components are enabled by default, anyway. (cherry picked from commit 49fe496914cca93f19dd61aa7b1c120037d65282) Conflicts: cmake/OpenCVPackaging.cmake --- cmake/OpenCVPackaging.cmake | 9 --------- 1 file changed, 9 deletions(-) diff --git a/cmake/OpenCVPackaging.cmake b/cmake/OpenCVPackaging.cmake index 91f594096..eb26df69b 100644 --- a/cmake/OpenCVPackaging.cmake +++ b/cmake/OpenCVPackaging.cmake @@ -96,15 +96,6 @@ if(NOT OPENCV_CUSTOM_PACKAGE_INFO) set(CPACK_COMPONENT_tests_DESCRIPTION "Accuracy and performance tests for Open Source Computer Vision Library") 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 From 592122bf4fcadb2f653c95b8d6e0d69fc0d44ba0 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Mon, 16 Feb 2015 19:24:07 +0300 Subject: [PATCH 18/30] Install data on Windows Because why not? (cherry picked from commit e8a73940099b9823879e156a896e42a1854ca1bb) Conflicts: data/CMakeLists.txt --- data/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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() From 35760bb6bfa1ca11e81244247d7d4d2e9050d991 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Fri, 20 Feb 2015 12:38:25 +0300 Subject: [PATCH 19/30] Add a script to run all tests on Windows It's pretty much a simplified copy of the Linux script, lacking fancy colors. Also, I had to drop Python testing, because it's not easy to pass the Python module location to the script, and I have no pressing need to run the Python tests at the moment. (cherry picked from commit c1e3ca170e6acd983fc010bffd6bc10f12a738c5) Conflicts: CMakeLists.txt --- CMakeLists.txt | 10 ++- .../opencv_run_all_tests_windows.cmd.in | 74 +++++++++++++++++++ 2 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 cmake/templates/opencv_run_all_tests_windows.cmd.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 89b6cf719..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() 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% From 87eb3f6e682fa8f76cb8a548b6c5e82fca1386ec Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Fri, 20 Feb 2015 18:15:20 +0300 Subject: [PATCH 20/30] Update the CPack variables to match the changes in asmorkalov/CMake#1 Which also happens to align the non-Debian specific variables with the ones used by upstream CMake. (cherry picked from commit b8c60234c3fa94c31a3e2a72275fefa811c75d5c) Conflicts: cmake/OpenCVPackaging.cmake --- cmake/OpenCVPackaging.cmake | 45 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/cmake/OpenCVPackaging.cmake b/cmake/OpenCVPackaging.cmake index eb26df69b..d9f1cd5e0 100644 --- a/cmake/OpenCVPackaging.cmake +++ b/cmake/OpenCVPackaging.cmake @@ -59,41 +59,40 @@ set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://opencv.org") #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_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) include(CPack) From 8a732e306fea886478e1982c42664a8bd1369540 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Fri, 20 Feb 2015 18:20:29 +0300 Subject: [PATCH 21/30] Add component display names (cherry picked from commit 6d52ea898442d2458a40f8b06b75320c9ab4a5cc) --- cmake/OpenCVPackaging.cmake | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmake/OpenCVPackaging.cmake b/cmake/OpenCVPackaging.cmake index d9f1cd5e0..9ef9436a1 100644 --- a/cmake/OpenCVPackaging.cmake +++ b/cmake/OpenCVPackaging.cmake @@ -57,6 +57,15 @@ 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) From c71e94f054874c4c7933608e6525240e72ce8fe7 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Fri, 20 Feb 2015 18:37:21 +0300 Subject: [PATCH 22/30] Mark the libs component required Everything else depends on it, after all. (cherry picked from commit cf54e3b97ea13c0aeef5e94b5330a4b26a601d81) Conflicts: cmake/OpenCVPackaging.cmake --- cmake/OpenCVPackaging.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/OpenCVPackaging.cmake b/cmake/OpenCVPackaging.cmake index 9ef9436a1..d88826464 100644 --- a/cmake/OpenCVPackaging.cmake +++ b/cmake/OpenCVPackaging.cmake @@ -68,6 +68,7 @@ set(CPACK_COMPONENT_TESTS_DISPLAY_NAME "Tests") #depencencies set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS TRUE) +set(CPACK_COMPONENT_LIBS_REQUIRED TRUE) set(CPACK_COMPONENT_SAMPLES_DEPENDS libs) set(CPACK_COMPONENT_DEV_DEPENDS libs) set(CPACK_COMPONENT_DOCS_DEPENDS libs) From deb2cb752b566d2a11f5f8684b4e823e200171f6 Mon Sep 17 00:00:00 2001 From: Max Kostin Date: Tue, 10 Mar 2015 16:54:08 +0300 Subject: [PATCH 23/30] Updates README for setup_script Updates README to reflect setup_script build capabilities and requirements to setup binaries and includes for sample applications. Fixes #24 --- platforms/winrt/readme.txt | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/platforms/winrt/readme.txt b/platforms/winrt/readme.txt index 9f7d19479..0ad385513 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 ../ From 052c010d3f2b8d34302e07a1317e5d17ffd3ff58 Mon Sep 17 00:00:00 2001 From: Maxim Kostin Date: Tue, 10 Mar 2015 17:02:31 +0300 Subject: [PATCH 24/30] Reformatted since this is not a markdown file --- platforms/winrt/readme.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platforms/winrt/readme.txt b/platforms/winrt/readme.txt index 0ad385513..8018eb562 100644 --- a/platforms/winrt/readme.txt +++ b/platforms/winrt/readme.txt @@ -55,11 +55,11 @@ bin ARM x86 -'-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\```. +"-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. +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. +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" From 211a131351cccbcce6f5412180da64f650a8b1a4 Mon Sep 17 00:00:00 2001 From: Adam Greig Date: Mon, 2 Mar 2015 04:04:14 +0000 Subject: [PATCH 25/30] Fix Python3 binding's submodules Previously the Python3 cv2 package ends up with no submodules (bgsegm, face, etc) in it, which makes a lot of functionality unusable. By not writing over our root reference we ensure the new submodules are added to the correct cv2 module. --- modules/python/src2/cv2.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 From b194812f5afd8b7d82b3748a9d5e76a29a2aa38e Mon Sep 17 00:00:00 2001 From: Maxim Kostin Date: Wed, 11 Mar 2015 13:22:22 +0300 Subject: [PATCH 26/30] Fixed trailing whitespace. --- platforms/winrt/readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platforms/winrt/readme.txt b/platforms/winrt/readme.txt index 8018eb562..923c7487d 100644 --- a/platforms/winrt/readme.txt +++ b/platforms/winrt/readme.txt @@ -39,7 +39,7 @@ bin x86 8.1 ARM - x86 + x86 WP 8.0 ARM From b21b24fd8a1bd59433806822fef3ea4f293f6a96 Mon Sep 17 00:00:00 2001 From: LorenaGdL Date: Wed, 11 Mar 2015 14:18:07 +0100 Subject: [PATCH 27/30] Update train_HOG.cpp Incorrect number of input arguments in main function --- samples/cpp/train_HOG.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 49b38fe79310b4db65270e63d59f2eb86cb4e6cc Mon Sep 17 00:00:00 2001 From: ippei ito Date: Thu, 12 Mar 2015 00:32:17 +0900 Subject: [PATCH 28/30] Fixed compile error build with VisualStudio2013 on windows. REG_NONE defined in ml.hpp conflicts with defined in Winnt.h --- modules/ml/include/opencv2/ml.hpp | 2 +- modules/ml/src/lr.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) 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..06ac0bce0 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; } From 518fd59a105d71da202c50c8c52fd20ba33e6add Mon Sep 17 00:00:00 2001 From: ippei ito Date: Thu, 12 Mar 2015 01:09:15 +0900 Subject: [PATCH 29/30] fixed whitespace error --- modules/ml/src/lr.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/ml/src/lr.cpp b/modules/ml/src/lr.cpp index 06ac0bce0..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_DISABLE) + 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_DISABLE) + 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_DISABLE) + if (params.norm != REG_DISABLE) { lambda_l = 1; } From 50b99e5aefed331d9363f0e61fc1c1a6b8416844 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Thu, 12 Mar 2015 19:07:53 +0300 Subject: [PATCH 30/30] fix compilation on MSVS2010 --- .../ml/introduction_to_pca/introduction_to_pca.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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