freescale-layer: opencv: update to 4.9.0.imx

Port the recipe from the scarthgap-6.6.23-2.0.0 branch of meta-imx,
meta-freescale is still using 4.6.0. Add the "Upstream-Status" tag to all of
the patches to avoid QA errors.

https://onedigi.atlassian.net/browse/DEL-9011
https://onedigi.atlassian.net/browse/DEL-9081

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
This commit is contained in:
Gabriel Valcazar 2024-05-13 12:37:05 +02:00
parent 36e9247a66
commit ab6f1a6448
13 changed files with 708 additions and 104 deletions

View File

@ -1,36 +0,0 @@
From 9b4959b97d2e95d4b49cf6ca2a3fce3cdb484f2d Mon Sep 17 00:00:00 2001
From: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Date: Thu, 31 Mar 2016 00:20:15 +0200
Subject: [PATCH] 3rdparty/ippicv: Use pre-downloaded ipp
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
---
3rdparty/ippicv/ippicv.cmake | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/3rdparty/ippicv/ippicv.cmake b/3rdparty/ippicv/ippicv.cmake
index 257af6fcc6..f88460450f 100644
--- a/3rdparty/ippicv/ippicv.cmake
+++ b/3rdparty/ippicv/ippicv.cmake
@@ -34,18 +34,5 @@ function(download_ippicv root_var)
endif()
set(THE_ROOT "${OpenCV_BINARY_DIR}/3rdparty/ippicv")
- ocv_download(FILENAME ${OPENCV_ICV_NAME}
- HASH ${OPENCV_ICV_HASH}
- URL
- "${OPENCV_IPPICV_URL}"
- "$ENV{OPENCV_IPPICV_URL}"
- "https://raw.githubusercontent.com/opencv/opencv_3rdparty/${IPPICV_COMMIT}/ippicv/"
- DESTINATION_DIR "${THE_ROOT}"
- ID IPPICV
- STATUS res
- UNPACK RELATIVE_URL)
-
- if(res)
- set(${root_var} "${THE_ROOT}/${OPENCV_ICV_PACKAGE_SUBDIR}" PARENT_SCOPE)
- endif()
+ set(${root_var} "${THE_ROOT}/${OPENCV_ICV_PACKAGE_SUBDIR}" PARENT_SCOPE)
endfunction()

View File

@ -3,6 +3,8 @@ From: Tom Hochstein <tom.hochstein@nxp.com>
Date: Tue, 1 Sep 2020 14:57:07 -0500
Subject: [PATCH] Add smaller version of download_models.py
Upstream-Status: Inappropriate [imx specific]
Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
---
testdata/dnn/download_models_basic.py | 159 ++++++++++++++++++++++++++

View File

@ -1,4 +1,4 @@
From 66e50ee69fa9ee2469d349100e70d8b296c4b4dc Mon Sep 17 00:00:00 2001
From 467b6b4eb328b62254083a77d3eb58c51e848dd2 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 11 Sep 2018 00:21:18 -0700
Subject: [PATCH] Dont use isystem
@ -14,7 +14,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
1 file changed, 2 insertions(+)
diff --git a/cmake/OpenCVPCHSupport.cmake b/cmake/OpenCVPCHSupport.cmake
index 08cd06def4..46c9c02da3 100644
index 34a088b839..d18aa6bacc 100644
--- a/cmake/OpenCVPCHSupport.cmake
+++ b/cmake/OpenCVPCHSupport.cmake
@@ -18,6 +18,8 @@ IF(CV_GCC)

View File

