From 1897f170645e6d18117a30b45b320e75db24fcc7 Mon Sep 17 00:00:00 2001 From: NeroBurner Date: Wed, 25 Oct 2023 09:23:57 +0200 Subject: [PATCH] OpenCV, Extra, ippicv: update to v4.8.1-p0 (#696) Update `OpenCV` to version `v4.8.1-p0` and the components `OpenCV-Extra` to `v4.8.1` and `ippicv` to `20230330`. Those packages belong together so I updated them together. Implement the documentation stubs for `OpenCV-Extra` and `ippicv` as well. Update the default flags for OpenCV project to make sure all OpenCV modules, which would download data from the internet themselfs during CMake configuration are disabled. --- cmake/configs/default.cmake | 6 ++-- cmake/projects/OpenCV-Extra/hunter.cmake | 12 +++++++ cmake/projects/OpenCV/hunter.cmake | 26 ++++++++++++++- cmake/projects/ippicv/hunter.cmake | 40 ++++++++++++++++++++++++ docs/packages/pkg/OpenCV-Extra.rst | 23 ++++++-------- docs/packages/pkg/ippicv.rst | 28 ++++++++--------- examples/OpenCV-Extra/foo.cpp | 36 ++++++++++----------- 7 files changed, 121 insertions(+), 50 deletions(-) diff --git a/cmake/configs/default.cmake b/cmake/configs/default.cmake index 914f9dfe72..b01ea3136a 100644 --- a/cmake/configs/default.cmake +++ b/cmake/configs/default.cmake @@ -109,8 +109,8 @@ hunter_default_version(OpenBLAS VERSION 0.3.21) hunter_default_version(OpenCL VERSION 2022.01.04-p1) hunter_default_version(OpenCL-Headers VERSION 2022.01.04) hunter_default_version(OpenCL-cpp VERSION 2.0.16-61a5c9a-p0) -hunter_default_version(OpenCV VERSION 4.5.5-p0) -hunter_default_version(OpenCV-Extra VERSION 4.5.3) +hunter_default_version(OpenCV VERSION 4.8.1-p0) +hunter_default_version(OpenCV-Extra VERSION 4.8.1) hunter_default_version(OpenEXR VERSION 3.1.5-p0) hunter_default_version(OpenGL-Registry VERSION 0.0.0-d15191e-p0) hunter_default_version(OpenNMTTokenizer VERSION 1.11.0-p1) @@ -332,7 +332,7 @@ hunter_default_version(intltool VERSION 0.51.0) hunter_default_version(intsizeof VERSION 2.0.2) hunter_default_version(intx VERSION 0.9.0) hunter_default_version(ios_sim VERSION 3.1.1) -hunter_default_version(ippicv VERSION 20151201) +hunter_default_version(ippicv VERSION 20230330) hunter_default_version(iroha-ed25519 VERSION 2.0.0) hunter_default_version(irrXML VERSION 1.2-p0) hunter_default_version(ittapi VERSION 3.21.2-p0) diff --git a/cmake/projects/OpenCV-Extra/hunter.cmake b/cmake/projects/OpenCV-Extra/hunter.cmake index dc7f59c4c1..93228cd026 100644 --- a/cmake/projects/OpenCV-Extra/hunter.cmake +++ b/cmake/projects/OpenCV-Extra/hunter.cmake @@ -150,5 +150,17 @@ hunter_add_version( 6301ce49ec0c851837b62aed8592be9cd9309f79 ) +hunter_add_version( + PACKAGE_NAME + OpenCV-Extra + VERSION + "4.8.1" + URL + "https://github.com/opencv/opencv_contrib/archive/4.8.1.tar.gz" + SHA1 + 111cca75f8f3dd7d840755d6fc3c488c2fe980ed +) + + hunter_pick_scheme(DEFAULT url_sha1_unpack) hunter_download(PACKAGE_NAME OpenCV-Extra) diff --git a/cmake/projects/OpenCV/hunter.cmake b/cmake/projects/OpenCV/hunter.cmake index 5115f9ea09..31317eafda 100644 --- a/cmake/projects/OpenCV/hunter.cmake +++ b/cmake/projects/OpenCV/hunter.cmake @@ -13,6 +13,17 @@ include(hunter_pick_scheme) # List of versions here... +hunter_add_version( + PACKAGE_NAME + OpenCV + VERSION + "4.8.1-p0" + URL + "https://github.com/cpp-pm/opencv/archive/refs/tags/v4.8.1-p0.tar.gz" + SHA1 + 4338a5be8b3fe1d5fb7ba7935d99669005c1a7a0 +) + hunter_add_version( PACKAGE_NAME OpenCV @@ -503,20 +514,33 @@ hunter_cmake_args( BUILD_JASPER=OFF BUILD_WEBP=OFF BUILD_OPENEXR=OFF + BUILD_OPENJPEG=OFF + BUILD_PROTOBUF=OFF + BUILD_TBB=OFF + BUILD_ITT=OFF # This stuff will build shared libraries. Build with PIC required for dependencies. BUILD_opencv_java=OFF BUILD_opencv_python2=OFF BUILD_opencv_python3=OFF + # disable downloaders because they download from the internet at configuration time + BUILD_opencv_wechat_qrcode=OFF + BUILD_opencv_xfeatures2d=OFF + WITH_ADE=OFF + BUILD_opencv_cudaoptflow=OFF + BUILD_opencv_face=OFF # There is not a CUDA package so need to stop OpenCV from searching for it, otherwise # it might pick up the host version WITH_CUDA=OFF + WITH_CUDNN=OFF WITH_CUFFT=OFF + WITH_CUBLAS=OFF # Fix for https://travis-ci.org/xsacha/hunter/jobs/347083573 BUILD_opencv_dnn=OFF WITH_FFMPEG=OFF WITH_OPENJPEG=OFF WITH_QUIRC=OFF - WITH_ADE=OFF + WITH_LAPACK=OFF + WITH_PROTOBUF=OFF ) # Pick a download scheme diff --git a/cmake/projects/ippicv/hunter.cmake b/cmake/projects/ippicv/hunter.cmake index d47423c61b..f9d325dffd 100755 --- a/cmake/projects/ippicv/hunter.cmake +++ b/cmake/projects/ippicv/hunter.cmake @@ -7,6 +7,7 @@ include(hunter_add_version) include(hunter_download) include(hunter_pick_scheme) +# Version 20151201 if(APPLE) hunter_add_version( PACKAGE_NAME @@ -42,6 +43,7 @@ elseif(WIN32) ) endif() +# Version 20141027 if(APPLE) hunter_add_version( PACKAGE_NAME @@ -77,5 +79,43 @@ elseif(WIN32) ) endif() +# Version: 20230330 +# added for OpenCV 4.8.1 +if(APPLE) + hunter_add_version( + PACKAGE_NAME + ippicv + VERSION + "20230330" + URL + "https://raw.githubusercontent.com/opencv/opencv_3rdparty/1224f78da6684df04397ac0f40c961ed37f79ccb/ippicv/ippicv_2021.8_mac_intel64_20230330_general.tgz" + SHA1 + abc8caf5d8819abfbe0b257c4d41d9cd32406ebb + ) +elseif(UNIX) + hunter_add_version( + PACKAGE_NAME + ippicv + VERSION + "20230330" + URL + "https://raw.githubusercontent.com/opencv/opencv_3rdparty/1224f78da6684df04397ac0f40c961ed37f79ccb/ippicv/ippicv_2021.8_lnx_intel64_20230330_general.tgz" + SHA1 + 80c96d62ca6b4596775da7c5dcc9602712328a61 + ) +elseif(WIN32) + hunter_add_version( + PACKAGE_NAME + ippicv + VERSION + "20230330" + URL + "https://raw.githubusercontent.com/opencv/opencv_3rdparty/1224f78da6684df04397ac0f40c961ed37f79ccb/ippicv/ippicv_2021.8_win_intel64_20230330_general.zip" + SHA1 + 7c7f83e37caf6c342d76014f3eccedb47d559010 + ) +endif() + + hunter_pick_scheme(DEFAULT url_sha1_download) hunter_download(PACKAGE_NAME ippicv) diff --git a/docs/packages/pkg/OpenCV-Extra.rst b/docs/packages/pkg/OpenCV-Extra.rst index d6ac960bf1..3c8d8aab74 100644 --- a/docs/packages/pkg/OpenCV-Extra.rst +++ b/docs/packages/pkg/OpenCV-Extra.rst @@ -9,20 +9,17 @@ OpenCV-Extra ============ -.. warning:: +- `Official `__ +- `Example `__ +- Available since `v0.11.1 `__ +- Added by `Ruslan Baratov `__ (`commit c0bb8aac `__) - This page is a template and contains no real information. - Please send pull request with real description. - -- `__FIXME__ Official `__ -- `__FIXME__ Hunterized `__ -- `__FIXME__ Example `__ -- Available since `__FIXME__ vX.Y.Z `__ -- Added by `__FIXME__ `__ (`__FIXME__ pr-N `__) +Enabled by setting the flag ``OPENCV_WITH_EXTRA_MODULES=YES`` in the projects ``config.cmake`` file. .. code-block:: cmake - hunter_add_package(__FIXME__) - find_package(__FIXME__ CONFIG REQUIRED) - target_link_libraries(foo __FIXME__::__FIXME__) - + hunter_config(OpenCV + VERSION ${HUNTER_OpenCV_VERSION} + CMAKE_ARGS + OPENCV_WITH_EXTRA_MODULES=YES + ) diff --git a/docs/packages/pkg/ippicv.rst b/docs/packages/pkg/ippicv.rst index 7cd7e48eaa..c43a942dd7 100644 --- a/docs/packages/pkg/ippicv.rst +++ b/docs/packages/pkg/ippicv.rst @@ -1,28 +1,28 @@ .. spelling:: ippicv + OpenCV -.. index:: unsorted ; ippicv +.. index:: opencv_component ; ippicv .. _pkg.ippicv: ippicv ====== -.. warning:: - - This page is a template and contains no real information. - Please send pull request with real description. - -- `__FIXME__ Official `__ -- `__FIXME__ Hunterized `__ -- `__FIXME__ Example `__ -- Available since `__FIXME__ vX.Y.Z `__ -- Added by `__FIXME__ `__ (`__FIXME__ pr-N `__) +- `Official `__ +- `Example `__ +- Available since `v0.14.12 `__ .. code-block:: cmake - hunter_add_package(__FIXME__) - find_package(__FIXME__ CONFIG REQUIRED) - target_link_libraries(foo __FIXME__::__FIXME__) + hunter_add_package(ippicv) + file(GLOB ippicv_archive "${IPPICV_ROOT}/ippicv_*") + if(EXISTS "${ippicv_archive}") + message("ippicv archive: ${ippicv_archive}") + else() + message(FATAL_ERROR "Nothing found in `${IPPICV_ROOT}`") + endif() +ippicv stands for Intel(R) Integrated Performance Primitives for OpenCV. +The package was added to be used by the OpenCV project and should be updated together with OpenCV. diff --git a/examples/OpenCV-Extra/foo.cpp b/examples/OpenCV-Extra/foo.cpp index 7f6cf9c124..d8ada4b6f4 100644 --- a/examples/OpenCV-Extra/foo.cpp +++ b/examples/OpenCV-Extra/foo.cpp @@ -1,26 +1,24 @@ -// http://docs.opencv.org/doc/tutorials/introduction/linux_gcc_cmake/linux_gcc_cmake.html +// from OpenCV_contrib/modules/stereo/samples/export_param_file.cpp -#include -#include -#include +#include +#include -int main(int argc, char** argv) { - if (argc != 2) { - printf("usage: DisplayImage.out \n"); - return -1; - } +using namespace cv; +using namespace std; - cv::Mat image; - image = cv::imread(argv[1], 1); +int main(int argc, char* argv[]) +{ +//! [create] + Ptr stereo = stereo::QuasiDenseStereo::create(cv::Size(5,5)); +//! [create] - if (!image.data) { - printf("No image data \n"); - return EXIT_FAILURE; - } - cv::namedWindow("Display Image", cv::WINDOW_AUTOSIZE); - cv::imshow("Display Image", image); - cv::waitKey(0); +//! [write] + std::string parameterFileLocation = "./parameters.yaml"; + if (argc > 1) + parameterFileLocation = argv[1]; + stereo->saveParameters(parameterFileLocation); +//! [write] - return EXIT_SUCCESS; + return 0; }