From c92ecc7f9652978551724d8c913c528a60364beb Mon Sep 17 00:00:00 2001 From: KUANG Fangjun Date: Sun, 20 Aug 2017 17:21:39 +0200 Subject: [PATCH 1/6] Improve the documentation. --- CMakeLists.txt | 4 ++-- cmake/OpenCVUtils.cmake | 10 +++++----- cmake/OpenCVVersion.cmake | 4 ++-- .../doc/utility_and_system_functions_and_macros.rst | 12 ++++++------ 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 36c8a0ca3a..b23f7301ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ if(" ${CMAKE_SOURCE_DIR}" STREQUAL " ${CMAKE_BINARY_DIR}") message(FATAL_ERROR " FATAL: In-source builds are not allowed. - You should create separate directory for build files. + You should create a separate directory for build files. ") endif() @@ -189,7 +189,7 @@ OCV_OPTION(BUILD_PACKAGE "Enables 'make package_source' command" OCV_OPTION(BUILD_PERF_TESTS "Build performance tests" ON IF (NOT IOS) ) OCV_OPTION(BUILD_TESTS "Build accuracy & regression tests" ON IF (NOT IOS) ) OCV_OPTION(BUILD_WITH_DEBUG_INFO "Include debug info into debug libs (not MSCV only)" ON ) -OCV_OPTION(BUILD_WITH_STATIC_CRT "Enables use of staticaly linked CRT for staticaly linked OpenCV" ON IF MSVC ) +OCV_OPTION(BUILD_WITH_STATIC_CRT "Enables use of statically linked CRT for staticaly linked OpenCV" ON IF MSVC ) OCV_OPTION(BUILD_FAT_JAVA_LIB "Create fat java wrapper containing the whole OpenCV library" ON IF NOT BUILD_SHARED_LIBS AND CMAKE_COMPILER_IS_GNUCXX ) OCV_OPTION(BUILD_ANDROID_SERVICE "Build OpenCV Manager for Google Play" OFF IF ANDROID AND ANDROID_SOURCE_TREE ) OCV_OPTION(BUILD_ANDROID_PACKAGE "Build platform-specific package for Google Play" OFF IF ANDROID ) diff --git a/cmake/OpenCVUtils.cmake b/cmake/OpenCVUtils.cmake index 6be808c2ed..b79ba8b8d0 100644 --- a/cmake/OpenCVUtils.cmake +++ b/cmake/OpenCVUtils.cmake @@ -5,8 +5,8 @@ if(UNIX) find_package(PkgConfig) endif() -# Search packages for host system instead of packages for target system -# in case of cross compilation thess macro should be defined by toolchain file +# Search packages for the host system instead of packages for target system +# in case of cross compilation these macros should be defined by the toolchain file if(NOT COMMAND find_host_package) macro(find_host_package) find_package(${ARGN}) @@ -82,7 +82,7 @@ macro(ocv_check_environment_variables) endforeach() endmacro() -# adds include directories in such way that directories from the OpenCV source tree go first +# adds include directories in such a way that directories from the OpenCV source tree go first function(ocv_include_directories) set(__add_before "") foreach(dir ${ARGN}) @@ -337,7 +337,7 @@ macro(ocv_check_modules define) endmacro() -# Macros that checks if module have been installed. +# Macro that checks if module has been installed. # After it adds module to build and define # constants passed as second arg macro(CHECK_MODULE module_name define) @@ -526,7 +526,7 @@ macro(ocv_list_add_suffix LST SUFFIX) endmacro() -# gets and removes the first element from list +# gets and removes the first element from the list macro(ocv_list_pop_front LST VAR) if(${LST}) list(GET ${LST} 0 ${VAR}) diff --git a/cmake/OpenCVVersion.cmake b/cmake/OpenCVVersion.cmake index 03de98068b..792fb0587c 100644 --- a/cmake/OpenCVVersion.cmake +++ b/cmake/OpenCVVersion.cmake @@ -14,6 +14,6 @@ endif() set(OPENCV_SOVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}") set(OPENCV_LIBVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}") -# create a dependency on version file -# we never use output of the following command but cmake will rerun automatically if the version file changes +# create a dependency on the version file +# we never use the output of the following command but cmake will rerun automatically if the version file changes configure_file("${OPENCV_VERSION_FILE}" "${CMAKE_BINARY_DIR}/junk/version.junk" COPYONLY) diff --git a/modules/core/doc/utility_and_system_functions_and_macros.rst b/modules/core/doc/utility_and_system_functions_and_macros.rst index 73a6b65386..5b0e7bf18c 100644 --- a/modules/core/doc/utility_and_system_functions_and_macros.rst +++ b/modules/core/doc/utility_and_system_functions_and_macros.rst @@ -31,7 +31,7 @@ Aligns a buffer size to the specified number of bytes. :param n: Alignment size that must be a power of two. -The function returns the minimum number that is greater or equal to ``sz`` and is divisible by ``n`` : +The function returns the minimum number that is greater than or equal to ``sz`` and is divisible by ``n`` : .. math:: @@ -363,7 +363,7 @@ Always returns 0 if called outside of parallel region. .. ocv:function:: int getThreadNum() -The exact meaning of return value depends on the threading framework used by OpenCV library: +The exact meaning of the return value depends on the threading framework used by OpenCV library: * **TBB** – Unsupported with current 4.1 TBB release. May be will be supported in future. * **OpenMP** – The thread number, within the current team, of the calling thread. @@ -450,7 +450,7 @@ This operation is used in the simplest or most complex image processing function setNumThreads ----------------- OpenCV will try to set the number of threads for the next parallel region. -If ``threads == 0``, OpenCV will disable threading optimizations and run all it's +If ``threads == 0``, OpenCV will disable threading optimizations and run all its functions sequentially. Passing ``threads < 0`` will reset threads number to system default. This function must be called outside of parallel region. @@ -458,14 +458,14 @@ This function must be called outside of parallel region. :param nthreads: Number of threads used by OpenCV. -OpenCV will try to run it's functions with specified threads number, but +OpenCV will try to run its functions with specified threads number, but some behaviour differs from framework: * **TBB** – User-defined parallel constructions will run with the same threads number, - if another does not specified. If late on user creates own scheduler, OpenCV will be use it. + if another is not specified. If late on user creates his own scheduler, OpenCV will be use it. * **OpenMP** – No special defined behaviour. * **Concurrency** – If ``threads == 1``, OpenCV will disable threading optimizations - and run it's functions sequentially. + and run its functions sequentially. * **GCD** – Supports only values <= 0. * **C=** – No special defined behaviour. From b43e5e2d21ca246a5542dda2b1979992a27253a6 Mon Sep 17 00:00:00 2001 From: Guillaume Jacob Date: Tue, 22 Aug 2017 20:44:53 +0200 Subject: [PATCH 2/6] CMakeLists.txt: fix a typo in a message --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b23f7301ba..fa585b20b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,8 +77,8 @@ ocv_clear_vars(OpenCVModules_TARGETS) # Break in case of popular CMake configuration mistakes # ---------------------------------------------------------------------------- if(NOT CMAKE_SIZEOF_VOID_P GREATER 0) - message(FATAL_ERROR "CMake fails to deterimine the bitness of target platform. - Please check your CMake and compiler installation. If you are crosscompiling then ensure that your CMake toolchain file correctly sets the compiler details.") + message(FATAL_ERROR "CMake fails to determine the bitness of the target platform. + Please check your CMake and compiler installation. If you are cross-compiling then ensure that your CMake toolchain file correctly sets the compiler details.") endif() # ---------------------------------------------------------------------------- From 7997e7aee9c16f39a96d35e50e66beb67875bc56 Mon Sep 17 00:00:00 2001 From: Benoit Blanchon Date: Mon, 18 Sep 2017 17:47:49 +0200 Subject: [PATCH 3/6] cmake: map RelWithDebInfo and MinSizeRel configuration to Release --- cmake/templates/OpenCVConfig.cmake.in | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmake/templates/OpenCVConfig.cmake.in b/cmake/templates/OpenCVConfig.cmake.in index 167dfa9097..fe85571ebf 100644 --- a/cmake/templates/OpenCVConfig.cmake.in +++ b/cmake/templates/OpenCVConfig.cmake.in @@ -219,6 +219,14 @@ foreach(__cvcomponent ${OpenCV_FIND_COMPONENTS}) string(TOUPPER "${__cvcomponent}" __cvcomponent) set(${__cvcomponent}_FOUND 1) endif() + # OpenCV supports Debug and Release only. + # RelWithDebInfo and MinSizeRel are mapped to Release + if(TARGET ${__cvcomponent}) + set_target_properties(${__cvcomponent} PROPERTIES + MAP_IMPORTED_CONFIG_MINSIZEREL "Release" + MAP_IMPORTED_CONFIG_RELWITHDEBINFO "Release" + ) + endif() endforeach() set(OpenCV_FIND_COMPONENTS ${OpenCV_FIND_COMPONENTS_}) From 0202e527476daceec544e63068742f70d1dfe934 Mon Sep 17 00:00:00 2001 From: blendin Date: Tue, 26 Sep 2017 23:04:01 -0700 Subject: [PATCH 4/6] Fix out of bounds write --- modules/highgui/src/grfmt_bmp.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/highgui/src/grfmt_bmp.cpp b/modules/highgui/src/grfmt_bmp.cpp index 4e12882f50..de60ca6f61 100644 --- a/modules/highgui/src/grfmt_bmp.cpp +++ b/modules/highgui/src/grfmt_bmp.cpp @@ -367,6 +367,9 @@ decode_rle4_bad: ; gray_palette[code] ); line_end_flag = y - prev_y; + + if( y >= m_height ) + break; } else if( code > 2 ) // absolute mode { From 14b686cdc7cf814c0bd937b5f153e3614c202c35 Mon Sep 17 00:00:00 2001 From: berak Date: Sun, 1 Oct 2017 15:32:55 +0200 Subject: [PATCH 5/6] imgcodecs: fix 4 reading channel bmp images --- modules/highgui/src/grfmt_bmp.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/highgui/src/grfmt_bmp.cpp b/modules/highgui/src/grfmt_bmp.cpp index de60ca6f61..bf9bf758a4 100644 --- a/modules/highgui/src/grfmt_bmp.cpp +++ b/modules/highgui/src/grfmt_bmp.cpp @@ -473,8 +473,10 @@ decode_rle8_bad: ; if( !color ) icvCvt_BGRA2Gray_8u_C4C1R( src, 0, data, 0, cvSize(m_width,1) ); - else - icvCvt_BGRA2BGR_8u_C4C3R( src, 0, data, 0, cvSize(m_width,1) ); + else if( img.channels() == 3 ) + icvCvt_BGRA2BGR_8u_C4C3R(src, 0, data, 0, cvSize(m_width, 1)); + else if( img.channels() == 4 ) + memcpy(data, src, m_width * 4); } result = true; break; From 621a1d3b09942f39c2d23117533543cd1dfc3f5d Mon Sep 17 00:00:00 2001 From: Yaron Inger Date: Thu, 5 Oct 2017 20:22:56 +0300 Subject: [PATCH 6/6] videoio: remove AssetsLibrary dependency. The entire AssetsLibrary framework is deprecated since iOS 8.0. The code used in the camera example code can use UIKit to save videos to the camera instead, which allows to avoid linking with PhotoKit instead to prevent increasing the iOS deployment target. --- modules/highgui/CMakeLists.txt | 2 +- modules/highgui/src/cap_ios_video_camera.mm | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/modules/highgui/CMakeLists.txt b/modules/highgui/CMakeLists.txt index dc6f777a0e..d59e95ae09 100644 --- a/modules/highgui/CMakeLists.txt +++ b/modules/highgui/CMakeLists.txt @@ -241,7 +241,7 @@ endif(HAVE_INTELPERC) if(IOS) add_definitions(-DHAVE_IOS=1) list(APPEND highgui_srcs src/ios_conversions.mm src/cap_ios_abstract_camera.mm src/cap_ios_photo_camera.mm src/cap_ios_video_camera.mm) - list(APPEND HIGHGUI_LIBRARIES "-framework Accelerate" "-framework AVFoundation" "-framework CoreGraphics" "-framework CoreMedia" "-framework CoreVideo" "-framework QuartzCore" "-framework AssetsLibrary") + list(APPEND HIGHGUI_LIBRARIES "-framework Accelerate" "-framework AVFoundation" "-framework CoreGraphics" "-framework CoreMedia" "-framework CoreVideo" "-framework QuartzCore" "-framework UIKit") endif() if(WIN32) diff --git a/modules/highgui/src/cap_ios_video_camera.mm b/modules/highgui/src/cap_ios_video_camera.mm index 25b652b403..0f72a7c1d7 100644 --- a/modules/highgui/src/cap_ios_video_camera.mm +++ b/modules/highgui/src/cap_ios_video_camera.mm @@ -31,7 +31,7 @@ #import "opencv2/highgui/cap_ios.h" #include "precomp.hpp" -#import +#import static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}; @@ -595,11 +595,7 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}; return; } - ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init]; - if ([library videoAtPathIsCompatibleWithSavedPhotosAlbum:[self videoFileURL]]) { - [library writeVideoAtPathToSavedPhotosAlbum:[self videoFileURL] - completionBlock:^(NSURL *assetURL, NSError *error){ (void)assetURL; (void)error; }]; - } + UISaveVideoAtPathToSavedPhotosAlbum([self videoFileString], nil, nil, NULL); }