added my Recipes

This commit is contained in:
2024-07-11 14:16:35 +02:00
parent 38bc4f53ac
commit 09b621d929
7118 changed files with 525762 additions and 3 deletions

View File

@@ -0,0 +1,20 @@
SUMMARY = "A graph construction, manipulation, and processing framework"
DESCRIPTION = "ADE Framework is a graph construction, manipulation, \
and processing framework. ADE Framework is suitable for \
organizing data flow processing and execution."
HOMEPAGE = "https://github.com/opencv/ade"
SRC_URI = "git://github.com/opencv/ade.git;branch=master;protocol=https"
SRCREV = "1e02d7486bdb9c87993d91b9910e7cc6c4ddbf66"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
inherit cmake
S = "${WORKDIR}/git"
EXTRA_OECMAKE += " -DCMAKE_BUILD_TYPE=Release"
FILES:${PN}-dev += "${datadir}/${BPN}/*.cmake"

View File

@@ -0,0 +1,36 @@
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

@@ -0,0 +1,28 @@
From 66e50ee69fa9ee2469d349100e70d8b296c4b4dc 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
clang really does not like it
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
cmake/OpenCVPCHSupport.cmake | 2 ++
1 file changed, 2 insertions(+)
diff --git a/cmake/OpenCVPCHSupport.cmake b/cmake/OpenCVPCHSupport.cmake
index 08cd06def4..46c9c02da3 100644
--- a/cmake/OpenCVPCHSupport.cmake
+++ b/cmake/OpenCVPCHSupport.cmake
@@ -18,6 +18,8 @@ IF(CV_GCC)
SET(PCHSupport_FOUND TRUE)
ENDIF()
+ SET(CMAKE_INCLUDE_SYSTEM_FLAG_C "-I")
+ SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-I")
SET(_PCH_include_prefix "-I")
SET(_PCH_isystem_prefix "-isystem")
SET(_PCH_define_prefix "-D")

View File

@@ -0,0 +1,42 @@
From 11bbf909e08594628bd757d989ae34cf1bfe200b 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
Make ts module external
Reference: https://github.com/qbonnard/opencv/commit/6b229c5834cb9a0930425e762a6c7b03244d7abb
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
--- 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)
ocv_module_disable(ts)
endif()
-set(OPENCV_MODULE_TYPE STATIC)
-set(OPENCV_MODULE_IS_PART_OF_WORLD FALSE)
-
if(WINRT)
# WINRT doesn't have access to environment variables
# so adding corresponding macros during CMake run
@@ -16,7 +13,7 @@ endif()
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef)
-ocv_add_module(ts INTERNAL opencv_core opencv_imgproc opencv_imgcodecs opencv_videoio opencv_highgui)
+ocv_add_module(ts opencv_core opencv_imgproc opencv_imgcodecs opencv_videoio opencv_highgui)
ocv_glob_module_sources()
ocv_module_include_directories()
--
2.24.1

View File

