From 450de5f3c61e072323d5ed705909782ea70ed5ea Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Fri, 22 Jan 2021 21:13:33 +0100 Subject: [PATCH] [OpenCV] update to v4.5 and to v3.4.12 (#15162) * [tesseract] add missing reference for downstream projects * [tesseract] restore ci, fix many regressions that are uncovered by that * Update ports/opencv2/CONTROL Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * [opencv] fix regressions on uwp, accept failure on arm64 for now * Apply suggestions from code review Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * [opencv4] allow failures on all arm windows targets, both win32 and uwp * [OpenCV] update to v4.5, draft * Restore CI tests on arm architectures, they will have to work! * adopts hints from #15180 * [libarchive] bump control version * [libarchive] use vcpkg-cmake-wrapper instead of a custom libarchiveConfig, since it is vcpkg-provided and not port-provided * enable features to be visible in parent scope * apply documentation fix from CI * [libarchive] remove unnecessary lines in portfile * update patches * restore ci tests for all opencv4 configs * add port versions to baseline * [OpenCV contrib] fix glog integration * [OpenCV4] fix target processor detection * update version refs * [OpenCV3] fix target processor detection * fix also ocv3 * remove vtk feature from opencv-ci testing * remove qt5-tools from baseline, it works locally Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> --- ports/opencv3/0002-install-options.patch | 130 ++--- .../0004-add-missing-stdexcept-include.patch | 24 +- ports/opencv3/0005-fix-vtk9.patch | 2 +- ports/opencv3/0009-fix-uwp.patch | 2 +- ports/opencv3/CONTROL | 3 +- ports/opencv3/portfile.cmake | 22 +- ports/opencv4/0002-install-options.patch | 14 +- .../0003-force-package-requirements.patch | 12 +- ports/opencv4/0004-fix-policy-CMP0057.patch | 4 +- .../0005-add-missing-stdexcept-include.patch | 24 +- .../0006-fix-glog-abbreviated-severity.patch | 12 + ports/opencv4/0006-jpeg2000_getref.patch | 33 -- ports/opencv4/0007-fix-vtk9-contrib.patch | 470 ------------------ ports/opencv4/0008-fix-vtk9.patch | 41 -- ports/opencv4/0009-fix-uwp.patch | 4 +- ports/opencv4/CONTROL | 3 +- ports/opencv4/portfile.cmake | 44 +- scripts/ci.baseline.txt | 9 +- versions/baseline.json | 8 +- versions/o-/opencv3.json | 5 + versions/o-/opencv4.json | 5 + 21 files changed, 185 insertions(+), 686 deletions(-) create mode 100644 ports/opencv4/0006-fix-glog-abbreviated-severity.patch delete mode 100644 ports/opencv4/0006-jpeg2000_getref.patch delete mode 100644 ports/opencv4/0007-fix-vtk9-contrib.patch delete mode 100644 ports/opencv4/0008-fix-vtk9.patch diff --git a/ports/opencv3/0002-install-options.patch b/ports/opencv3/0002-install-options.patch index 4f0197f9d2..1657579fa7 100644 --- a/ports/opencv3/0002-install-options.patch +++ b/ports/opencv3/0002-install-options.patch @@ -1,65 +1,65 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 614baa2..1e930a3 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -601,7 +601,7 @@ endif() - ocv_cmake_hook(POST_CMAKE_BUILD_OPTIONS) - - # --- Python Support --- --if(NOT IOS) -+if(0) - include(cmake/OpenCVDetectPython.cmake) - endif() - -diff --git a/cmake/OpenCVCompilerOptions.cmake b/cmake/OpenCVCompilerOptions.cmake -index 476156f..4b27b6a 100644 ---- a/cmake/OpenCVCompilerOptions.cmake -+++ b/cmake/OpenCVCompilerOptions.cmake -@@ -261,7 +261,6 @@ if(MSVC) - #endif() - - if(BUILD_WITH_DEBUG_INFO) -- set(OPENCV_EXTRA_FLAGS_RELEASE "${OPENCV_EXTRA_FLAGS_RELEASE} /Zi") - set(OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE} /debug") - set(OPENCV_EXTRA_SHARED_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_SHARED_LINKER_FLAGS_RELEASE} /debug") - endif() -diff --git a/cmake/OpenCVGenConfig.cmake b/cmake/OpenCVGenConfig.cmake -index c7f9fc2..84bd302 100644 ---- a/cmake/OpenCVGenConfig.cmake -+++ b/cmake/OpenCVGenConfig.cmake -@@ -109,11 +109,11 @@ function(ocv_gen_config TMP_DIR NESTED_PATH ROOT_NAME) - endif() - endfunction() - --if((CMAKE_HOST_SYSTEM_NAME MATCHES "Linux" OR UNIX) AND NOT ANDROID) -+if(TRUE) - ocv_gen_config("${CMAKE_BINARY_DIR}/unix-install" "" "") - endif() - --if(ANDROID) -+if(FALSE) - ocv_gen_config("${CMAKE_BINARY_DIR}/unix-install" "abi-${ANDROID_NDK_ABI_NAME}" "OpenCVConfig.root-ANDROID.cmake.in") - install(FILES "${OpenCV_SOURCE_DIR}/platforms/android/android.toolchain.cmake" DESTINATION "${OPENCV_CONFIG_INSTALL_PATH}" COMPONENT dev) - endif() -@@ -121,7 +121,7 @@ endif() - # -------------------------------------------------------------------------------------------- - # Part 3/3: ${BIN_DIR}/win-install/OpenCVConfig.cmake -> For use within binary installers/packages - # -------------------------------------------------------------------------------------------- --if(WIN32) -+if(0) - if(CMAKE_HOST_SYSTEM_NAME MATCHES Windows AND NOT OPENCV_SKIP_CMAKE_ROOT_CONFIG) - ocv_gen_config("${CMAKE_BINARY_DIR}/win-install" - "${OPENCV_INSTALL_BINARIES_PREFIX}${OPENCV_INSTALL_BINARIES_SUFFIX}" -diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt -index 1f0d720..0bb1ff7 100644 ---- a/data/CMakeLists.txt -+++ b/data/CMakeLists.txt -@@ -1,8 +1,6 @@ - file(GLOB HAAR_CASCADES haarcascades/*.xml) - file(GLOB LBP_CASCADES lbpcascades/*.xml) - --install(FILES ${HAAR_CASCADES} DESTINATION ${OPENCV_OTHER_INSTALL_PATH}/haarcascades COMPONENT libs) --install(FILES ${LBP_CASCADES} DESTINATION ${OPENCV_OTHER_INSTALL_PATH}/lbpcascades COMPONENT libs) - - if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH) - install(DIRECTORY "${OPENCV_TEST_DATA_PATH}/" DESTINATION "${OPENCV_TEST_DATA_INSTALL_PATH}" COMPONENT "tests") +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d143a7a..15eb053 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -602,7 +602,7 @@ endif() + ocv_cmake_hook(POST_CMAKE_BUILD_OPTIONS) + + # --- Python Support --- +-if(NOT IOS) ++if(FALSE) + include(cmake/OpenCVDetectPython.cmake) + endif() + +diff --git a/cmake/OpenCVCompilerOptions.cmake b/cmake/OpenCVCompilerOptions.cmake +index 9ac671d..b14ce09 100644 +--- a/cmake/OpenCVCompilerOptions.cmake ++++ b/cmake/OpenCVCompilerOptions.cmake +@@ -263,7 +263,6 @@ if(MSVC) + #endif() + + if(BUILD_WITH_DEBUG_INFO) +- set(OPENCV_EXTRA_FLAGS_RELEASE "${OPENCV_EXTRA_FLAGS_RELEASE} /Zi") + set(OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE} /debug") + set(OPENCV_EXTRA_SHARED_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_SHARED_LINKER_FLAGS_RELEASE} /debug") + endif() +diff --git a/cmake/OpenCVGenConfig.cmake b/cmake/OpenCVGenConfig.cmake +index c7f9fc2..a1f657b 100644 +--- a/cmake/OpenCVGenConfig.cmake ++++ b/cmake/OpenCVGenConfig.cmake +@@ -109,11 +109,11 @@ function(ocv_gen_config TMP_DIR NESTED_PATH ROOT_NAME) + endif() + endfunction() + +-if((CMAKE_HOST_SYSTEM_NAME MATCHES "Linux" OR UNIX) AND NOT ANDROID) ++if(TRUE) + ocv_gen_config("${CMAKE_BINARY_DIR}/unix-install" "" "") + endif() + +-if(ANDROID) ++if(FALSE) + ocv_gen_config("${CMAKE_BINARY_DIR}/unix-install" "abi-${ANDROID_NDK_ABI_NAME}" "OpenCVConfig.root-ANDROID.cmake.in") + install(FILES "${OpenCV_SOURCE_DIR}/platforms/android/android.toolchain.cmake" DESTINATION "${OPENCV_CONFIG_INSTALL_PATH}" COMPONENT dev) + endif() +@@ -121,7 +121,7 @@ endif() + # -------------------------------------------------------------------------------------------- + # Part 3/3: ${BIN_DIR}/win-install/OpenCVConfig.cmake -> For use within binary installers/packages + # -------------------------------------------------------------------------------------------- +-if(WIN32) ++if(FALSE) + if(CMAKE_HOST_SYSTEM_NAME MATCHES Windows AND NOT OPENCV_SKIP_CMAKE_ROOT_CONFIG) + ocv_gen_config("${CMAKE_BINARY_DIR}/win-install" + "${OPENCV_INSTALL_BINARIES_PREFIX}${OPENCV_INSTALL_BINARIES_SUFFIX}" +diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt +index 1f0d720..0bb1ff7 100644 +--- a/data/CMakeLists.txt ++++ b/data/CMakeLists.txt +@@ -1,8 +1,6 @@ + file(GLOB HAAR_CASCADES haarcascades/*.xml) + file(GLOB LBP_CASCADES lbpcascades/*.xml) + +-install(FILES ${HAAR_CASCADES} DESTINATION ${OPENCV_OTHER_INSTALL_PATH}/haarcascades COMPONENT libs) +-install(FILES ${LBP_CASCADES} DESTINATION ${OPENCV_OTHER_INSTALL_PATH}/lbpcascades COMPONENT libs) + + if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH) + install(DIRECTORY "${OPENCV_TEST_DATA_PATH}/" DESTINATION "${OPENCV_TEST_DATA_INSTALL_PATH}" COMPONENT "tests") diff --git a/ports/opencv3/0004-add-missing-stdexcept-include.patch b/ports/opencv3/0004-add-missing-stdexcept-include.patch index 4f0df7d066..2a7d90ce07 100644 --- a/ports/opencv3/0004-add-missing-stdexcept-include.patch +++ b/ports/opencv3/0004-add-missing-stdexcept-include.patch @@ -1,12 +1,12 @@ -diff --git a/modules/cvv/src/util/observer_ptr.hpp b/modules/cvv/src/util/observer_ptr.hpp -index fef3fea..68d1a80 100644 ---- a/modules/cvv/src/util/observer_ptr.hpp -+++ b/modules/cvv/src/util/observer_ptr.hpp -@@ -11,6 +11,7 @@ - #include //size_t - #include // [u]intXX_t - #include // since some people like to forget that one -+#include - - namespace cvv - { +diff --git a/modules/cvv/src/util/observer_ptr.hpp b/modules/cvv/src/util/observer_ptr.hpp +index fef3fea..68d1a80 100644 +--- a/modules/cvv/src/util/observer_ptr.hpp ++++ b/modules/cvv/src/util/observer_ptr.hpp +@@ -11,6 +11,7 @@ + #include //size_t + #include // [u]intXX_t + #include // since some people like to forget that one ++#include + + namespace cvv + { diff --git a/ports/opencv3/0005-fix-vtk9.patch b/ports/opencv3/0005-fix-vtk9.patch index 137302ee37..2dfdee8f65 100644 --- a/ports/opencv3/0005-fix-vtk9.patch +++ b/ports/opencv3/0005-fix-vtk9.patch @@ -1,5 +1,5 @@ diff --git a/cmake/OpenCVDetectVTK.cmake b/cmake/OpenCVDetectVTK.cmake -index 1495688..4c83504 100644 +index 1495688..e5c6049 100644 --- a/cmake/OpenCVDetectVTK.cmake +++ b/cmake/OpenCVDetectVTK.cmake @@ -1,12 +1,30 @@ diff --git a/ports/opencv3/0009-fix-uwp.patch b/ports/opencv3/0009-fix-uwp.patch index 73cac14531..9968d86917 100644 --- a/ports/opencv3/0009-fix-uwp.patch +++ b/ports/opencv3/0009-fix-uwp.patch @@ -1,5 +1,5 @@ diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake -index 634b5b2..07a96fb 100644 +index 10ee406..73f4af2 100644 --- a/cmake/OpenCVModule.cmake +++ b/cmake/OpenCVModule.cmake @@ -1183,7 +1183,7 @@ function(ocv_add_perf_tests) diff --git a/ports/opencv3/CONTROL b/ports/opencv3/CONTROL index 9067dab188..586c4337e4 100644 --- a/ports/opencv3/CONTROL +++ b/ports/opencv3/CONTROL @@ -1,6 +1,5 @@ Source: opencv3 -Version: 3.4.10 -Port-Version: 5 +Version: 3.4.12 Build-Depends: zlib Homepage: https://github.com/opencv/opencv Description: computer vision library diff --git a/ports/opencv3/portfile.cmake b/ports/opencv3/portfile.cmake index eff881a240..c65792bf00 100644 --- a/ports/opencv3/portfile.cmake +++ b/ports/opencv3/portfile.cmake @@ -6,13 +6,13 @@ if (EXISTS "${CURRENT_INSTALLED_DIR}/share/opencv4") message(FATAL_ERROR "OpenCV 4 is installed, please uninstall and try again:\n vcpkg remove opencv4") endif() -set(OPENCV_VERSION "3.4.10") +set(OPENCV_VERSION "3.4.12") vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO opencv/opencv REF ${OPENCV_VERSION} - SHA512 7ccdc7fef26436b2f643cce2a13c9f9f77e56d3fd0340117419df3c1665ca12416277b626cce3c056fdc14899805bbe9ece391f11d28c6adea716d47ce8894bc + SHA512 e69ff4869a8128b7d2a0537d198ec7f287fb821a8965df26339bec662da1888860941f50a269db7693309b9861f986c219288bb5856de76a6c7bc4c0a7026bee HEAD_REF master PATCHES 0001-disable-downloading.patch @@ -22,6 +22,16 @@ vcpkg_from_github( 0009-fix-uwp.patch ) +if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") + set(TARGET_IS_AARCH64 1) +elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") + set(TARGET_IS_ARM 1) +elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + set(TARGET_IS_X86_64 1) +else() + set(TARGET_IS_X86 1) +endif() + file(REMOVE "${SOURCE_PATH}/cmake/FindCUDNN.cmake") string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" BUILD_WITH_STATIC_CRT) @@ -101,7 +111,7 @@ if("contrib" IN_LIST FEATURES) OUT_SOURCE_PATH CONTRIB_SOURCE_PATH REPO opencv/opencv_contrib REF ${OPENCV_VERSION} - SHA512 70b4ecfaf9881390ad826a2aba24cced8514a680965ec7151df9926082fff53364bbe6be36458bb9ff466fda6f6f6ca2174eeac94c10a6bada989f07ed1c4da1 + SHA512 0191b1d49d5a50195ed94951c570da03dc33677b682e61a65b34d40f355c36a58441034730ea7eca78dcb4af4c821983754250f93fdf3adb2b4a20e71806eb03 HEAD_REF master PATCHES 0004-add-missing-stdexcept-include.patch @@ -242,6 +252,12 @@ vcpkg_configure_cmake( PREFER_NINJA SOURCE_PATH ${SOURCE_PATH} OPTIONS + ###### opencv cpu recognition is broken, always using host and not target: here we bypass that + -DOPENCV_SKIP_SYSTEM_PROCESSOR_DETECTION=TRUE + -DAARCH64=${TARGET_IS_AARCH64} + -DX86_64=${TARGET_IS_X86_64} + -DX86=${TARGET_IS_X86} + -DARM=${TARGET_IS_ARM} ###### ocv_options -DOpenCV_INSTALL_BINARIES_PREFIX= -DOPENCV_BIN_INSTALL_PATH=bin diff --git a/ports/opencv4/0002-install-options.patch b/ports/opencv4/0002-install-options.patch index 9707a6a323..533dd8354e 100644 --- a/ports/opencv4/0002-install-options.patch +++ b/ports/opencv4/0002-install-options.patch @@ -1,8 +1,8 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 4c0b388..16c0ede 100644 +index 4350b2f..89521b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -594,7 +594,7 @@ endif() +@@ -603,7 +603,7 @@ endif() ocv_cmake_hook(POST_CMAKE_BUILD_OPTIONS) # --- Python Support --- @@ -12,10 +12,10 @@ index 4c0b388..16c0ede 100644 endif() diff --git a/cmake/OpenCVCompilerOptions.cmake b/cmake/OpenCVCompilerOptions.cmake -index 87b2161..5192875 100644 +index 080c78c..616ce64 100644 --- a/cmake/OpenCVCompilerOptions.cmake +++ b/cmake/OpenCVCompilerOptions.cmake -@@ -263,7 +263,6 @@ if(MSVC) +@@ -265,7 +265,6 @@ if(MSVC) #endif() if(BUILD_WITH_DEBUG_INFO) @@ -24,10 +24,10 @@ index 87b2161..5192875 100644 set(OPENCV_EXTRA_SHARED_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_SHARED_LINKER_FLAGS_RELEASE} /debug") endif() diff --git a/cmake/OpenCVGenConfig.cmake b/cmake/OpenCVGenConfig.cmake -index 6991289..3a691c5 100644 +index 838852c..04906b3 100644 --- a/cmake/OpenCVGenConfig.cmake +++ b/cmake/OpenCVGenConfig.cmake -@@ -109,11 +109,11 @@ function(ocv_gen_config TMP_DIR NESTED_PATH ROOT_NAME) +@@ -114,11 +114,11 @@ function(ocv_gen_config TMP_DIR NESTED_PATH ROOT_NAME) endif() endfunction() @@ -41,7 +41,7 @@ index 6991289..3a691c5 100644 ocv_gen_config("${CMAKE_BINARY_DIR}/unix-install" "abi-${ANDROID_NDK_ABI_NAME}" "OpenCVConfig.root-ANDROID.cmake.in") install(FILES "${OpenCV_SOURCE_DIR}/platforms/android/android.toolchain.cmake" DESTINATION "${OPENCV_CONFIG_INSTALL_PATH}" COMPONENT dev) endif() -@@ -121,7 +121,7 @@ endif() +@@ -126,7 +126,7 @@ endif() # -------------------------------------------------------------------------------------------- # Part 3/3: ${BIN_DIR}/win-install/OpenCVConfig.cmake -> For use within binary installers/packages # -------------------------------------------------------------------------------------------- diff --git a/ports/opencv4/0003-force-package-requirements.patch b/ports/opencv4/0003-force-package-requirements.patch index b25668b383..c28dd5d9fe 100644 --- a/ports/opencv4/0003-force-package-requirements.patch +++ b/ports/opencv4/0003-force-package-requirements.patch @@ -1,5 +1,5 @@ diff --git a/cmake/OpenCVFindLibsGrfmt.cmake b/cmake/OpenCVFindLibsGrfmt.cmake -index 0beaf19..3ba1ebd 100644 +index 22e20b6..5d1431c 100644 --- a/cmake/OpenCVFindLibsGrfmt.cmake +++ b/cmake/OpenCVFindLibsGrfmt.cmake @@ -6,7 +6,7 @@ @@ -38,7 +38,7 @@ index 0beaf19..3ba1ebd 100644 if(WEBP_FOUND) set(HAVE_WEBP 1) endif() -@@ -173,7 +173,7 @@ if(WITH_JASPER AND NOT HAVE_OPENJPEG) +@@ -186,7 +186,7 @@ if(WITH_JASPER AND NOT HAVE_OPENJPEG) if(BUILD_JASPER) ocv_clear_vars(JASPER_FOUND) else() @@ -47,7 +47,7 @@ index 0beaf19..3ba1ebd 100644 endif() if(NOT JASPER_FOUND) -@@ -197,7 +197,7 @@ if(WITH_PNG) +@@ -210,7 +210,7 @@ if(WITH_PNG) if(BUILD_PNG) ocv_clear_vars(PNG_FOUND) else() @@ -56,7 +56,7 @@ index 0beaf19..3ba1ebd 100644 if(PNG_FOUND) include(CheckIncludeFile) check_include_file("${PNG_PNG_INCLUDE_DIR}/libpng/png.h" HAVE_LIBPNG_PNG_H) -@@ -228,7 +228,7 @@ endif() +@@ -241,7 +241,7 @@ endif() if(WITH_OPENEXR) ocv_clear_vars(HAVE_OPENEXR) if(NOT BUILD_OPENEXR) @@ -65,7 +65,7 @@ index 0beaf19..3ba1ebd 100644 endif() if(OPENEXR_FOUND) -@@ -246,7 +246,7 @@ endif() +@@ -259,7 +259,7 @@ endif() # --- GDAL (optional) --- if(WITH_GDAL) @@ -74,7 +74,7 @@ index 0beaf19..3ba1ebd 100644 if(NOT GDAL_FOUND) set(HAVE_GDAL NO) -@@ -258,7 +258,7 @@ if(WITH_GDAL) +@@ -271,7 +271,7 @@ if(WITH_GDAL) endif() if (WITH_GDCM) diff --git a/ports/opencv4/0004-fix-policy-CMP0057.patch b/ports/opencv4/0004-fix-policy-CMP0057.patch index 7f0f0c0271..8bff4f88b7 100644 --- a/ports/opencv4/0004-fix-policy-CMP0057.patch +++ b/ports/opencv4/0004-fix-policy-CMP0057.patch @@ -1,9 +1,9 @@ diff --git a/modules/videoio/CMakeLists.txt b/modules/videoio/CMakeLists.txt -index c1c6754..360aa6b 100644 +index 12ff992..afd56eb 100644 --- a/modules/videoio/CMakeLists.txt +++ b/modules/videoio/CMakeLists.txt @@ -1,3 +1,4 @@ +cmake_minimum_required(VERSION 3.3) - set(VIDEOIO_PLUGIN_LIST "" CACHE STRING "List of videoio backends to be compiled as plugins (ffmpeg, gstreamer)") + set(VIDEOIO_PLUGIN_LIST "" CACHE STRING "List of videoio backends to be compiled as plugins (ffmpeg, gstreamer, mfx, msmf or special value 'all')") set(VIDEOIO_ENABLE_PLUGINS "ON" CACHE BOOL "Allow building videoio plugin support") set(VIDEOIO_ENABLE_STRICT_PLUGIN_CHECK "ON" CACHE BOOL "Make sure OpenCV version is the same in plugin and host code") diff --git a/ports/opencv4/0005-add-missing-stdexcept-include.patch b/ports/opencv4/0005-add-missing-stdexcept-include.patch index 4f0df7d066..2a7d90ce07 100644 --- a/ports/opencv4/0005-add-missing-stdexcept-include.patch +++ b/ports/opencv4/0005-add-missing-stdexcept-include.patch @@ -1,12 +1,12 @@ -diff --git a/modules/cvv/src/util/observer_ptr.hpp b/modules/cvv/src/util/observer_ptr.hpp -index fef3fea..68d1a80 100644 ---- a/modules/cvv/src/util/observer_ptr.hpp -+++ b/modules/cvv/src/util/observer_ptr.hpp -@@ -11,6 +11,7 @@ - #include //size_t - #include // [u]intXX_t - #include // since some people like to forget that one -+#include - - namespace cvv - { +diff --git a/modules/cvv/src/util/observer_ptr.hpp b/modules/cvv/src/util/observer_ptr.hpp +index fef3fea..68d1a80 100644 +--- a/modules/cvv/src/util/observer_ptr.hpp ++++ b/modules/cvv/src/util/observer_ptr.hpp +@@ -11,6 +11,7 @@ + #include //size_t + #include // [u]intXX_t + #include // since some people like to forget that one ++#include + + namespace cvv + { diff --git a/ports/opencv4/0006-fix-glog-abbreviated-severity.patch b/ports/opencv4/0006-fix-glog-abbreviated-severity.patch new file mode 100644 index 0000000000..aafe61b1a5 --- /dev/null +++ b/ports/opencv4/0006-fix-glog-abbreviated-severity.patch @@ -0,0 +1,12 @@ +diff --git a/modules/sfm/CMakeLists.txt b/modules/sfm/CMakeLists.txt +index 53a8d43..8809c88 100644 +--- a/modules/sfm/CMakeLists.txt ++++ b/modules/sfm/CMakeLists.txt +@@ -20,6 +20,7 @@ if((gflags_FOUND OR GFLAGS_FOUND OR GFLAGS_INCLUDE_DIRS) AND (glog_FOUND OR GLOG + ) + file(REMOVE "${_fname}") + message(STATUS "Checking SFM deps... ${SFM_DEPS_OK}") ++ add_definitions(-DGLOG_NO_ABBREVIATED_SEVERITIES) + else() + set(SFM_DEPS_OK FALSE) + endif() diff --git a/ports/opencv4/0006-jpeg2000_getref.patch b/ports/opencv4/0006-jpeg2000_getref.patch deleted file mode 100644 index 7b0fc09c0c..0000000000 --- a/ports/opencv4/0006-jpeg2000_getref.patch +++ /dev/null @@ -1,33 +0,0 @@ -diff --git a/modules/imgcodecs/src/grfmt_jpeg2000.cpp b/modules/imgcodecs/src/grfmt_jpeg2000.cpp ---- a/modules/imgcodecs/src/grfmt_jpeg2000.cpp -+++ b/modules/imgcodecs/src/grfmt_jpeg2000.cpp -@@ -375,13 +375,13 @@ - int lshift = MAX(0, -rshift); - rshift = MAX(0, rshift); - int delta = (rshift > 0 ? 1 << (rshift - 1) : 0) + offset; - - for( y = 0; y < yend - ystart; ) - { -- jas_seqent_t* pix_row = &jas_matrix_get( buffer, y / ystep, 0 ); -+ jas_seqent_t* pix_row = jas_matrix_getref( buffer, y / ystep, 0 ); - uchar* dst = data + (y - yoffset) * step - xoffset; - - if( xstep == 1 ) - { - if( maxval == 256 && offset == 0 ) - for( x = 0; x < xend - xstart; x++ ) -@@ -441,13 +441,13 @@ - int lshift = MAX(0, -rshift); - rshift = MAX(0, rshift); - int delta = (rshift > 0 ? 1 << (rshift - 1) : 0) + offset; - - for( y = 0; y < yend - ystart; ) - { -- jas_seqent_t* pix_row = &jas_matrix_get( buffer, y / ystep, 0 ); -+ jas_seqent_t* pix_row = jas_matrix_getref( buffer, y / ystep, 0 ); - ushort* dst = data + (y - yoffset) * step - xoffset; - - if( xstep == 1 ) - { - if( maxval == 65536 && offset == 0 ) - for( x = 0; x < xend - xstart; x++ ) diff --git a/ports/opencv4/0007-fix-vtk9-contrib.patch b/ports/opencv4/0007-fix-vtk9-contrib.patch deleted file mode 100644 index 1db18f1c64..0000000000 --- a/ports/opencv4/0007-fix-vtk9-contrib.patch +++ /dev/null @@ -1,470 +0,0 @@ -diff --git a/modules/viz/CMakeLists.txt b/modules/viz/CMakeLists.txt -index 89a9c3e098..3426e1dd26 100644 ---- a/modules/viz/CMakeLists.txt -+++ b/modules/viz/CMakeLists.txt -@@ -3,7 +3,9 @@ if(NOT HAVE_VTK) - endif() - - set(the_description "Viz") --include(${VTK_USE_FILE}) -+if(VTK_VERSION VERSION_LESS 8.90) -+ include(${VTK_USE_FILE}) -+endif() - - if(NOT BUILD_SHARED_LIBS) - # We observed conflict between builtin 3rdparty libraries and -diff --git a/modules/viz/src/precomp.hpp b/modules/viz/src/precomp.hpp -index f92fdb6ac2..4c4bf7c599 100644 ---- a/modules/viz/src/precomp.hpp -+++ b/modules/viz/src/precomp.hpp -@@ -133,7 +133,8 @@ - #include - #include - #include --#include "vtkCallbackCommand.h" -+#include -+#include - - #if !defined(_WIN32) || defined(__CYGWIN__) - # include /* unlink */ -@@ -149,6 +150,11 @@ - #include "vtk/vtkTrajectorySource.h" - #include "vtk/vtkImageMatSource.h" - -+#if VTK_MAJOR_VERSION >= 9 -+typedef vtkIdType const * CellIterT; -+#else -+typedef vtkIdType * CellIterT; -+#endif - - #include - #include -diff --git a/modules/viz/src/types.cpp b/modules/viz/src/types.cpp -index 65571a192e..0e14477891 100644 ---- a/modules/viz/src/types.cpp -+++ b/modules/viz/src/types.cpp -@@ -100,7 +100,8 @@ cv::viz::Mesh cv::viz::Mesh::load(const String& file, int type) - int* poly_ptr = mesh.polygons.ptr(); - - polygons->InitTraversal(); -- vtkIdType nr_cell_points, *cell_points; -+ vtkIdType nr_cell_points; -+ CellIterT cell_points; - while (polygons->GetNextCell(nr_cell_points, cell_points)) - { - *poly_ptr++ = nr_cell_points; -diff --git a/modules/viz/src/vizimpl.cpp b/modules/viz/src/vizimpl.cpp -index 2c291c0569..2c7ce997a4 100644 ---- a/modules/viz/src/vizimpl.cpp -+++ b/modules/viz/src/vizimpl.cpp -@@ -55,8 +55,17 @@ cv::viz::Viz3d::VizImpl::VizImpl(const String &name) : spin_once_state_(false), - - // Create render window - window_ = vtkSmartPointer::New(); -- cv::Vec2i window_size = cv::Vec2i(window_->GetScreenSize()) / 2; -- window_->SetSize(window_size.val); -+ int * sz = window_->GetScreenSize(); -+ if (sz) -+ { -+ cv::Vec2i window_size = cv::Vec2i(sz) / 2; -+ window_->SetSize(window_size.val); -+ } -+ else -+ { -+ int new_sz[2] = { 640, 480 }; -+ window_->SetSize(new_sz); -+ } - window_->AddRenderer(renderer_); - - // Create the interactor style -diff --git a/modules/viz/src/vtk/vtkOBJWriter.cpp b/modules/viz/src/vtk/vtkOBJWriter.cpp -index 296b6eb065..2e5764fc27 100644 ---- a/modules/viz/src/vtk/vtkOBJWriter.cpp -+++ b/modules/viz/src/vtk/vtkOBJWriter.cpp -@@ -72,7 +72,7 @@ void cv::viz::vtkOBJWriter::WriteData() - } - - vtkDebugMacro(<<"Opening vtk file for writing..."); -- ostream *outfilep = new ofstream(this->FileName, ios::out); -+ std::ostream *outfilep = new std::ofstream(this->FileName, ios::out); - if (outfilep->fail()) - { - vtkErrorMacro(<< "Unable to open file: "<< this->FileName); -@@ -127,7 +127,8 @@ void cv::viz::vtkOBJWriter::WriteData() - // write out verts if any - if (input->GetNumberOfVerts() > 0) - { -- vtkIdType npts = 0, *index = 0; -+ vtkIdType npts = 0; -+ CellIterT index = 0; - vtkCellArray *cells = input->GetVerts(); - for (cells->InitTraversal(); cells->GetNextCell(npts, index); ) - { -@@ -141,7 +142,8 @@ void cv::viz::vtkOBJWriter::WriteData() - // write out lines if any - if (input->GetNumberOfLines() > 0) - { -- vtkIdType npts = 0, *index = 0; -+ vtkIdType npts = 0; -+ CellIterT index = 0; - vtkCellArray *cells = input->GetLines(); - for (cells->InitTraversal(); cells->GetNextCell(npts, index); ) - { -@@ -162,7 +164,8 @@ void cv::viz::vtkOBJWriter::WriteData() - // write out polys if any - if (input->GetNumberOfPolys() > 0) - { -- vtkIdType npts = 0, *index = 0; -+ vtkIdType npts = 0; -+ CellIterT index = 0; - vtkCellArray *cells = input->GetPolys(); - for (cells->InitTraversal(); cells->GetNextCell(npts, index); ) - { -@@ -191,7 +194,8 @@ void cv::viz::vtkOBJWriter::WriteData() - // write out tstrips if any - if (input->GetNumberOfStrips() > 0) - { -- vtkIdType npts = 0, *index = 0; -+ vtkIdType npts = 0; -+ CellIterT index = 0; - vtkCellArray *cells = input->GetStrips(); - for (cells->InitTraversal(); cells->GetNextCell(npts, index); ) - { -diff --git a/modules/viz/src/vtk/vtkXYZReader.cpp b/modules/viz/src/vtk/vtkXYZReader.cpp -index 57726eae9b..3b9265fed6 100644 ---- a/modules/viz/src/vtk/vtkXYZReader.cpp -+++ b/modules/viz/src/vtk/vtkXYZReader.cpp -@@ -77,7 +77,7 @@ int cv::viz::vtkXYZReader::RequestData(vtkInformation*, vtkInformationVector**, - } - - // Open the input file. -- ifstream fin(this->FileName); -+ std::ifstream fin(this->FileName); - if(!fin) - { - vtkErrorMacro("Error opening file " << this->FileName); -diff --git a/modules/viz/src/vtk/vtkXYZWriter.cpp b/modules/viz/src/vtk/vtkXYZWriter.cpp -index cf95e3c6a0..56a26b38a0 100644 ---- a/modules/viz/src/vtk/vtkXYZWriter.cpp -+++ b/modules/viz/src/vtk/vtkXYZWriter.cpp -@@ -69,7 +69,7 @@ void cv::viz::vtkXYZWriter::WriteData() - } - - vtkDebugMacro(<<"Opening vtk file for writing..."); -- ostream *outfilep = new ofstream(this->FileName, ios::out); -+ std::ostream *outfilep = new std::ofstream(this->FileName, ios::out); - if (outfilep->fail()) - { - vtkErrorMacro(<< "Unable to open file: "<< this->FileName); - -diff --git a/modules/viz/test/test_tutorial2.cpp b/modules/viz/test/test_tutorial2.cpp -index 6b2972f0af..a4b5b99582 100644 ---- a/modules/viz/test/test_tutorial2.cpp -+++ b/modules/viz/test/test_tutorial2.cpp -@@ -28,7 +28,7 @@ static void tutorial2() - /// Rodrigues vector - Vec3d rot_vec = Vec3d::all(0); - double translation_phase = 0.0, translation = 0.0; -- while(!myWindow.wasStopped()) -+ for(unsigned num = 0; num < 50; ++num) - { - /* Rotation using rodrigues */ - /// Rotate around (1,1,1) -@@ -45,7 +45,7 @@ static void tutorial2() - - myWindow.setWidgetPose("Cube Widget", pose); - -- myWindow.spinOnce(1, true); -+ myWindow.spinOnce(100, true); - } - } - -diff --git a/modules/viz/test/test_tutorial3.cpp b/modules/viz/test/test_tutorial3.cpp -index 232130f0a6..32e33b1902 100644 ---- a/modules/viz/test/test_tutorial3.cpp -+++ b/modules/viz/test/test_tutorial3.cpp -@@ -48,7 +48,7 @@ static void tutorial3(bool camera_pov) - myWindow.setViewerPose(camera_pose); - - /// Start event loop. -- myWindow.spin(); -+ myWindow.spinOnce(500, true); - } - - TEST(Viz, tutorial3_global_view) -diff --git a/modules/viz/test/test_viz3d.cpp b/modules/viz/test/test_viz3d.cpp -index cdf8a00ad7..4ab05c3e0a 100644 ---- a/modules/viz/test/test_viz3d.cpp -+++ b/modules/viz/test/test_viz3d.cpp -@@ -59,7 +59,7 @@ TEST(Viz_viz3d, DISABLED_develop) - //cv::Mat cloud = cv::viz::readCloud(get_dragon_ply_file_path()); - //---->>>>> - -- viz.spin(); -+ viz.spinOnce(500, true); - } - - }} // namespace -diff --git a/modules/viz/test/tests_simple.cpp b/modules/viz/test/tests_simple.cpp -index 12d696dfba..5584483f4f 100644 ---- a/modules/viz/test/tests_simple.cpp -+++ b/modules/viz/test/tests_simple.cpp -@@ -56,7 +56,7 @@ TEST(Viz, show_cloud_bluberry) - viz.showWidget("dragon", WCloud(dragon_cloud, Color::bluberry()), pose); - - viz.showWidget("text2d", WText("Bluberry cloud", Point(20, 20), 20, Color::green())); -- viz.spin(); -+ viz.spinOnce(500, true); - } - - TEST(Viz, show_cloud_random_color) -@@ -73,7 +73,7 @@ TEST(Viz, show_cloud_random_color) - viz.showWidget("coosys", WCoordinateSystem()); - viz.showWidget("dragon", WCloud(dragon_cloud, colors), pose); - viz.showWidget("text2d", WText("Random color cloud", Point(20, 20), 20, Color::green())); -- viz.spin(); -+ viz.spinOnce(500, true); - } - - TEST(Viz, show_cloud_masked) -@@ -91,7 +91,7 @@ TEST(Viz, show_cloud_masked) - viz.showWidget("coosys", WCoordinateSystem()); - viz.showWidget("dragon", WCloud(dragon_cloud), pose); - viz.showWidget("text2d", WText("Nan masked cloud", Point(20, 20), 20, Color::green())); -- viz.spin(); -+ viz.spinOnce(500, true); - } - - TEST(Viz, show_cloud_collection) -@@ -109,7 +109,7 @@ TEST(Viz, show_cloud_collection) - viz.showWidget("coosys", WCoordinateSystem()); - viz.showWidget("ccol", ccol); - viz.showWidget("text2d", WText("Cloud collection", Point(20, 20), 20, Color::green())); -- viz.spin(); -+ viz.spinOnce(500, true); - } - - TEST(Viz, show_painted_clouds) -@@ -124,7 +124,7 @@ TEST(Viz, show_painted_clouds) - viz.showWidget("cloud3", WPaintedCloud(cloud, Vec3d(0.0, 0.0, -1.0), Vec3d(0.0, 0.0, 1.0), Color::blue(), Color::red())); - viz.showWidget("arrow", WArrow(Vec3d(0.0, 1.0, -1.0), Vec3d(0.0, 1.0, 1.0), 0.009, Color::raspberry())); - viz.showWidget("text2d", WText("Painted clouds", Point(20, 20), 20, Color::green())); -- viz.spin(); -+ viz.spinOnce(500, true); - } - - TEST(Viz, show_mesh) -@@ -137,7 +137,7 @@ TEST(Viz, show_mesh) - viz.showWidget("coosys", WCoordinateSystem()); - viz.showWidget("mesh", WMesh(mesh), pose); - viz.showWidget("text2d", WText("Just mesh", Point(20, 20), 20, Color::green())); -- viz.spin(); -+ viz.spinOnce(500, true); - } - - TEST(Viz, show_mesh_random_colors) -@@ -152,7 +152,7 @@ TEST(Viz, show_mesh_random_colors) - viz.showWidget("mesh", WMesh(mesh), pose); - viz.setRenderingProperty("mesh", SHADING, SHADING_PHONG); - viz.showWidget("text2d", WText("Random color mesh", Point(20, 20), 20, Color::green())); -- viz.spin(); -+ viz.spinOnce(500, true); - } - - TEST(Viz, show_widget_merger) -@@ -173,7 +173,7 @@ TEST(Viz, show_widget_merger) - viz.showWidget("coo", WCoordinateSystem()); - viz.showWidget("merger", merger); - viz.showWidget("text2d", WText("Widget merger", Point(20, 20), 20, Color::green())); -- viz.spin(); -+ viz.spinOnce(500, true); - } - - TEST(Viz, show_textured_mesh) -@@ -210,7 +210,7 @@ TEST(Viz, show_textured_mesh) - viz.showWidget("mesh", WMesh(mesh)); - viz.setRenderingProperty("mesh", SHADING, SHADING_PHONG); - viz.showWidget("text2d", WText("Textured mesh", Point(20, 20), 20, Color::green())); -- viz.spin(); -+ viz.spinOnce(500, true); - } - - TEST(Viz, show_polyline) -@@ -229,7 +229,7 @@ TEST(Viz, show_polyline) - viz.showWidget("polyline", WPolyLine(polyline, colors)); - viz.showWidget("coosys", WCoordinateSystem()); - viz.showWidget("text2d", WText("Polyline", Point(20, 20), 20, Color::green())); -- viz.spin(); -+ viz.spinOnce(500, true); - } - - TEST(Viz, show_sampled_normals) -@@ -244,7 +244,7 @@ TEST(Viz, show_sampled_normals) - viz.showWidget("normals", WCloudNormals(mesh.cloud, mesh.normals, 30, 0.1f, Color::green()), pose); - viz.setRenderingProperty("normals", LINE_WIDTH, 2.0); - viz.showWidget("text2d", WText("Cloud or mesh normals", Point(20, 20), 20, Color::green())); -- viz.spin(); -+ viz.spinOnce(500, true); - } - - TEST(Viz, show_cloud_shaded_by_normals) -@@ -260,7 +260,7 @@ TEST(Viz, show_cloud_shaded_by_normals) - Viz3d viz("show_cloud_shaded_by_normals"); - viz.showWidget("cloud", cloud, pose); - viz.showWidget("text2d", WText("Cloud shaded by normals", Point(20, 20), 20, Color::green())); -- viz.spin(); -+ viz.spinOnce(500, true); - } - - TEST(Viz, show_trajectories) -@@ -287,15 +287,15 @@ TEST(Viz, show_trajectories) - viz.showWidget("text2d", WText("Different kinds of supported trajectories", Point(20, 20), 20, Color::green())); - - int i = 0; -- while(!viz.wasStopped()) -+ for(unsigned num = 0; num < 50; ++num) - { - double a = --i % 360; - Vec3d pose(sin(a * CV_PI/180), 0.7, cos(a * CV_PI/180)); - viz.setViewerPose(makeCameraPose(pose * 7.5, Vec3d(0.0, 0.5, 0.0), Vec3d(0.0, 0.1, 0.0))); -- viz.spinOnce(20, true); -+ viz.spinOnce(100, true); - } - viz.resetCamera(); -- viz.spin(); -+ viz.spinOnce(500, true); - } - - TEST(Viz, show_trajectory_reposition) -@@ -306,7 +306,7 @@ TEST(Viz, show_trajectory_reposition) - viz.showWidget("coos", WCoordinateSystem()); - viz.showWidget("sub3", WTrajectory(Mat(path).rowRange(0, (int)path.size()/3), WTrajectory::BOTH, 0.2, Color::brown()), path.front().inv()); - viz.showWidget("text2d", WText("Trajectory resposition to origin", Point(20, 20), 20, Color::green())); -- viz.spin(); -+ viz.spinOnce(500, true); - } - - TEST(Viz, show_camera_positions) -@@ -330,7 +330,7 @@ TEST(Viz, show_camera_positions) - viz.showWidget("pos3", WCameraPosition(0.75), poses[1]); - viz.showWidget("pos4", WCameraPosition(K, gray, 3, Color::indigo()), poses[1]); - viz.showWidget("text2d", WText("Camera positions with images", Point(20, 20), 20, Color::green())); -- viz.spin(); -+ viz.spinOnce(500, true); - } - - TEST(Viz, show_overlay_image) -@@ -353,16 +353,16 @@ TEST(Viz, show_overlay_image) - viz.showWidget("text2d", WText("Overlay images", Point(20, 20), 20, Color::green())); - - int i = 0; -- while(!viz.wasStopped()) -+ for(unsigned num = 0; num < 50; ++num) - { - double a = ++i % 360; - Vec3d pose(sin(a * CV_PI/180), 0.7, cos(a * CV_PI/180)); - viz.setViewerPose(makeCameraPose(pose * 3, Vec3d(0.0, 0.5, 0.0), Vec3d(0.0, 0.1, 0.0))); - viz.getWidget("img1").cast().setImage(lena * pow(sin(i*10*CV_PI/180) * 0.5 + 0.5, 1.0)); -- viz.spinOnce(1, true); -+ viz.spinOnce(100, true); - } - viz.showWidget("text2d", WText("Overlay images (stopped)", Point(20, 20), 20, Color::green())); -- viz.spin(); -+ viz.spinOnce(500, true); - } - - -@@ -376,7 +376,7 @@ TEST(Viz, show_image_method) - viz.showImage(lena, lena.size()); - viz.spinOnce(1500, true); - -- cv::viz::imshow("show_image_method", make_gray(lena)).spin(); -+ cv::viz::imshow("show_image_method", make_gray(lena)).spinOnce(500, true); - } - - TEST(Viz, show_image_3d) -@@ -398,13 +398,13 @@ TEST(Viz, show_image_3d) - viz.showWidget("text2d", WText("Images in 3D", Point(20, 20), 20, Color::green())); - - int i = 0; -- while(!viz.wasStopped()) -+ for(unsigned num = 0; num < 50; ++num) - { - viz.getWidget("img0").cast().setImage(lena * pow(sin(i++*7.5*CV_PI/180) * 0.5 + 0.5, 1.0)); -- viz.spinOnce(1, true); -+ viz.spinOnce(100, true); - } - viz.showWidget("text2d", WText("Images in 3D (stopped)", Point(20, 20), 20, Color::green())); -- viz.spin(); -+ viz.spinOnce(500, true); - } - - TEST(Viz, show_simple_widgets) -@@ -431,10 +431,10 @@ TEST(Viz, show_simple_widgets) - - viz.showWidget("grid1", WGrid(Vec2i(7,7), Vec2d::all(0.75), Color::gray()), Affine3d().translate(Vec3d(0.0, 0.0, -1.0))); - -- viz.spin(); -+ viz.spinOnce(500, true); - viz.getWidget("text2d").cast().setText("Different simple widgets (updated)"); - viz.getWidget("text3d").cast().setText("Updated text 3D"); -- viz.spin(); -+ viz.spinOnce(500, true); - } - - TEST(Viz, show_follower) -@@ -446,9 +446,9 @@ TEST(Viz, show_follower) - viz.showWidget("t3d_2", WText3D("Simple 3D follower", Point3d(-0.5, -0.5, 0.5), 0.125, true, Color::green())); - viz.showWidget("text2d", WText("Follower: text always facing camera", Point(20, 20), 20, Color::green())); - viz.setBackgroundMeshLab(); -- viz.spin(); -+ viz.spinOnce(500, true); - viz.getWidget("t3d_2").cast().setText("Updated follower 3D"); -- viz.spin(); -+ viz.spinOnce(500, true); - } - - }} // namespace - -diff --git a/modules/viz/CMakeLists.txt b/modules/viz/CMakeLists.txt -index 3426e1dd26..cd225960ce 100644 ---- a/modules/viz/CMakeLists.txt -+++ b/modules/viz/CMakeLists.txt -@@ -3,9 +3,6 @@ if(NOT HAVE_VTK) - endif() - - set(the_description "Viz") --if(VTK_VERSION VERSION_LESS 8.90) -- include(${VTK_USE_FILE}) --endif() - - if(NOT BUILD_SHARED_LIBS) - # We observed conflict between builtin 3rdparty libraries and -@@ -37,7 +34,14 @@ ocv_add_accuracy_tests() - ocv_add_perf_tests() - ocv_add_samples(opencv_imgproc opencv_calib3d opencv_features2d opencv_flann) - --ocv_target_link_libraries(${the_module} PRIVATE ${VTK_LIBRARIES}) -+ -+if (VTK_VERSION VERSION_LESS "8.90.0") -+ include(${VTK_USE_FILE}) -+ ocv_target_link_libraries(${the_module} PRIVATE ${VTK_LIBRARIES}) -+else () -+ ocv_target_link_libraries(${the_module} PRIVATE ${VTK_LIBRARIES}) -+ vtk_module_autoinit(TARGETS ${the_module} MODULES ${VTK_LIBRARIES}) -+endif() - - if(APPLE AND BUILD_opencv_viz) - ocv_target_link_libraries(${the_module} PRIVATE "-framework Cocoa") -diff --git a/modules/viz/src/types.cpp b/modules/viz/src/types.cpp -index 0e14477891..e9a470cf83 100644 ---- a/modules/viz/src/types.cpp -+++ b/modules/viz/src/types.cpp -@@ -97,6 +97,7 @@ cv::viz::Mesh cv::viz::Mesh::load(const String& file, int type) - // Now handle the polygons - vtkSmartPointer polygons = polydata->GetPolys(); - mesh.polygons.create(1, polygons->GetSize(), CV_32SC1); -+ mesh.polygons = 0; - int* poly_ptr = mesh.polygons.ptr(); - - polygons->InitTraversal(); diff --git a/ports/opencv4/0008-fix-vtk9.patch b/ports/opencv4/0008-fix-vtk9.patch deleted file mode 100644 index 7942b0aa4d..0000000000 --- a/ports/opencv4/0008-fix-vtk9.patch +++ /dev/null @@ -1,41 +0,0 @@ -diff --git a/cmake/OpenCVDetectVTK.cmake b/cmake/OpenCVDetectVTK.cmake -index 0f2b958..4c83504 100644 ---- a/cmake/OpenCVDetectVTK.cmake -+++ b/cmake/OpenCVDetectVTK.cmake -@@ -1,12 +1,30 @@ -+# VTK 9.0 -+if(NOT VTK_FOUND) -+ find_package(VTK 9 QUIET NAMES vtk COMPONENTS -+ FiltersExtraction -+ FiltersSources -+ FiltersTexture -+ IOExport -+ IOGeometry -+ IOPLY -+ InteractionStyle -+ RenderingCore -+ RenderingLOD -+ RenderingOpenGL2 -+ NO_MODULE) -+endif() -+ - # VTK 6.x components --find_package(VTK QUIET COMPONENTS vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport NO_MODULE) --IF(VTK_FOUND) -- IF(VTK_RENDERING_BACKEND) #in vtk 7, the rendering backend is exported as a var. -+if(NOT VTK_FOUND) -+ find_package(VTK QUIET COMPONENTS vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport NO_MODULE) -+ IF(VTK_FOUND) -+ IF(VTK_RENDERING_BACKEND) #in vtk 7, the rendering backend is exported as a var. - find_package(VTK QUIET COMPONENTS vtkRendering${VTK_RENDERING_BACKEND} vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport vtkIOGeometry NO_MODULE) -- ELSE(VTK_RENDERING_BACKEND) -+ ELSE(VTK_RENDERING_BACKEND) - find_package(VTK QUIET COMPONENTS vtkRenderingOpenGL vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport NO_MODULE) -- ENDIF(VTK_RENDERING_BACKEND) --ENDIF(VTK_FOUND) -+ ENDIF(VTK_RENDERING_BACKEND) -+ ENDIF(VTK_FOUND) -+endif() - - # VTK 5.x components - if(NOT VTK_FOUND) diff --git a/ports/opencv4/0009-fix-uwp.patch b/ports/opencv4/0009-fix-uwp.patch index 1c40cf1e17..9ace8e2147 100644 --- a/ports/opencv4/0009-fix-uwp.patch +++ b/ports/opencv4/0009-fix-uwp.patch @@ -1,8 +1,8 @@ diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake -index 9053957..d2b6412 100644 +index bd14aa2..58cd11e 100644 --- a/cmake/OpenCVModule.cmake +++ b/cmake/OpenCVModule.cmake -@@ -1196,7 +1196,7 @@ function(ocv_add_perf_tests) +@@ -1197,7 +1197,7 @@ function(ocv_add_perf_tests) set_target_properties(${the_target} PROPERTIES FOLDER "tests performance") endif() diff --git a/ports/opencv4/CONTROL b/ports/opencv4/CONTROL index baebc1c59c..5de96cd0be 100644 --- a/ports/opencv4/CONTROL +++ b/ports/opencv4/CONTROL @@ -1,6 +1,5 @@ Source: opencv4 -Version: 4.3.0 -Port-Version: 5 +Version: 4.5.0 Build-Depends: zlib Homepage: https://github.com/opencv/opencv Description: computer vision library diff --git a/ports/opencv4/portfile.cmake b/ports/opencv4/portfile.cmake index 007ce8a26d..21f6e22786 100644 --- a/ports/opencv4/portfile.cmake +++ b/ports/opencv4/portfile.cmake @@ -6,25 +6,33 @@ if (EXISTS "${CURRENT_INSTALLED_DIR}/share/opencv3") message(FATAL_ERROR "OpenCV 3 is installed, please uninstall and try again:\n vcpkg remove opencv3") endif() -set(OPENCV_VERSION "4.3.0") +set(OPENCV_VERSION "4.5.0") vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO opencv/opencv REF ${OPENCV_VERSION} - SHA512 ac22b41fffa3e3138701fa0df0d19900b3ce72e168f4478ecdc593c5c9fd004b4b1b26612d62c25b681db99a8720db7a11b5b224e576e595624965fa79b0f383 + SHA512 c34100f3f3fe45f2115975350d23288a3badb32864ba0cbd32512387416d1cf10d16d3ef5f3d089d6a1c2be587d788d33997513fc015dbf7d774a622f2d3811f HEAD_REF master PATCHES 0001-disable-downloading.patch 0002-install-options.patch 0003-force-package-requirements.patch 0004-fix-policy-CMP0057.patch - 0006-jpeg2000_getref.patch - 0008-fix-vtk9.patch 0009-fix-uwp.patch 0010-fix-interface_link_libraries.patch # Remove this patch when the next update ) +if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") + set(TARGET_IS_AARCH64 1) +elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") + set(TARGET_IS_ARM 1) +elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + set(TARGET_IS_X86_64 1) +else() + set(TARGET_IS_X86 1) +endif() + file(REMOVE "${SOURCE_PATH}/cmake/FindCUDNN.cmake") string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" BUILD_WITH_STATIC_CRT) @@ -66,13 +74,6 @@ if("dnn" IN_LIST FEATURES) endif() endif() -#OpenCV on arm on windows platform (non UWP) has serious problems right now. Disabling this module is not enough (remember to put the definition in vcpkg_configure_cmake) -#set(BUILD_opencv_surface_matching ON) -#if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm") -# set(BUILD_opencv_surface_matching OFF) -# message(WARNING "The surface_matching module cannot be enabled on ARM architectures") -#endif() - set(BUILD_opencv_gapi ON) if(VCPKG_TARGET_IS_UWP) set(BUILD_opencv_gapi OFF) @@ -135,11 +136,11 @@ if("contrib" IN_LIST FEATURES) OUT_SOURCE_PATH CONTRIB_SOURCE_PATH REPO opencv/opencv_contrib REF ${OPENCV_VERSION} - SHA512 cfeda06a9f86ccaedbca9521c35bf685c3d8d3a182fb943f9378a7ecd1949d6e2e9df1673f0e3e9686840ca4c9e5a8e8cf2ac962a33b6e1f88f8278abd8c37e5 + SHA512 b2ae72e920c78472fd677281b8dd6f25872399d8ade97b0d3b0fc50bbabea8c00ea849d87bfb311ac148cef663481d0c89c0f6875578c052c1cc7ddcd70e6e17 HEAD_REF master PATCHES 0005-add-missing-stdexcept-include.patch - 0007-fix-vtk9-contrib.patch + 0006-fix-glog-abbreviated-severity.patch ) set(BUILD_WITH_CONTRIB_FLAG "-DOPENCV_EXTRA_MODULES_PATH=${CONTRIB_SOURCE_PATH}/modules") @@ -289,6 +290,12 @@ vcpkg_configure_cmake( PREFER_NINJA SOURCE_PATH ${SOURCE_PATH} OPTIONS + ###### opencv cpu recognition is broken, always using host and not target: here we bypass that + -DOPENCV_SKIP_SYSTEM_PROCESSOR_DETECTION=TRUE + -DAARCH64=${TARGET_IS_AARCH64} + -DX86_64=${TARGET_IS_X86_64} + -DX86=${TARGET_IS_X86} + -DARM=${TARGET_IS_ARM} ###### ocv_options -DOpenCV_INSTALL_BINARIES_PREFIX= -DOPENCV_BIN_INSTALL_PATH=bin @@ -351,13 +358,15 @@ vcpkg_configure_cmake( ###### customized properties ## Options from vcpkg_check_features() ${FEATURE_OPTIONS} - -DHALIDE_ROOT_DIR=${CURRENT_INSTALLED_DIR} -DCMAKE_DISABLE_FIND_PACKAGE_Halide=ON + -DHALIDE_ROOT_DIR=${CURRENT_INSTALLED_DIR} -DWITH_GTK=OFF -DWITH_IPP=${WITH_IPP} + -DWITH_MATLAB=OFF -DWITH_MSMF=${WITH_MSMF} -DWITH_OPENMP=${WITH_OPENMP} -DWITH_PROTOBUF=${BUILD_opencv_dnn} + -DWITH_OPENCLAMDBLAS=OFF -DWITH_TBB=${WITH_TBB} -DWITH_OPENJPEG=OFF ###### BUILD_options (mainly modules which require additional libraries) @@ -421,12 +430,12 @@ find_dependency(Tesseract)") if("eigen" IN_LIST FEATURES) string(APPEND DEPS_STRING "\nfind_dependency(Eigen3 CONFIG)") endif() - if("openexr" IN_LIST FEATURES) - string(APPEND DEPS_STRING "\nfind_dependency(OpenEXR CONFIG)") - endif() if("lapack" IN_LIST FEATURES) string(APPEND DEPS_STRING "\nfind_dependency(LAPACK)") endif() + if("openexr" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(OpenEXR CONFIG)") + endif() if(WITH_OPENMP) string(APPEND DEPS_STRING "\nfind_dependency(OpenMP)") endif() @@ -464,6 +473,7 @@ find_dependency(Qt5 COMPONENTS OpenGL Concurrent Test)") file(WRITE ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake "${OPENCV_MODULES}") + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) endif() diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index f4d376c7b3..a44f6881ea 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -366,7 +366,7 @@ gdal:x64-windows-static-md=fail geos:arm-uwp=fail geos:x64-uwp=fail -# Port geotrans source ftp://ftp.nga.mil server +# Port geotrans source ftp://ftp.nga.mil server # extremely slow may take several hours to download geotrans:x64-linux = skip geotrans:x64-windows = skip @@ -893,9 +893,9 @@ memorymodule:arm-uwp=fail memorymodule:x64-linux=fail memorymodule:x64-osx=fail memorymodule:x64-uwp=fail -# Due to static crt. +# Due to static crt. mesa:x64-windows-static=fail -# Missing dependent libraries. +# Missing dependent libraries. mesa:x64-linux=fail mesa:x64-osx=fail meschach:arm-uwp=fail @@ -1136,8 +1136,6 @@ opencv3:x64-windows = skip opencv3:x64-windows-static = skip opencv3:x64-windows-static-md=skip opencv3:x86-windows = skip -opencv4:arm64-windows = fail -opencv4:arm-uwp = fail opendnp3:x64-uwp=fail opendnp3:arm-uwp=fail openexr:arm64-windows=fail @@ -1802,7 +1800,6 @@ open62541:x64-windows-static-md=fail pngpp:x64-windows-static-md=fail portmidi:x64-windows-static-md=fail pthreads:x64-windows-static-md=fail -qt5-tools:x64-windows-static-md=fail quantlib:x64-windows-static-md=fail readosm:x64-windows-static-md=fail sentencepiece:x64-windows-static-md=fail diff --git a/versions/baseline.json b/versions/baseline.json index 58d1198f70..a76263660b 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4217,12 +4217,12 @@ "port-version": 5 }, "opencv3": { - "baseline": "3.4.10", - "port-version": 5 + "baseline": "3.4.12", + "port-version": 0 }, "opencv4": { - "baseline": "4.3.0", - "port-version": 5 + "baseline": "4.5.0", + "port-version": 0 }, "opendnp3": { "baseline": "3.1.0", diff --git a/versions/o-/opencv3.json b/versions/o-/opencv3.json index 31859a5aa8..33d47557a8 100644 --- a/versions/o-/opencv3.json +++ b/versions/o-/opencv3.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "a0dfe03c4db4fb9532b888399deee675750eef61", + "version-string": "3.4.12", + "port-version": 0 + }, { "git-tree": "a761625dd5d17548aaa9611295ace23ca8bc27fc", "version-string": "3.4.10", diff --git a/versions/o-/opencv4.json b/versions/o-/opencv4.json index b326830fb5..5a2934e9d4 100644 --- a/versions/o-/opencv4.json +++ b/versions/o-/opencv4.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "cdf704950d37ce677508db67c081f9aeda18b9cd", + "version-string": "4.5.0", + "port-version": 0 + }, { "git-tree": "f6fbdfab1e9ac01652b51f2251715c2be05a6567", "version-string": "4.3.0",