@ -1,4 +1,4 @@
From 11bbf909e08594628bd757d989ae34cf1bfe200b Mon Sep 17 00:00:00 2001
From 4acc58d225b51f337fdd5a2e21cd97a467460fee Mon Sep 17 00:00:00 2001
From: Mingli Yu <mingli.yu@windriver.com>
Date: Thu, 18 Jun 2020 05:51:38 +0000
Subject: [PATCH] Make ts module external
@ -10,12 +10,13 @@ Reference: https://github.com/qbonnard/opencv/commit/6b229c5834cb9a0930425e762a6
Upstream-Status: Submitted [https://github.com/opencv/opencv/issues/8408]
Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
---
modules/ts/CMakeLists.txt | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/modules/ts/CMakeLists.txt b/modules/ts/CMakeLists.txt
index f95bed0793..66f315bcca 100644
index c1d249ea14..9cc6859890 100644
--- a/modules/ts/CMakeLists.txt
+++ b/modules/ts/CMakeLists.txt
@@ -4,9 +4,6 @@ if(NOT BUILD_opencv_ts AND NOT BUILD_TESTS AND NOT BUILD_PERF_TESTS)
@ -37,6 +38,3 @@ index f95bed0793..66f315bcca 100644
ocv_glob_module_sources()
ocv_module_include_directories()
--
2.24.1

View File

@ -1,9 +1,11 @@
From e4ec6cea72da9e9ae5ba57140fa2f5c63f1f8295 Mon Sep 17 00:00:00 2001
From 5d71e872855c9e7e20aefeb5513ce8d87b201918 Mon Sep 17 00:00:00 2001
From: Jason Wessel <jason.wessel@windriver.com>
Date: Wed, 9 May 2018 13:33:59 -0700
Subject: [PATCH] Temporarliy work around deprecated ffmpeg RAW function
compile failure until next uprev
Upstream-Status: Inappropriate [imx specific]
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
---
@ -11,10 +13,10 @@ Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
1 file changed, 8 insertions(+)
diff --git a/modules/videoio/src/cap_ffmpeg_impl.hpp b/modules/videoio/src/cap_ffmpeg_impl.hpp
index 6dca724a89..ae55dd4555 100644
index 982bc5c87d..633da25fd9 100644
--- a/modules/videoio/src/cap_ffmpeg_impl.hpp
+++ b/modules/videoio/src/cap_ffmpeg_impl.hpp
@@ -774,6 +774,14 @@ struct ImplMutex::Impl
@@ -829,6 +829,14 @@ struct ImplMutex::Impl
#endif

View File

@ -0,0 +1,31 @@
From 59fafe6e39759e193b5764b36b4c5a93da352123 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 18 Aug 2020 00:36:49 -0700
Subject: [PATCH] Use -Os to compile tinyxml2.cpp
This workarounds issue [1] seen on riscv with gcc
[1] https://github.com/riscv/riscv-gnu-toolchain/issues/624
Upstream-Status: Inappropriate [ OE-Specific ]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
modules/datasets/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/datasets/CMakeLists.txt b/modules/datasets/CMakeLists.txt
index 56ca9e310..99b7a33f6 100644
--- a/modules/datasets/CMakeLists.txt
+++ b/modules/datasets/CMakeLists.txt
@@ -2,7 +2,7 @@ set(the_description "datasets framework")
set(filter_srcs "${CMAKE_CURRENT_LIST_DIR}/src/tinyxml2/tinyxml2.cpp")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
- ocv_append_source_files_cxx_compiler_options(filter_srcs "-Wno-suggest-override") # GCC
+ ocv_append_source_files_cxx_compiler_options(filter_srcs "-Wno-suggest-override -Os") # GCC
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
ocv_append_source_files_cxx_compiler_options(filter_srcs "-Wno-inconsistent-missing-override") # Clang
endif()
--
2.28.0

View File

@ -1,4 +1,4 @@
From f42c9b8c7bafcadc7e95fb25a391707f970eb426 Mon Sep 17 00:00:00 2001
From 9a21e28642d64393153d6f304278a11b6ebd3f7b Mon Sep 17 00:00:00 2001
From: Huang Qiyu <huangqy.fnst@cn.fujitsu.com>
Date: Fri, 19 May 2017 04:27:50 +0900
Subject: [PATCH] To fix errors as following:
@ -12,6 +12,8 @@ Signed-off-by: Huang Qiyu <huangqy.fnst@cn.fujitsu.com>
Also add the visibility changes for certain OpenCL-related functions in
ts module.
Upstream-Status: Inappropriate [imx specific]
Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
---
@ -21,10 +23,10 @@ Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/modules/ts/include/opencv2/ts.hpp b/modules/ts/include/opencv2/ts.hpp
index ed7491a89a..80919d13ee 100644
index 86f2d07761..5b3ee560ca 100644
--- a/modules/ts/include/opencv2/ts.hpp
+++ b/modules/ts/include/opencv2/ts.hpp
@@ -728,7 +728,7 @@ protected:
@@ -735,7 +735,7 @@ protected:
}
};
@ -33,7 +35,7 @@ index ed7491a89a..80919d13ee 100644
struct DefaultRngAuto
{
@@ -791,7 +791,7 @@ private:
@@ -798,7 +798,7 @@ private:
#endif
#endif
@ -43,7 +45,7 @@ index ed7491a89a..80919d13ee 100644
#define CV_TEST_INIT0_NOOP (void)0
diff --git a/modules/ts/include/opencv2/ts/ocl_test.hpp b/modules/ts/include/opencv2/ts/ocl_test.hpp
index 11572e9f48..438112e2aa 100644
index 717eb7b14c..c845b5e014 100644
--- a/modules/ts/include/opencv2/ts/ocl_test.hpp
+++ b/modules/ts/include/opencv2/ts/ocl_test.hpp
@@ -82,7 +82,7 @@ inline UMat ToUMat(InputArray src)
@ -56,7 +58,7 @@ index 11572e9f48..438112e2aa 100644
#define MAX_VALUE 357
diff --git a/modules/ts/include/opencv2/ts/ts_ext.hpp b/modules/ts/include/opencv2/ts/ts_ext.hpp
index b2a4cac241..b94c681c0c 100644
index efa4860510..515b7c9ec4 100644
--- a/modules/ts/include/opencv2/ts/ts_ext.hpp
+++ b/modules/ts/include/opencv2/ts/ts_ext.hpp
@@ -9,7 +9,7 @@

View File

@ -0,0 +1,140 @@
From c886303928a9ce18ee384521e100aba182c7f5fe Mon Sep 17 00:00:00 2001
From: Victor Westerhuis <victor@westerhu.is>
Date: Sat, 19 Nov 2022 21:45:39 +0100
Subject: [PATCH] Do not embed build directory in binaries
This makes the opencv core module build reproducibly.
https://salsa.debian.org/science-team/opencv/-/raw/master/debian/patches/0008-Do-not-embed-build-directory-in-binaries.patch
Upstream-Status: Backport
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
---
modules/core/CMakeLists.txt | 10 ----
modules/core/include/opencv2/core/private.hpp | 4 +-
modules/core/include/opencv2/core/utility.hpp | 4 +-
modules/core/src/utils/datafile.cpp | 48 +------------------
4 files changed, 5 insertions(+), 61 deletions(-)
diff --git a/modules/core/CMakeLists.txt b/modules/core/CMakeLists.txt
index 1b3f574275..206e57436e 100644
--- a/modules/core/CMakeLists.txt
+++ b/modules/core/CMakeLists.txt
@@ -194,16 +194,6 @@ if(OPENCV_OTHER_INSTALL_PATH)
")
endif()
-set(OPENCV_DATA_CONFIG_STR "${OPENCV_DATA_CONFIG_STR}
-#define OPENCV_BUILD_DIR \"${CMAKE_BINARY_DIR}\"
-")
-
-file(RELATIVE_PATH SOURCE_DIR_RELATIVE ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR})
-set(OPENCV_DATA_CONFIG_STR "${OPENCV_DATA_CONFIG_STR}
-#define OPENCV_DATA_BUILD_DIR_SEARCH_PATHS \\
- \"${SOURCE_DIR_RELATIVE}/\"
-")
-
if(WIN32)
file(RELATIVE_PATH INSTALL_DATA_DIR_RELATIVE "${CMAKE_INSTALL_PREFIX}/${OPENCV_BIN_INSTALL_PATH}" "${CMAKE_INSTALL_PREFIX}/${OPENCV_OTHER_INSTALL_PATH}")
else()
diff --git a/modules/core/include/opencv2/core/private.hpp b/modules/core/include/opencv2/core/private.hpp
index 02ac1ba1e3..cd06be273e 100644
--- a/modules/core/include/opencv2/core/private.hpp
+++ b/modules/core/include/opencv2/core/private.hpp
@@ -825,10 +825,10 @@ Search directories:
2. Check path specified by configuration parameter with "_HINT" suffix (name of environment variable).
3. Check path specified by configuration parameter (name of environment variable).
If parameter value is not empty and nothing is found then stop searching.
-4. Detects build/install path based on:
+4. Detects install path based on:
a. current working directory (CWD)
b. and/or binary module location (opencv_core/opencv_world, doesn't work with static linkage)
-5. Scan `<source>/{,data}` directories if build directory is detected or the current directory is in source tree.
+5. Scan `<source>/{,data}` directories if the current directory is in source tree.
6. Scan `<install>/share/OpenCV` directory if install directory is detected.
@param relative_path Relative path to data file
diff --git a/modules/core/include/opencv2/core/utility.hpp b/modules/core/include/opencv2/core/utility.hpp
index db8c42976f..b09ed0eed4 100644
--- a/modules/core/include/opencv2/core/utility.hpp
+++ b/modules/core/include/opencv2/core/utility.hpp
@@ -1163,10 +1163,10 @@ Search directories:
2. OPENCV_SAMPLES_DATA_PATH_HINT environment variable
3. OPENCV_SAMPLES_DATA_PATH environment variable
If parameter value is not empty and nothing is found then stop searching.
-4. Detects build/install path based on:
+4. Detects install path based on:
a. current working directory (CWD)
b. and/or binary module location (opencv_core/opencv_world, doesn't work with static linkage)
-5. Scan `<source>/{,data,samples/data}` directories if build directory is detected or the current directory is in source tree.
+5. Scan `<source>/{,data,samples/data}` directories if the current directory is in source tree.
6. Scan `<install>/share/OpenCV` directory if install directory is detected.
@see cv::utils::findDataFile
diff --git a/modules/core/src/utils/datafile.cpp b/modules/core/src/utils/datafile.cpp
index 3af83a5d8f..6bda857d28 100644
--- a/modules/core/src/utils/datafile.cpp
+++ b/modules/core/src/utils/datafile.cpp
@@ -280,32 +280,8 @@ cv::String findDataFile(const cv::String& relative_path,
// Steps: 4, 5, 6
- cv::String cwd = utils::fs::getcwd();
- cv::String build_dir(OPENCV_BUILD_DIR);
- bool has_tested_build_directory = false;
- if (isSubDirectory(build_dir, cwd) || isSubDirectory(utils::fs::canonical(build_dir), utils::fs::canonical(cwd)))
- {
- CV_LOG_DEBUG(NULL, "utils::findDataFile(): the current directory is build sub-directory: " << cwd);
- const char* build_subdirs[] = { OPENCV_DATA_BUILD_DIR_SEARCH_PATHS };
- for (size_t k = 0; k < sizeof(build_subdirs)/sizeof(build_subdirs[0]); k++)
- {
- CV_LOG_DEBUG(NULL, "utils::findDataFile(): <build>/" << build_subdirs[k]);
- cv::String datapath = utils::fs::join(build_dir, build_subdirs[k]);
- if (utils::fs::isDirectory(datapath))
- {
- for(size_t i = search_subdir.size(); i > 0; i--)
- {
- const cv::String& subdir = search_subdir[i - 1];
- cv::String prefix = utils::fs::join(datapath, subdir);
- TRY_FILE_WITH_PREFIX(prefix);
- }
- }
- }
- has_tested_build_directory = true;
- }
-
cv::String source_dir;
- cv::String try_source_dir = cwd;
+ cv::String try_source_dir = utils::fs::getcwd();
for (int levels = 0; levels < 3; ++levels)
{
if (utils::fs::exists(utils::fs::join(try_source_dir, "modules/core/include/opencv2/core/version.hpp")))
@@ -341,28 +317,6 @@ cv::String findDataFile(const cv::String& relative_path,
CV_LOG_INFO(NULL, "Can't detect module binaries location");
}
- if (!has_tested_build_directory &&
- (isSubDirectory(build_dir, module_path) || isSubDirectory(utils::fs::canonical(build_dir), utils::fs::canonical(module_path)))
- )
- {
- CV_LOG_DEBUG(NULL, "utils::findDataFile(): the binary module directory is build sub-directory: " << module_path);
- const char* build_subdirs[] = { OPENCV_DATA_BUILD_DIR_SEARCH_PATHS };
- for (size_t k = 0; k < sizeof(build_subdirs)/sizeof(build_subdirs[0]); k++)
- {
- CV_LOG_DEBUG(NULL, "utils::findDataFile(): <build>/" << build_subdirs[k]);
- cv::String datapath = utils::fs::join(build_dir, build_subdirs[k]);
- if (utils::fs::isDirectory(datapath))
- {
- for(size_t i = search_subdir.size(); i > 0; i--)
- {
- const cv::String& subdir = search_subdir[i - 1];
- cv::String prefix = utils::fs::join(datapath, subdir);
- TRY_FILE_WITH_PREFIX(prefix);
- }
- }
- }
- }
-
#if defined OPENCV_INSTALL_DATA_DIR_RELATIVE
if (!module_path.empty()) // require module path
{

View File

@ -1,24 +1,26 @@
From 3c4daafb54f961e376104a461ca7ec114ff0331a Mon Sep 17 00:00:00 2001
From c0e12bef26b4e4f10eb541c26f7fd7400addb67e Mon Sep 17 00:00:00 2001
From: Ludek Slosarcik <ludek.slosarcik@nxp.com>
Date: Fri, 14 Feb 2020 15:46:50 +0100
Subject: [PATCH] opencv_dnn: added video device for 2 examples, and change text labels
Subject: [PATCH] opencv_dnn: added video device for 2 examples, and change
text labels
Signed-off-by: Ludek Slosarcik <ludek.slosarcik@nxp.com>
Upstream-Status: Pending
---
samples/cpp/logistic_regression.cpp | 2 +-
samples/dnn/classification.cpp | 7 ++++---
samples/dnn/classification.cpp | 9 +++++----
samples/dnn/object_detection.cpp | 10 +++++-----
samples/dnn/segmentation.cpp | 2 +-
samples/dnn/text_detection.cpp | 5 +++--
samples/dnn/text_detection.cpp | 3 ++-
5 files changed, 14 insertions(+), 12 deletions(-)
Index: git/samples/cpp/logistic_regression.cpp
===================================================================
--- git.orig/samples/cpp/logistic_regression.cpp
+++ git/samples/cpp/logistic_regression.cpp
@@ -28,7 +28,7 @@ static float calculateAccuracyPercent(co
diff --git a/samples/cpp/logistic_regression.cpp b/samples/cpp/logistic_regression.cpp
index 1bc2bf9711..ab5eebcbab 100644
--- a/samples/cpp/logistic_regression.cpp
+++ b/samples/cpp/logistic_regression.cpp
@@ -28,7 +28,7 @@ static float calculateAccuracyPercent(const Mat &original, const Mat &predicted)
int main()
{
@ -27,10 +29,10 @@ Index: git/samples/cpp/logistic_regression.cpp
cout << "**********************************************************************" << endl;
cout << filename
<< " contains digits 0 and 1 of 20 samples each, collected on an Android device" << endl;
Index: git/samples/dnn/classification.cpp
===================================================================
--- git.orig/samples/dnn/classification.cpp
+++ git/samples/dnn/classification.cpp
diff --git a/samples/dnn/classification.cpp b/samples/dnn/classification.cpp
index 51893666ab..187a7807cd 100644
--- a/samples/dnn/classification.cpp
+++ b/samples/dnn/classification.cpp
@@ -12,6 +12,7 @@ std::string keys =
"{ help h | | Print help message. }"
"{ @alias | | An alias name of model to extract preprocessing parameters from models.yml file. }"
@ -66,10 +68,10 @@ Index: git/samples/dnn/classification.cpp
imshow(kWinName, frame);
}
Index: git/samples/dnn/object_detection.cpp
===================================================================
--- git.orig/samples/dnn/object_detection.cpp
+++ git/samples/dnn/object_detection.cpp
diff --git a/samples/dnn/object_detection.cpp b/samples/dnn/object_detection.cpp
index 6fc8b2ab61..b299a22912 100644
--- a/samples/dnn/object_detection.cpp
+++ b/samples/dnn/object_detection.cpp
@@ -260,13 +260,13 @@ int main(int argc, char** argv)
if (predictionsQueue.counter > 1)
{
@ -96,7 +98,7 @@ Index: git/samples/dnn/object_detection.cpp
imshow(kWinName, frame);
}
@@ -471,7 +471,7 @@ void drawPred(int classId, float conf, i
@@ -471,7 +471,7 @@ void drawPred(int classId, float conf, int left, int top, int right, int bottom,
top = max(top, labelSize.height);
rectangle(frame, Point(left, top - labelSize.height),
Point(left + labelSize.width, top + baseLine), Scalar::all(255), FILLED);
@ -105,10 +107,10 @@ Index: git/samples/dnn/object_detection.cpp
}
void callback(int pos, void*)
Index: git/samples/dnn/segmentation.cpp
===================================================================
--- git.orig/samples/dnn/segmentation.cpp
+++ git/samples/dnn/segmentation.cpp
diff --git a/samples/dnn/segmentation.cpp b/samples/dnn/segmentation.cpp
index 777badf51e..e8d821b485 100644
--- a/samples/dnn/segmentation.cpp
+++ b/samples/dnn/segmentation.cpp
@@ -162,7 +162,7 @@ int main(int argc, char** argv)
double freq = getTickFrequency() / 1000;
double t = net.getPerfProfile(layersTimes) / freq;
@ -118,10 +120,10 @@ Index: git/samples/dnn/segmentation.cpp
imshow(kWinName, frame);
if (!classes.empty())
Index: git/samples/dnn/text_detection.cpp
===================================================================
--- git.orig/samples/dnn/text_detection.cpp
+++ git/samples/dnn/text_detection.cpp
diff --git a/samples/dnn/text_detection.cpp b/samples/dnn/text_detection.cpp
index 24902abfd7..a4ab162763 100644
--- a/samples/dnn/text_detection.cpp
+++ b/samples/dnn/text_detection.cpp
@@ -30,6 +30,7 @@ using namespace cv::dnn;
const char* keys =
"{ help h | | Print help message. }"

View File

@ -1,4 +1,4 @@
From b18a280fab06a680d9f831bf8b462647f3cb6214 Mon Sep 17 00:00:00 2001
From 0c2f6044aea4cdcd3b084867ddb801771f949100 Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@intel.com>
Date: Thu, 9 Jan 2020 16:24:24 +0000
Subject: [PATCH] opencv: abort configure if we need to download
@ -16,7 +16,7 @@ Signed-off-by: Ross Burton <ross.burton@intel.com>
1 file changed, 6 insertions(+)
diff --git a/cmake/OpenCVDownload.cmake b/cmake/OpenCVDownload.cmake
index 63cf6d3238..4acf477f70 100644
index 3e46515537..e03fc5bbb8 100644
--- a/cmake/OpenCVDownload.cmake
+++ b/cmake/OpenCVDownload.cmake
@@ -14,6 +14,7 @@
@ -27,7 +27,7 @@ index 63cf6d3238..4acf477f70 100644
set(HELP_OPENCV_DOWNLOAD_PATH "Cache directory for downloaded files")
if(DEFINED ENV{OPENCV_DOWNLOAD_PATH})
set(OPENCV_DOWNLOAD_PATH "$ENV{OPENCV_DOWNLOAD_PATH}" CACHE PATH "${HELP_OPENCV_DOWNLOAD_PATH}")
@@ -156,6 +157,11 @@ function(ocv_download)
@@ -202,6 +203,11 @@ function(ocv_download)
# Download
if(NOT EXISTS "${CACHE_CANDIDATE}")

View File

@ -0,0 +1,203 @@
From 75f7475fcfb35cbe4d8f5ccf5c4ac8bc78f2dc30 Mon Sep 17 00:00:00 2001
From: Kumataro <Kumataro@users.noreply.github.com>
Date: Thu, 19 Oct 2023 14:45:08 +0900
Subject: [PATCH] Merge pull request #24372 from Kumataro:fix24369
Supporting protobuf v22 and later(with abseil-cpp/C++17) #24372
fix https://github.com/opencv/opencv/issues/24369
related https://github.com/opencv/opencv/issues/23791
1. This patch supports external protobuf v22 and later, it required abseil-cpp and c++17.
Even if the built-in protobuf is upgraded to v22 or later,
the dependency on abseil-cpp and the requirement for C++17 will continue.
2. Some test for caffe required patched protobuf, so this patch disable them.
This patch is tested by following libraries.
- Protobuf: /usr/local/lib/libprotobuf.so (4.24.4)
- abseil-cpp: YES (20230125)
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
Upstream-Status: Backport [https://github.com/opencv/opencv/commit/6e4280ea81b59c6dca45bb9801b758377beead55]
---
cmake/OpenCVFindProtobuf.cmake | 35 +++++++++++++++++++++++++++-----
modules/dnn/CMakeLists.txt | 6 ++++++
modules/dnn/test/test_layers.cpp | 24 ++++++++++++++++++----
3 files changed, 56 insertions(+), 9 deletions(-)
diff --git a/cmake/OpenCVFindProtobuf.cmake b/cmake/OpenCVFindProtobuf.cmake
index 8835347d1d..5b1e17529f 100644
--- a/cmake/OpenCVFindProtobuf.cmake
+++ b/cmake/OpenCVFindProtobuf.cmake
@@ -30,8 +30,14 @@ if(BUILD_PROTOBUF)
set(Protobuf_LIBRARIES "libprotobuf")
set(HAVE_PROTOBUF TRUE)
else()
+ # we still need this for command PROTOBUF_GENERATE_CPP.
+ set(protobuf_MODULE_COMPATIBLE ON)
+
unset(Protobuf_VERSION CACHE)
- find_package(Protobuf QUIET)
+ find_package(Protobuf QUIET CONFIG)
+ if(NOT Protobuf_FOUND)
+ find_package(Protobuf QUIET)
+ endif()
# Backwards compatibility
# Define camel case versions of input variables
@@ -67,6 +73,20 @@ else()
endif()
endif()
+# See https://github.com/opencv/opencv/issues/24369
+# In Protocol Buffers v22.0 and later drops C++11 support and depends abseil-cpp.
+# Details: https://protobuf.dev/news/2022-08-03/
+# And if std::text_view is in abseil-cpp requests C++17 and later.
+
+if(HAVE_PROTOBUF)
+ if(NOT (Protobuf_VERSION VERSION_LESS 22))
+ if((CMAKE_CXX_STANDARD EQUAL 98) OR (CMAKE_CXX_STANDARD LESS 17))
+ message(STATUS "CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} is too old to support protobuf(${Protobuf_VERSION}) and/or abseil-cpp. Use C++17 or later. Turning HAVE_PROTOBUF off")
+ set(HAVE_PROTOBUF FALSE)
+ endif()
+ endif()
+endif()
+
if(HAVE_PROTOBUF AND PROTOBUF_UPDATE_FILES AND NOT COMMAND PROTOBUF_GENERATE_CPP)
message(FATAL_ERROR "Can't configure protobuf dependency (BUILD_PROTOBUF=${BUILD_PROTOBUF} PROTOBUF_UPDATE_FILES=${PROTOBUF_UPDATE_FILES})")
endif()
@@ -74,15 +94,20 @@ endif()
if(HAVE_PROTOBUF)
list(APPEND CUSTOM_STATUS protobuf)
if(NOT BUILD_PROTOBUF)
+ unset( __location)
if(TARGET "${Protobuf_LIBRARIES}")
get_target_property(__location "${Protobuf_LIBRARIES}" IMPORTED_LOCATION_RELEASE)
if(NOT __location)
get_target_property(__location "${Protobuf_LIBRARIES}" IMPORTED_LOCATION)
endif()
- elseif(Protobuf_LIBRARY)
- set(__location "${Protobuf_LIBRARY}")
- else()
- set(__location "${Protobuf_LIBRARIES}")
+ endif()
+
+ if(NOT __location)
+ if(Protobuf_LIBRARY)
+ set(__location "${Protobuf_LIBRARY}")
+ else()
+ set(__location "${Protobuf_LIBRARIES}")
+ endif()
endif()
endif()
list(APPEND CUSTOM_STATUS_protobuf " Protobuf:"
diff --git a/modules/dnn/CMakeLists.txt b/modules/dnn/CMakeLists.txt
index 804b78ead2..9fcc460909 100644
--- a/modules/dnn/CMakeLists.txt
+++ b/modules/dnn/CMakeLists.txt
@@ -245,6 +245,12 @@ ocv_create_module(${libs} ${dnn_runtime_libs})
ocv_add_samples()
ocv_add_accuracy_tests(${dnn_runtime_libs})
+if(NOT BUILD_PROTOBUF)
+ if(TARGET opencv_test_dnn)
+ ocv_target_compile_definitions(opencv_test_dnn PRIVATE "OPENCV_DNN_EXTERNAL_PROTOBUF=1")
+ endif()
+endif()
+
set(perf_path "${CMAKE_CURRENT_LIST_DIR}/perf")
file(GLOB_RECURSE perf_srcs "${perf_path}/*.cpp")
file(GLOB_RECURSE perf_hdrs "${perf_path}/*.hpp" "${perf_path}/*.h")
diff --git a/modules/dnn/test/test_layers.cpp b/modules/dnn/test/test_layers.cpp
index 763d94b99c..6cb6d54b3f 100644
--- a/modules/dnn/test/test_layers.cpp
+++ b/modules/dnn/test/test_layers.cpp
@@ -756,11 +756,15 @@ TEST_F(Layer_RNN_Test, get_set_test)
TEST_P(Test_Caffe_layers, Accum)
{
+#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF
+ throw SkipTestException("Requires patched protobuf");
+#else
if (backend == DNN_BACKEND_OPENCV && target != DNN_TARGET_CPU)
applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL, CV_TEST_TAG_DNN_SKIP_OPENCL_FP16);
testLayerUsingCaffeModels("accum", false, false, 0.0, 0.0, 2);
testLayerUsingCaffeModels("accum_ref", false, false, 0.0, 0.0, 2);
+#endif
}
TEST_P(Test_Caffe_layers, FlowWarp)
@@ -780,27 +784,39 @@ TEST_P(Test_Caffe_layers, ChannelNorm)
TEST_P(Test_Caffe_layers, DataAugmentation)
{
+#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF
+ throw SkipTestException("Requires patched protobuf");
+#else
if (backend == DNN_BACKEND_OPENCV && target == DNN_TARGET_OPENCL_FP16)
applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL_FP16);
testLayerUsingCaffeModels("data_augmentation", true, false);
testLayerUsingCaffeModels("data_augmentation_2x1", true, false);
testLayerUsingCaffeModels("data_augmentation_8x6", true, false);
+#endif
}
TEST_P(Test_Caffe_layers, Resample)
{
+#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF
+ throw SkipTestException("Requires patched protobuf");
+#else
if (backend != DNN_BACKEND_OPENCV)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH);
testLayerUsingCaffeModels("nearest_2inps", false, false, 0.0, 0.0, 2);
testLayerUsingCaffeModels("nearest", false, false);
+#endif
}
TEST_P(Test_Caffe_layers, Correlation)
{
+#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF
+ throw SkipTestException("Requires patched protobuf");
+#else
if (backend == DNN_BACKEND_OPENCV && target == DNN_TARGET_OPENCL_FP16)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER,
CV_TEST_TAG_DNN_SKIP_OPENCL, CV_TEST_TAG_DNN_SKIP_OPENCL_FP16);
testLayerUsingCaffeModels("correlation", false, false, 0.0, 0.0, 2);
+#endif
}
TEST_P(Test_Caffe_layers, Convolution2Inputs)
@@ -1641,12 +1657,11 @@ private:
int outWidth, outHeight, zoomFactor;
};
-#ifndef OPENCV_DNN_EXTERNAL_PROTOBUF
TEST_P(Test_Caffe_layers, Interp)
-#else
-TEST_P(Test_Caffe_layers, DISABLED_Interp) // requires patched protobuf (available in OpenCV source tree only)
-#endif
{
+#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF
+ throw SkipTestException("Requires patched protobuf");
+#else
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021030000)
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); // exception
@@ -1670,6 +1685,7 @@ TEST_P(Test_Caffe_layers, DISABLED_Interp) // requires patched protobuf (availa
// Test an implemented layer.
testLayerUsingCaffeModels("layer_interp", false, false);
+#endif
}
INSTANTIATE_TEST_CASE_P(/*nothing*/, Test_Caffe_layers, dnnBackendsAndTargets());

View File

@ -1,23 +0,0 @@
# Copyright 2024 Digi International Inc.
#
# Reuse meta-freescale's opencv_4.6.0.imx.bb
#
require recipes-support/opencv/opencv_4.6.0.imx.bb
SRC_URI:remove = "file://0001-Add-missing-header-for-LIBAVCODEC_VERSION_INT.patch"
SRCBRANCH = "4.7.0_imx"
SRCREV_opencv = "3acf6a50fcb4f774728d2338553ad646ccc14b14"
# Update opencv_contrib
SRC_URI:remove = "git://github.com/opencv/opencv_contrib.git;destsuffix=git/contrib;name=contrib;branch=master;protocol=https"
SRC_URI += "git://github.com/opencv/opencv_contrib.git;destsuffix=git/contrib;name=contrib;branch=4.x;protocol=https"
SRCREV_contrib = "e247b680a6bd396f110274b6c214406a93171350"
SRC_URI:remove = "git://github.com/opencv/opencv_extra.git;destsuffix=extra;name=extra;branch=master;protocol=https"
SRC_URI =+ "git://github.com/opencv/opencv_extra.git;destsuffix=extra;name=extra;branch=4.x;protocol=https"
SRCREV_extra = "5abbd7e0546bbb34ae7487170383d3e571fb1dd1"
COMPATIBLE_MACHINE = "(mx9-nxp-bsp)"

View File

@ -0,0 +1,283 @@
# This recipe is for the i.MX fork of opencv. For ease of
# maintenance, the top section is a verbatim copy of an OE-core
# recipe. The second section customizes the recipe for i.MX.
########## meta-openembedded copy ###########
# Upstream hash: b149b1e6a1de2bdea10b0a6de34d5a5bbba4a657
SUMMARY = "Opencv : The Open Computer Vision Library"
HOMEPAGE = "http://opencv.org/"
SECTION = "libs"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
ARM_INSTRUCTION_SET:armv4 = "arm"
ARM_INSTRUCTION_SET:armv5 = "arm"
DEPENDS = "libtool swig-native bzip2 zlib glib-2.0 libwebp"
SRCREV_opencv = "1ea4cc711b46ebd5e676515b5372ab4659c987ea"
SRCREV_contrib = "c7602a8f74205e44389bd6a4e8d727d32e7e27b4"
SRCREV_boostdesc = "34e4206aef44d50e6bbcd0ab06354b52e7466d26"
SRCREV_vgg = "fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d"
SRCREV_face = "8afa57abc8229d611c4937165d20e2a2d9fc5a12"
SRCREV_wechat-qrcode = "a8b69ccc738421293254aec5ddb38bd523503252"
SRCREV_FORMAT = "opencv_contrib_ipp_boostdesc_vgg"
SRC_URI = "git://github.com/opencv/opencv.git;name=opencv;branch=4.x;protocol=https \
git://github.com/opencv/opencv_contrib.git;destsuffix=git/contrib;name=contrib;branch=4.x;protocol=https \
git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_boostdesc_20161012;destsuffix=git/boostdesc;name=boostdesc;protocol=https \
git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_vgg_20160317;destsuffix=git/vgg;name=vgg;protocol=https \
git://github.com/opencv/opencv_3rdparty.git;branch=contrib_face_alignment_20170818;destsuffix=git/face;name=face;protocol=https \
git://github.com/WeChatCV/opencv_3rdparty.git;branch=wechat_qrcode;destsuffix=git/wechat_qrcode;name=wechat-qrcode;protocol=https \
file://0003-To-fix-errors-as-following.patch \
file://0001-Temporarliy-work-around-deprecated-ffmpeg-RAW-functi.patch \
file://0001-Dont-use-isystem.patch \
file://download.patch \
file://0001-Make-ts-module-external.patch \
file://0008-Do-not-embed-build-directory-in-binaries.patch \
"
SRC_URI:append:riscv64 = " file://0001-Use-Os-to-compile-tinyxml2.cpp.patch;patchdir=contrib"
S = "${WORKDIR}/git"
# OpenCV wants to download more files during configure. We download these in
# do_fetch and construct a source cache in the format it expects
OPENCV_DLDIR = "${WORKDIR}/downloads"
do_unpack_extra() {
md5() {
# Return the MD5 of $1
echo $(md5sum $1 | cut -d' ' -f1)
}
cache() {
TAG=$1
shift
mkdir --parents ${OPENCV_DLDIR}/$TAG
for F in $*; do
DEST=${OPENCV_DLDIR}/$TAG/$(md5 $F)-$(basename $F)
test -e $DEST || ln -s $F $DEST
done
}
cache xfeatures2d/boostdesc ${S}/boostdesc/*.i
cache xfeatures2d/vgg ${S}/vgg/*.i
cache data ${S}/face/*.dat
cache wechat_qrcode ${S}/wechat_qrcode/*.caffemodel
cache wechat_qrcode ${S}/wechat_qrcode/*.prototxt
}
addtask unpack_extra after do_unpack before do_patch
CMAKE_VERBOSE = "VERBOSE=1"
EXTRA_OECMAKE = "-DOPENCV_EXTRA_MODULES_PATH=${S}/contrib/modules \
-DWITH_1394=OFF \
-DENABLE_PRECOMPILED_HEADERS=OFF \
-DCMAKE_SKIP_RPATH=ON \
-DWITH_IPP=OFF \
-DOPENCV_GENERATE_PKGCONFIG=ON \
-DOPENCV_DOWNLOAD_PATH=${OPENCV_DLDIR} \
-DOPENCV_ALLOW_DOWNLOADS=OFF \
${@bb.utils.contains("TARGET_CC_ARCH", "-msse3", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1", "", d)} \
${@bb.utils.contains("TARGET_CC_ARCH", "-msse4.1", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1 -DENABLE_SSE41=1", "", d)} \
${@bb.utils.contains("TARGET_CC_ARCH", "-msse4.2", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1 -DENABLE_SSE41=1 -DENABLE_SSE42=1", "", d)} \
"
LDFLAGS:append:mips = " -Wl,--no-as-needed -latomic -Wl,--as-needed"
LDFLAGS:append:riscv32 = " -Wl,--no-as-needed -latomic -Wl,--as-needed"
EXTRA_OECMAKE:append:x86 = " -DX86=ON"
# disable sse4.1 and sse4.2 to fix 32bit build failure
# https://github.com/opencv/opencv/issues/21597
EXTRA_OECMAKE:remove:x86 = " -DENABLE_SSE41=1 -DENABLE_SSE42=1"
PACKAGECONFIG ??= "gapi python3 eigen jpeg png tiff v4l libv4l gstreamer samples tbb gphoto2 \
${@bb.utils.contains("DISTRO_FEATURES", "x11", "gtk", "", d)} \
${@bb.utils.contains_any("LICENSE_FLAGS_ACCEPTED", "commercial_ffmpeg commercial", "libav", "", d)}"
# TBB does not build for powerpc so disable that package config
PACKAGECONFIG:remove:powerpc = "tbb"
# tbb now needs getcontect/setcontext which is not there for all arches on musl
PACKAGECONFIG:remove:libc-musl:riscv64 = "tbb"
PACKAGECONFIG:remove:libc-musl:riscv32 = "tbb"
PACKAGECONFIG[gapi] = "-DWITH_ADE=ON -Dade_DIR=${STAGING_LIBDIR},-DWITH_ADE=OFF,ade"
PACKAGECONFIG[amdblas] = "-DWITH_OPENCLAMDBLAS=ON,-DWITH_OPENCLAMDBLAS=OFF,libclamdblas,"
PACKAGECONFIG[amdfft] = "-DWITH_OPENCLAMDFFT=ON,-DWITH_OPENCLAMDFFT=OFF,libclamdfft,"
PACKAGECONFIG[dnn] = "-DBUILD_opencv_dnn=ON -DPROTOBUF_UPDATE_FILES=ON -DBUILD_PROTOBUF=OFF -DCMAKE_CXX_STANDARD=17,-DBUILD_opencv_dnn=OFF,protobuf protobuf-native,"
PACKAGECONFIG[eigen] = "-DWITH_EIGEN=ON,-DWITH_EIGEN=OFF,libeigen gflags glog,"
PACKAGECONFIG[freetype] = "-DBUILD_opencv_freetype=ON,-DBUILD_opencv_freetype=OFF,freetype,"
PACKAGECONFIG[gphoto2] = "-DWITH_GPHOTO2=ON,-DWITH_GPHOTO2=OFF,libgphoto2,"
PACKAGECONFIG[gstreamer] = "-DWITH_GSTREAMER=ON,-DWITH_GSTREAMER=OFF,gstreamer1.0 gstreamer1.0-plugins-base,"
PACKAGECONFIG[gtk] = "-DWITH_GTK=ON,-DWITH_GTK=OFF,gtk+3,"
PACKAGECONFIG[jasper] = "-DWITH_JASPER=ON,-DWITH_JASPER=OFF,jasper,"
PACKAGECONFIG[java] = "-DJAVA_INCLUDE_PATH=${JAVA_HOME}/include -DJAVA_INCLUDE_PATH2=${JAVA_HOME}/include/linux -DJAVA_AWT_INCLUDE_PATH=${JAVA_HOME}/include -DJAVA_AWT_LIBRARY=${JAVA_HOME}/lib/amd64/libjawt.so -DJAVA_JVM_LIBRARY=${JAVA_HOME}/lib/amd64/server/libjvm.so,,ant-native fastjar-native openjdk-8-native,"
PACKAGECONFIG[jpeg] = "-DWITH_JPEG=ON,-DWITH_JPEG=OFF,jpeg,"
PACKAGECONFIG[libav] = "-DWITH_FFMPEG=ON,-DWITH_FFMPEG=OFF,libav,"
PACKAGECONFIG[libv4l] = "-DWITH_LIBV4L=ON,-DWITH_LIBV4L=OFF,v4l-utils,"
PACKAGECONFIG[opencl] = "-DWITH_OPENCL=ON,-DWITH_OPENCL=OFF,opencl-headers virtual/opencl-icd,"
PACKAGECONFIG[openvino] = "-DWITH_OPENVINO=ON,-DWITH_OPENVINO=OFF,openvino-inference-engine,openvino-inference-engine"
PACKAGECONFIG[oracle-java] = "-DJAVA_INCLUDE_PATH=${ORACLE_JAVA_HOME}/include -DJAVA_INCLUDE_PATH2=${ORACLE_JAVA_HOME}/include/linux -DJAVA_AWT_INCLUDE_PATH=${ORACLE_JAVA_HOME}/include -DJAVA_AWT_LIBRARY=${ORACLE_JAVA_HOME}/lib/amd64/libjawt.so -DJAVA_JVM_LIBRARY=${ORACLE_JAVA_HOME}/lib/amd64/server/libjvm.so,,ant-native oracle-jse-jdk oracle-jse-jdk-native,"
PACKAGECONFIG[png] = "-DWITH_PNG=ON,-DWITH_PNG=OFF,libpng,"
PACKAGECONFIG[python3] = "-DPYTHON3_INCLUDE_PATH=${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI} -DPYTHON3_NUMPY_INCLUDE_DIRS:PATH=${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/numpy/core/include,,python3-numpy,"
PACKAGECONFIG[samples] = "-DBUILD_EXAMPLES=ON -DINSTALL_PYTHON_EXAMPLES=ON,-DBUILD_EXAMPLES=OFF,,"
PACKAGECONFIG[tbb] = "-DWITH_TBB=ON,-DWITH_TBB=OFF,tbb,"
PACKAGECONFIG[tests] = "-DBUILD_TESTS=ON,-DBUILD_TESTS=OFF,,"
PACKAGECONFIG[text] = "-DBUILD_opencv_text=ON,-DBUILD_opencv_text=OFF,tesseract,"
PACKAGECONFIG[tiff] = "-DWITH_TIFF=ON,-DWITH_TIFF=OFF,tiff,"
PACKAGECONFIG[v4l] = "-DWITH_V4L=ON,-DWITH_V4L=OFF,v4l-utils,"
inherit pkgconfig cmake setuptools3-base python3native
export PYTHON_CSPEC="-I${STAGING_INCDIR}/${PYTHON_DIR}"
export ORACLE_JAVA_HOME="${STAGING_DIR_NATIVE}/usr/bin/java"
export JAVA_HOME="${STAGING_DIR_NATIVE}/usr/lib/jvm/openjdk-8-native"
export ANT_DIR="${STAGING_DIR_NATIVE}/usr/share/ant/"
TARGET_CC_ARCH += "-I${S}/include "
PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'samples', '${PN}-samples', '', d)} \
${@bb.utils.contains('PACKAGECONFIG', 'oracle-java', '${PN}-java', '', d)} \
${@bb.utils.contains('PACKAGECONFIG', 'java', '${PN}-java', '', d)} \
${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3-${BPN}', '', d)} \
${PN}-apps"
python populate_packages:prepend () {
cv_libdir = d.expand('${libdir}')
do_split_packages(d, cv_libdir, r'^lib(.*)\.so$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev', allow_links=True)
do_split_packages(d, cv_libdir, r'^lib(.*)\.la$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev')
do_split_packages(d, cv_libdir, r'^lib(.*)\.a$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev')
do_split_packages(d, cv_libdir, r'^lib(.*)\.so\.*', 'lib%s', 'OpenCV %s library', extra_depends='', allow_links=True)
pn = d.getVar('PN')
metapkg = pn + '-dev'
d.setVar('ALLOW_EMPTY:' + metapkg, "1")
blacklist = [ metapkg ]
metapkg_rdepends = [ ]
packages = d.getVar('PACKAGES').split()
for pkg in packages[1:]:
if not pkg in blacklist and not pkg in metapkg_rdepends and pkg.endswith('-dev'):
metapkg_rdepends.append(pkg)
d.setVar('RRECOMMENDS:' + metapkg, ' '.join(metapkg_rdepends))
metapkg = pn
d.setVar('ALLOW_EMPTY:' + metapkg, "1")
blacklist = [ metapkg ]
metapkg_rdepends = [ ]
for pkg in packages[1:]:
if not pkg in blacklist and not pkg in metapkg_rdepends and not pkg.endswith('-dev') and not pkg.endswith('-dbg') and not pkg.endswith('-doc') and not pkg.endswith('-locale') and not pkg.endswith('-staticdev'):
metapkg_rdepends.append(pkg)
d.setVar('RDEPENDS:' + metapkg, ' '.join(metapkg_rdepends))
}
PACKAGES_DYNAMIC += "^libopencv-.*"
FILES:${PN} = ""
FILES:${PN}-dbg += "${datadir}/OpenCV/java/.debug/* ${datadir}/OpenCV/samples/bin/.debug/*"
FILES:${PN}-dev = "${includedir} ${libdir}/pkgconfig ${libdir}/cmake/opencv4/*.cmake"
FILES:${PN}-staticdev += "${libdir}/opencv4/3rdparty/*.a"
FILES:${PN}-apps = "${bindir}/* ${datadir}/opencv4 ${datadir}/licenses"
FILES:${PN}-java = "${datadir}/OpenCV/java"
FILES:${PN}-samples = "${datadir}/opencv4/samples/"
INSANE_SKIP:${PN}-java = "libdir"
INSANE_SKIP:${PN}-dbg = "libdir"
ALLOW_EMPTY:${PN} = "1"
SUMMARY:python3-opencv = "Python bindings to opencv"
FILES:python3-opencv = "${PYTHON_SITEPACKAGES_DIR}/*"
RDEPENDS:python3-opencv = "python3-core python3-numpy"
RDEPENDS:${PN}-apps = "bash"
do_compile:prepend() {
# remove the build host info to improve reproducibility
if [ -f ${WORKDIR}/build/modules/core/version_string.inc ]; then
sed -i "s#${WORKDIR}#/workdir#g" ${WORKDIR}/build/modules/core/version_string.inc
fi
}
do_install:append() {
# Move Python files into correct library folder (for multilib build)
if [ "$libdir" != "/usr/lib" -a -d ${D}/usr/lib ]; then
mv ${D}/usr/lib/* ${D}/${libdir}/
rm -rf ${D}/usr/lib
fi
# remove build host path to improve reproducibility
if [ -f ${D}${libdir}/cmake/opencv4/OpenCVModules.cmake ]; then
sed -e 's@${STAGING_DIR_HOST}@@g' \
-i ${D}${libdir}/cmake/opencv4/OpenCVModules.cmake
fi
# remove setup_vars_opencv4.sh as its content is confusing and useless
if [ -f ${D}${bindir}/setup_vars_opencv4.sh ]; then
rm -rf ${D}${bindir}/setup_vars_opencv4.sh
fi
}
########## End of meta-openembedded copy ##########
########## i.MX overrides ##########
SUMMARY = "Opencv : The Open Computer Vision Library, i.MX Fork"
LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
# Replace the opencv URL with the fork
SRC_URI:remove = "git://github.com/opencv/opencv.git;name=opencv;branch=4.x;protocol=https"
SRC_URI =+ "${OPENCV_SRC};branch=${SRCBRANCH_opencv};name=opencv"
OPENCV_SRC ?= "git://github.com/nxp-imx/opencv-imx.git;protocol=https;branch=master"
SRCBRANCH_opencv = "4.9.0_imx"
SRCREV_opencv = "1ea4cc711b46ebd5e676515b5372ab4659c987ea"
# Add opencv_extra
SRC_URI += " \
git://github.com/opencv/opencv_extra.git;destsuffix=extra;name=extra;branch=4.x;protocol=https \
file://0001-Add-smaller-version-of-download_models.py.patch;patchdir=../extra \
"
SRCREV_FORMAT:append = "_extra"
SRCREV_extra = "7f0ba7adefcbbbe3df7d939f5246ba0382c7c629"
# Patch DNN example
SRC_URI += " \
file://OpenCV_DNN_examples.patch \
"
PACKAGECONFIG:remove = "eigen"
PACKAGECONFIG:append:mx8-nxp-bsp = " dnn text"
PACKAGECONFIG:append:mx9-nxp-bsp = " dnn text"
PACKAGECONFIG:append = " ${PACKAGECONFIG_OPENCL}"
PACKAGECONFIG_OPENCL = ""
PACKAGECONFIG_OPENCL:mx8-nxp-bsp = "opencl"
PACKAGECONFIG_OPENCL:mx8dxl-nxp-bsp = ""
PACKAGECONFIG_OPENCL:mx8mm-nxp-bsp = ""
PACKAGECONFIG_OPENCL:mx8mnlite-nxp-bsp = ""
PACKAGECONFIG_OPENCL:mx8mnul-nxp-bsp = ""
PACKAGECONFIG_OPENCL:mx8mpul-nxp-bsp = ""
PACKAGECONFIG_OPENCL:mx95-nxp-bsp = "opencl"
PACKAGECONFIG[openvx] = "-DWITH_OPENVX=ON -DOPENVX_ROOT=${STAGING_LIBDIR} -DOPENVX_LIB_CANDIDATES='OpenVX;OpenVXU',-DWITH_OPENVX=OFF,virtual/libopenvx,"
PACKAGECONFIG[qt5] = "-DWITH_QT=ON -DOE_QMAKE_PATH_EXTERNAL_HOST_BINS=${STAGING_BINDIR_NATIVE} -DCMAKE_PREFIX_PATH=${STAGING_BINDIR_NATIVE}/cmake,-DWITH_QT=OFF,qtbase qtbase-native,"
PACKAGECONFIG[qt6] = "-DWITH_QT=ON -DQT_HOST_PATH=${RECIPE_SYSROOT_NATIVE}${prefix_native},-DWITH_QT=OFF,qtbase qtbase-native qt5compat,"
PACKAGECONFIG[tests-imx] = "-DINSTALL_TESTS=ON -DOPENCV_TEST_DATA_PATH=${S}/../extra/testdata, -DINSTALL_TESTS=OFF,"
PACKAGECONFIG[tim-vx] = "-DWITH_TIMVX=ON -DTIMVX_INSTALL_DIR=${STAGING_DIR_HOST}${libdir},-DWITH_TIMVX=OFF,tim-vx"
do_install:append() {
ln -sf opencv4/opencv2 ${D}${includedir}/opencv2
install -d ${D}${datadir}/OpenCV/samples/data
cp -r ${S}/samples/data/* ${D}${datadir}/OpenCV/samples/data
install -d ${D}${datadir}/OpenCV/samples/bin/
cp -f bin/example_* ${D}${datadir}/OpenCV/samples/bin/
if ${@bb.utils.contains('PACKAGECONFIG', 'tests-imx', 'true', 'false', d)}; then
cp -r share/opencv4/testdata/cv/face/* ${D}${datadir}/opencv4/testdata/cv/face/
fi
}
FILES:${PN}-samples += "${datadir}/OpenCV/samples"
COMPATIBLE_MACHINE = "(mx8-nxp-bsp|mx9-nxp-bsp)"
########## End of i.MX overrides ##########