@@ -0,0 +1,31 @@
From e4ec6cea72da9e9ae5ba57140fa2f5c63f1f8295 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
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
---
modules/videoio/src/cap_ffmpeg_impl.hpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/modules/videoio/src/cap_ffmpeg_impl.hpp b/modules/videoio/src/cap_ffmpeg_impl.hpp
index 6dca724a89..ae55dd4555 100644
--- a/modules/videoio/src/cap_ffmpeg_impl.hpp
+++ b/modules/videoio/src/cap_ffmpeg_impl.hpp
@@ -774,6 +774,14 @@ struct ImplMutex::Impl
#endif
+/* NOTE This is deprecated in ffmpeg and the code should be removed */
+#ifndef AVFMT_RAWPICTURE
+#define AVFMT_RAWPICTURE 0x0020
+#endif /* AVFMT_RAWPICTURE */
+#ifndef CODEC_FLAG_GLOBAL_HEADER
+#define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER
+#endif
+
void ImplMutex::init()
{
impl = new Impl();

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

@@ -0,0 +1,70 @@
From f42c9b8c7bafcadc7e95fb25a391707f970eb426 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:
"test_main.cpp:45: undefined reference to `parseCustomOptions(int, char**)'"
"perf_abs.cpp:13: undefined reference to `cvtest::param_seed'"
"test_superres.cpp:270: undefined reference to `checkIppStatus()'"
Signed-off-by: Huang Qiyu <huangqy.fnst@cn.fujitsu.com>
Also add the visibility changes for certain OpenCL-related functions in
ts module.
Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
---
modules/ts/include/opencv2/ts.hpp | 4 ++--
modules/ts/include/opencv2/ts/ocl_test.hpp | 2 +-
modules/ts/include/opencv2/ts/ts_ext.hpp | 2 +-
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
--- a/modules/ts/include/opencv2/ts.hpp
+++ b/modules/ts/include/opencv2/ts.hpp
@@ -728,7 +728,7 @@ protected:
}
};
-extern uint64 param_seed;
+CV_EXPORTS extern uint64 param_seed;
struct DefaultRngAuto
{
@@ -791,7 +791,7 @@ private:
#endif
#endif
-void parseCustomOptions(int argc, char **argv);
+CV_EXPORTS void parseCustomOptions(int argc, char **argv);
#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
--- 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)
return dst;
}
-extern int test_loop_times;
+CV_EXPORTS extern int test_loop_times;
#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
--- a/modules/ts/include/opencv2/ts/ts_ext.hpp
+++ b/modules/ts/include/opencv2/ts/ts_ext.hpp
@@ -9,7 +9,7 @@
#define OPENCV_TS_EXT_HPP
namespace cvtest {
-void checkIppStatus();
+CV_EXPORTS void checkIppStatus();
extern bool skipUnstableTests;
extern bool runBigDataTests;
extern int testThreads;

View File

@@ -0,0 +1,138 @@
From: Victor Westerhuis <victor@westerhu.is>
Date: Sat, 19 Nov 2022 21:45:39 +0100
Subject: 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 b78bb98..d96b669 100644
--- a/modules/core/CMakeLists.txt
+++ b/modules/core/CMakeLists.txt
@@ -188,16 +188,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 146d37f..dd675bc 100644
--- a/modules/core/include/opencv2/core/private.hpp
+++ b/modules/core/include/opencv2/core/private.hpp
@@ -818,10 +818,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 108c0d9..f15d9ea 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 3af83a5..6bda857 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

@@ -0,0 +1,88 @@
commit ccc277247ac1a7aef0a90353edcdec35fbc5903c
Author: Nano <nanoapezlk@gmail.com>
Date: Wed Apr 26 15:09:52 2023 +0800
fix(wechat_qrcode): Init nBytes after the count value is determined (#3480)
* fix(wechat_qrcode): Initialize nBytes after the count value is determined
* fix(wechat_qrcode): Incorrect count data repair
* chore: format expr
* fix(wechat_qrcode): Avoid null pointer exception
* fix(wechat_qrcode): return when bytes_ is empty
* test(wechat_qrcode): add test case
---------
Co-authored-by: GZTime <Time.GZ@outlook.com>
CVE: CVE-2023-2617
Upstream-Status: Backport [https://github.com/opencv/opencv_contrib/commit/ccc277247ac1a7aef0a90353edcdec35fbc5903c]
Signed-off-by: Soumya <soumya.sambu@windriver.com>
---
diff --git a/modules/wechat_qrcode/src/zxing/qrcode/decoder/decoded_bit_stream_parser.cpp b/modules/wechat_qrcode/src/zxing/qrcode/decoder/decoded_bit_stream_parser.cpp
index 05de793c..b3a0a69c 100644
--- a/modules/wechat_qrcode/src/zxing/qrcode/decoder/decoded_bit_stream_parser.cpp
+++ b/modules/wechat_qrcode/src/zxing/qrcode/decoder/decoded_bit_stream_parser.cpp
@@ -65,7 +65,8 @@ void DecodedBitStreamParser::append(std::string& result, string const& in,
void DecodedBitStreamParser::append(std::string& result, const char* bufIn, size_t nIn,
ErrorHandler& err_handler) {
- if (err_handler.ErrCode()) return;
+ // avoid null pointer exception
+ if (err_handler.ErrCode() || bufIn == nullptr) return;
#ifndef NO_ICONV_INSIDE
if (nIn == 0) {
return;
@@ -190,16 +191,20 @@ void DecodedBitStreamParser::decodeByteSegment(Ref<BitSource> bits_, string& res
CharacterSetECI* currentCharacterSetECI,
ArrayRef<ArrayRef<char> >& byteSegments,
ErrorHandler& err_handler) {
- int nBytes = count;
BitSource& bits(*bits_);
// Don't crash trying to read more bits than we have available.
int available = bits.available();
// try to repair count data if count data is invalid
if (count * 8 > available) {
- count = (available + 7 / 8);
+ count = (available + 7) / 8;
}
+ size_t nBytes = count;
+
+ ArrayRef<char> bytes_(nBytes);
+ // issue https://github.com/opencv/opencv_contrib/issues/3478
+ if (bytes_->empty())
+ return;
- ArrayRef<char> bytes_(count);
char* readBytes = &(*bytes_)[0];
for (int i = 0; i < count; i++) {
// readBytes[i] = (char) bits.readBits(8);
diff --git a/modules/wechat_qrcode/test/test_qrcode.cpp b/modules/wechat_qrcode/test/test_qrcode.cpp
index d59932b8..ec2559b0 100644
--- a/modules/wechat_qrcode/test/test_qrcode.cpp
+++ b/modules/wechat_qrcode/test/test_qrcode.cpp
@@ -455,5 +455,16 @@ TEST_P(Objdetect_QRCode_Easy_Multi, regression) {
std::string qrcode_model_path[] = {"", "dnn/wechat_2021-01"};
INSTANTIATE_TEST_CASE_P(/**/, Objdetect_QRCode_Easy_Multi, testing::ValuesIn(qrcode_model_path));
+TEST(Objdetect_QRCode_bug, issue_3478) {
+ auto detector = wechat_qrcode::WeChatQRCode();
+ std::string image_path = findDataFile("qrcode/issue_3478.png");
+ Mat src = imread(image_path, IMREAD_GRAYSCALE);
+ ASSERT_FALSE(src.empty()) << "Can't read image: " << image_path;
+ std::vector<std::string> outs = detector.detectAndDecode(src);
+ ASSERT_EQ(1, (int) outs.size());
+ ASSERT_EQ(16, (int) outs[0].size());
+ ASSERT_EQ("KFCVW50 ", outs[0]);
+}
+
} // namespace
} // namespace opencv_test

View File

@@ -0,0 +1,41 @@
From b18a280fab06a680d9f831bf8b462647f3cb6214 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
This CMake module will download files during do_configure. This is bad as it
means we can't do offline builds.
Add an option to disallow downloads by emitting a fatal error.
Upstream-Status: Pending
Signed-off-by: Ross Burton <ross.burton@intel.com>
---
cmake/OpenCVDownload.cmake | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/cmake/OpenCVDownload.cmake b/cmake/OpenCVDownload.cmake
index 63cf6d3238..4acf477f70 100644
--- a/cmake/OpenCVDownload.cmake
+++ b/cmake/OpenCVDownload.cmake
@@ -14,6 +14,7 @@
# RELATIVE_URL - if set, then URL is treated as a base, and FILENAME will be appended to it
# Note: uses OPENCV_DOWNLOAD_PATH folder as cache, default is <opencv>/.cache
+set(OPENCV_ALLOW_DOWNLOADS ON CACHE BOOL "Allow downloads")
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)
# Download
if(NOT EXISTS "${CACHE_CANDIDATE}")
+ if(NOT OPENCV_ALLOW_DOWNLOADS)
+ message(FATAL_ERROR "Not going to download ${DL_FILENAME}")
+ return()
+ endif()
+
ocv_download_log("#cmake_download \"${CACHE_CANDIDATE}\" \"${DL_URL}\"")
foreach(try ${OPENCV_DOWNLOAD_TRIES_LIST})
ocv_download_log("#try ${try}")

View File

@@ -0,0 +1,221 @@
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 = "725e440d278aca07d35a5e8963ef990572b07316"
SRCREV_contrib = "e247b680a6bd396f110274b6c214406a93171350"
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=master;protocol=https \
git://github.com/opencv/opencv_contrib.git;destsuffix=git/contrib;name=contrib;branch=master;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 \
file://CVE-2023-2617.patch;patchdir=contrib \
"
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,-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[python2] = "-DPYTHON2_NUMPY_INCLUDE_DIRS:PATH=${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/numpy/core/include,,python-numpy,"
PACKAGECONFIG[python3] = "-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
inherit ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'setuptools3-base', '', d)}
inherit ${@bb.utils.contains('PACKAGECONFIG', 'python2', 'distutils-base', '', d)}
export PYTHON_CSPEC="-I${STAGING_INCDIR}/${PYTHON_DIR}"
export PYTHON="${STAGING_BINDIR_NATIVE}/${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3', 'python', d)}"
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', 'python2', 'python-${BPN}', '', 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:python-opencv = "Python bindings to opencv"
FILES:python-opencv = "${PYTHON_SITEPACKAGES_DIR}/*"
RDEPENDS:python-opencv = "python-core python-numpy"
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
}