summaryrefslogtreecommitdiffstats
path: root/recipes-support
diff options
context:
space:
mode:
authorChris Dimich <Chris.Dimich@boundarydevices.com>2021-03-01 16:27:43 -0800
committerOtavio Salvador <otavio@ossystems.com.br>2021-03-02 18:34:38 -0300
commitdc6bebac65d3733548de568f31ca5bfbf9e8a8a5 (patch)
tree3f3fa5ca7fb86aae9e04850f6fe781086e1e0d7c /recipes-support
parent9de81869018e78b8b861513735b85c2dbc33ca0b (diff)
downloadmeta-freescale-dc6bebac65d3733548de568f31ca5bfbf9e8a8a5.tar.gz
opencv_4.4.0.imx: add recipe
Add recipe to support additional machine learning demos and tiny dnn. Signed-off-by: Chris Dimich <Chris.Dimich@boundarydevices.com>
Diffstat (limited to 'recipes-support')
-rw-r--r--recipes-support/opencv/opencv/0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch36
-rw-r--r--recipes-support/opencv/opencv/0001-Add-smaller-version-of-download_models.py.patch179
-rw-r--r--recipes-support/opencv/opencv/0001-Dont-use-isystem.patch28
-rw-r--r--recipes-support/opencv/opencv/0001-Make-ts-module-external.patch42
-rw-r--r--recipes-support/opencv/opencv/0001-Temporarliy-work-around-deprecated-ffmpeg-RAW-functi.patch31
-rw-r--r--recipes-support/opencv/opencv/0001-Use-Os-to-compile-tinyxml2.cpp.patch31
-rw-r--r--recipes-support/opencv/opencv/0003-To-fix-errors-as-following.patch70
-rw-r--r--recipes-support/opencv/opencv/OpenCV_DNN_examples.patch148
-rw-r--r--recipes-support/opencv/opencv/download.patch41
-rw-r--r--recipes-support/opencv/opencv_4.4.0.imx.bb295
10 files changed, 901 insertions, 0 deletions
diff --git a/recipes-support/opencv/opencv/0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch b/recipes-support/opencv/opencv/0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch
new file mode 100644
index 00000000..9e6a6137
--- /dev/null
+++ b/recipes-support/opencv/opencv/0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch
@@ -0,0 +1,36 @@
1From 9b4959b97d2e95d4b49cf6ca2a3fce3cdb484f2d Mon Sep 17 00:00:00 2001
2From: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
3Date: Thu, 31 Mar 2016 00:20:15 +0200
4Subject: [PATCH] 3rdparty/ippicv: Use pre-downloaded ipp
5
6Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
7Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
8
9---
10 3rdparty/ippicv/ippicv.cmake | 15 +--------------
11 1 file changed, 1 insertion(+), 14 deletions(-)
12
13diff --git a/3rdparty/ippicv/ippicv.cmake b/3rdparty/ippicv/ippicv.cmake
14index 257af6fcc6..f88460450f 100644
15--- a/3rdparty/ippicv/ippicv.cmake
16+++ b/3rdparty/ippicv/ippicv.cmake
17@@ -34,18 +34,5 @@ function(download_ippicv root_var)
18 endif()
19
20 set(THE_ROOT "${OpenCV_BINARY_DIR}/3rdparty/ippicv")
21- ocv_download(FILENAME ${OPENCV_ICV_NAME}
22- HASH ${OPENCV_ICV_HASH}
23- URL
24- "${OPENCV_IPPICV_URL}"
25- "$ENV{OPENCV_IPPICV_URL}"
26- "https://raw.githubusercontent.com/opencv/opencv_3rdparty/${IPPICV_COMMIT}/ippicv/"
27- DESTINATION_DIR "${THE_ROOT}"
28- ID IPPICV
29- STATUS res
30- UNPACK RELATIVE_URL)
31-
32- if(res)
33- set(${root_var} "${THE_ROOT}/${OPENCV_ICV_PACKAGE_SUBDIR}" PARENT_SCOPE)
34- endif()
35+ set(${root_var} "${THE_ROOT}/${OPENCV_ICV_PACKAGE_SUBDIR}" PARENT_SCOPE)
36 endfunction()
diff --git a/recipes-support/opencv/opencv/0001-Add-smaller-version-of-download_models.py.patch b/recipes-support/opencv/opencv/0001-Add-smaller-version-of-download_models.py.patch
new file mode 100644
index 00000000..0aabee29
--- /dev/null
+++ b/recipes-support/opencv/opencv/0001-Add-smaller-version-of-download_models.py.patch
@@ -0,0 +1,179 @@
1From fca4d9eec289f22c081daa2c61a1110e3f268f92 Mon Sep 17 00:00:00 2001
2From: Tom Hochstein <tom.hochstein@nxp.com>
3Date: Tue, 1 Sep 2020 14:57:07 -0500
4Subject: [PATCH] Add smaller version of download_models.py
5
6Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
7---
8 testdata/dnn/download_models_basic.py | 159 ++++++++++++++++++++++++++
9 1 file changed, 159 insertions(+)
10 create mode 100644 testdata/dnn/download_models_basic.py
11
12diff --git a/testdata/dnn/download_models_basic.py b/testdata/dnn/download_models_basic.py
13new file mode 100644
14index 0000000..5c8a616
15--- /dev/null
16+++ b/testdata/dnn/download_models_basic.py
17@@ -0,0 +1,159 @@
18+#!/usr/bin/env python
19+
20+from __future__ import print_function
21+import hashlib
22+import sys
23+import tarfile
24+if sys.version_info[0] < 3:
25+ from urllib2 import urlopen
26+else:
27+ from urllib.request import urlopen
28+
29+
30+class Model:
31+ MB = 1024*1024
32+ BUFSIZE = 10*MB
33+
34+ def __init__(self, **kwargs):
35+ self.name = kwargs.pop('name')
36+ self.url = kwargs.pop('url', None)
37+ self.filename = kwargs.pop('filename')
38+ self.sha = kwargs.pop('sha', None)
39+ self.archive = kwargs.pop('archive', None)
40+ self.member = kwargs.pop('member', None)
41+
42+ def __str__(self):
43+ return 'Model <{}>'.format(self.name)
44+
45+ def printRequest(self, r):
46+ def getMB(r):
47+ d = dict(r.info())
48+ for c in ['content-length', 'Content-Length']:
49+ if c in d:
50+ return int(d[c]) / self.MB
51+ return '<unknown>'
52+ print(' {} {} [{} Mb]'.format(r.getcode(), r.msg, getMB(r)))
53+
54+ def verify(self):
55+ if not self.sha:
56+ return False
57+ print(' expect {}'.format(self.sha))
58+ sha = hashlib.sha1()
59+ try:
60+ with open(self.filename, 'rb') as f:
61+ while True:
62+ buf = f.read(self.BUFSIZE)
63+ if not buf:
64+ break
65+ sha.update(buf)
66+ print(' actual {}'.format(sha.hexdigest()))
67+ return self.sha == sha.hexdigest()
68+ except Exception as e:
69+ print(' catch {}'.format(e))
70+
71+ def get(self):
72+ if self.verify():
73+ print(' hash match - skipping')
74+ return True
75+
76+ if self.archive or self.member:
77+ assert(self.archive and self.member)
78+ print(' hash check failed - extracting')
79+ print(' get {}'.format(self.member))
80+ self.extract()
81+ else:
82+ assert(self.url)
83+ print(' hash check failed - downloading')
84+ print(' get {}'.format(self.url))
85+ self.download()
86+
87+ print(' done')
88+ print(' file {}'.format(self.filename))
89+ return self.verify()
90+
91+ def download(self):
92+ try:
93+ r = urlopen(self.url, timeout=60)
94+ self.printRequest(r)
95+ self.save(r)
96+ except Exception as e:
97+ print(' catch {}'.format(e))
98+
99+ def extract(self):
100+ try:
101+ with tarfile.open(self.archive) as f:
102+ assert self.member in f.getnames()
103+ self.save(f.extractfile(self.member))
104+ except Exception as e:
105+ print(' catch {}'.format(e))
106+
107+ def save(self, r):
108+ with open(self.filename, 'wb') as f:
109+ print(' progress ', end='')
110+ sys.stdout.flush()
111+ while True:
112+ buf = r.read(self.BUFSIZE)
113+ if not buf:
114+ break
115+ f.write(buf)
116+ print('>', end='')
117+ sys.stdout.flush()
118+
119+models = [
120+ Model(
121+ name='Fcn',
122+ url='http://dl.caffe.berkeleyvision.org/fcn8s-heavy-pascal.caffemodel',
123+ sha='c449ea74dd7d83751d1357d6a8c323fcf4038962',
124+ filename='fcn8s-heavy-pascal.caffemodel'),
125+ Model(
126+ name='SqueezeNet_v1.1',
127+ url='https://raw.githubusercontent.com/DeepScale/SqueezeNet/b5c3f1a23713c8b3fd7b801d229f6b04c64374a5/SqueezeNet_v1.1/squeezenet_v1.1.caffemodel',
128+ sha='3397f026368a45ae236403ccc81cfcbe8ebe1bd0',
129+ filename='squeezenet_v1.1.caffemodel'),
130+ Model(
131+ name='Colorization',
132+ url='https://raw.githubusercontent.com/richzhang/colorization/master/models/colorization_deploy_v2.prototxt',
133+ sha='f528334e386a69cbaaf237a7611d833bef8e5219',
134+ filename='colorization_deploy_v2.prototxt'),
135+ Model(
136+ name='Colorization',
137+ url='http://eecs.berkeley.edu/~rich.zhang/projects/2016_colorization/files/demo_v2/colorization_release_v2.caffemodel',
138+ sha='21e61293a3fa6747308171c11b6dd18a68a26e7f',
139+ filename='colorization_release_v2.caffemodel'),
140+ Model(
141+ name='OpenPose/pose/coco', # https://github.com/CMU-Perceptual-Computing-Lab/openpose
142+ url='http://posefs1.perception.cs.cmu.edu/OpenPose/models/pose/coco/pose_iter_440000.caffemodel',
143+ sha='ac7e97da66f3ab8169af2e601384c144e23a95c1',
144+ filename='openpose_pose_coco.caffemodel'),
145+ Model(
146+ name='YOLOv3', # https://pjreddie.com/darknet/yolo/
147+ url='https://pjreddie.com/media/files/yolov3.weights',
148+ sha='520878f12e97cf820529daea502acca380f1cb8e',
149+ filename='yolov3.weights'),
150+ Model(
151+ name='EAST', # https://github.com/argman/EAST (a TensorFlow model), https://arxiv.org/abs/1704.03155v2 (a paper)
152+ url='https://www.dropbox.com/s/r2ingd0l3zt8hxs/frozen_east_text_detection.tar.gz?dl=1',
153+ sha='3ca8233d6edd748f7ed23246c8ca24cbf696bb94',
154+ filename='frozen_east_text_detection.tar.gz'),
155+ Model(
156+ name='EAST',
157+ archive='frozen_east_text_detection.tar.gz',
158+ member='frozen_east_text_detection.pb',
159+ sha='fffabf5ac36f37bddf68e34e84b45f5c4247ed06',
160+ filename='frozen_east_text_detection.pb'),
161+]
162+
163+# Note: models will be downloaded to current working directory
164+# expected working directory is opencv_extra/testdata/dnn
165+if __name__ == '__main__':
166+ failedModels = []
167+ for m in models:
168+ print(m)
169+ if not m.get():
170+ failedModels.append(m.filename)
171+
172+ if failedModels:
173+ print("Following models have not been downloaded:")
174+ for f in failedModels:
175+ print("* {}".format(f))
176+ exit(15)
177--
1782.17.1
179
diff --git a/recipes-support/opencv/opencv/0001-Dont-use-isystem.patch b/recipes-support/opencv/opencv/0001-Dont-use-isystem.patch
new file mode 100644
index 00000000..948a80fa
--- /dev/null
+++ b/recipes-support/opencv/opencv/0001-Dont-use-isystem.patch
@@ -0,0 +1,28 @@
1From 66e50ee69fa9ee2469d349100e70d8b296c4b4dc Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 11 Sep 2018 00:21:18 -0700
4Subject: [PATCH] Dont use isystem
5
6clang really does not like it
7
8Upstream-Status: Pending
9
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11
12---
13 cmake/OpenCVPCHSupport.cmake | 2 ++
14 1 file changed, 2 insertions(+)
15
16diff --git a/cmake/OpenCVPCHSupport.cmake b/cmake/OpenCVPCHSupport.cmake
17index 08cd06def4..46c9c02da3 100644
18--- a/cmake/OpenCVPCHSupport.cmake
19+++ b/cmake/OpenCVPCHSupport.cmake
20@@ -18,6 +18,8 @@ IF(CV_GCC)
21 SET(PCHSupport_FOUND TRUE)
22 ENDIF()
23
24+ SET(CMAKE_INCLUDE_SYSTEM_FLAG_C "-I")
25+ SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-I")
26 SET(_PCH_include_prefix "-I")
27 SET(_PCH_isystem_prefix "-isystem")
28 SET(_PCH_define_prefix "-D")
diff --git a/recipes-support/opencv/opencv/0001-Make-ts-module-external.patch b/recipes-support/opencv/opencv/0001-Make-ts-module-external.patch
new file mode 100644
index 00000000..d56b8ae6
--- /dev/null
+++ b/recipes-support/opencv/opencv/0001-Make-ts-module-external.patch
@@ -0,0 +1,42 @@
1From 11bbf909e08594628bd757d989ae34cf1bfe200b Mon Sep 17 00:00:00 2001
2From: Mingli Yu <mingli.yu@windriver.com>
3Date: Thu, 18 Jun 2020 05:51:38 +0000
4Subject: [PATCH] Make ts module external
5
6Make ts module external
7
8Reference: https://github.com/qbonnard/opencv/commit/6b229c5834cb9a0930425e762a6c7b03244d7abb
9
10Upstream-Status: Submitted [https://github.com/opencv/opencv/issues/8408]
11
12Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
13---
14 modules/ts/CMakeLists.txt | 5 +----
15 1 file changed, 1 insertion(+), 4 deletions(-)
16
17diff --git a/modules/ts/CMakeLists.txt b/modules/ts/CMakeLists.txt
18index f95bed0793..66f315bcca 100644
19--- a/modules/ts/CMakeLists.txt
20+++ b/modules/ts/CMakeLists.txt
21@@ -4,9 +4,6 @@ if(NOT BUILD_opencv_ts AND NOT BUILD_TESTS AND NOT BUILD_PERF_TESTS)
22 ocv_module_disable(ts)
23 endif()
24
25-set(OPENCV_MODULE_TYPE STATIC)
26-set(OPENCV_MODULE_IS_PART_OF_WORLD FALSE)
27-
28 if(WINRT)
29 # WINRT doesn't have access to environment variables
30 # so adding corresponding macros during CMake run
31@@ -16,7 +13,7 @@ endif()
32
33 ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef)
34
35-ocv_add_module(ts INTERNAL opencv_core opencv_imgproc opencv_imgcodecs opencv_videoio opencv_highgui)
36+ocv_add_module(ts opencv_core opencv_imgproc opencv_imgcodecs opencv_videoio opencv_highgui)
37
38 ocv_glob_module_sources()
39 ocv_module_include_directories()
40--
412.24.1
42
diff --git a/recipes-support/opencv/opencv/0001-Temporarliy-work-around-deprecated-ffmpeg-RAW-functi.patch b/recipes-support/opencv/opencv/0001-Temporarliy-work-around-deprecated-ffmpeg-RAW-functi.patch
new file mode 100644
index 00000000..1e47f8b1
--- /dev/null
+++ b/recipes-support/opencv/opencv/0001-Temporarliy-work-around-deprecated-ffmpeg-RAW-functi.patch
@@ -0,0 +1,31 @@
1From e4ec6cea72da9e9ae5ba57140fa2f5c63f1f8295 Mon Sep 17 00:00:00 2001
2From: Jason Wessel <jason.wessel@windriver.com>
3Date: Wed, 9 May 2018 13:33:59 -0700
4Subject: [PATCH] Temporarliy work around deprecated ffmpeg RAW function
5 compile failure until next uprev
6
7Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
8
9---
10 modules/videoio/src/cap_ffmpeg_impl.hpp | 8 ++++++++
11 1 file changed, 8 insertions(+)
12
13diff --git a/modules/videoio/src/cap_ffmpeg_impl.hpp b/modules/videoio/src/cap_ffmpeg_impl.hpp
14index 6dca724a89..ae55dd4555 100644
15--- a/modules/videoio/src/cap_ffmpeg_impl.hpp
16+++ b/modules/videoio/src/cap_ffmpeg_impl.hpp
17@@ -774,6 +774,14 @@ struct ImplMutex::Impl
18
19 #endif
20
21+/* NOTE This is deprecated in ffmpeg and the code should be removed */
22+#ifndef AVFMT_RAWPICTURE
23+#define AVFMT_RAWPICTURE 0x0020
24+#endif /* AVFMT_RAWPICTURE */
25+#ifndef CODEC_FLAG_GLOBAL_HEADER
26+#define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER
27+#endif
28+
29 void ImplMutex::init()
30 {
31 impl = new Impl();
diff --git a/recipes-support/opencv/opencv/0001-Use-Os-to-compile-tinyxml2.cpp.patch b/recipes-support/opencv/opencv/0001-Use-Os-to-compile-tinyxml2.cpp.patch
new file mode 100644
index 00000000..c5a64387
--- /dev/null
+++ b/recipes-support/opencv/opencv/0001-Use-Os-to-compile-tinyxml2.cpp.patch
@@ -0,0 +1,31 @@
1From 59fafe6e39759e193b5764b36b4c5a93da352123 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 18 Aug 2020 00:36:49 -0700
4Subject: [PATCH] Use -Os to compile tinyxml2.cpp
5
6This workarounds issue [1] seen on riscv with gcc
7
8[1] https://github.com/riscv/riscv-gnu-toolchain/issues/624
9
10Upstream-Status: Inappropriate [ OE-Specific ]
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 modules/datasets/CMakeLists.txt | 2 +-
14 1 file changed, 1 insertion(+), 1 deletion(-)
15
16diff --git a/modules/datasets/CMakeLists.txt b/modules/datasets/CMakeLists.txt
17index 56ca9e310..99b7a33f6 100644
18--- a/modules/datasets/CMakeLists.txt
19+++ b/modules/datasets/CMakeLists.txt
20@@ -2,7 +2,7 @@ set(the_description "datasets framework")
21
22 set(filter_srcs "${CMAKE_CURRENT_LIST_DIR}/src/tinyxml2/tinyxml2.cpp")
23 if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
24- ocv_append_source_files_cxx_compiler_options(filter_srcs "-Wno-suggest-override") # GCC
25+ ocv_append_source_files_cxx_compiler_options(filter_srcs "-Wno-suggest-override -Os") # GCC
26 elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
27 ocv_append_source_files_cxx_compiler_options(filter_srcs "-Wno-inconsistent-missing-override") # Clang
28 endif()
29--
302.28.0
31
diff --git a/recipes-support/opencv/opencv/0003-To-fix-errors-as-following.patch b/recipes-support/opencv/opencv/0003-To-fix-errors-as-following.patch
new file mode 100644
index 00000000..bb47ef2b
--- /dev/null
+++ b/recipes-support/opencv/opencv/0003-To-fix-errors-as-following.patch
@@ -0,0 +1,70 @@
1From f42c9b8c7bafcadc7e95fb25a391707f970eb426 Mon Sep 17 00:00:00 2001
2From: Huang Qiyu <huangqy.fnst@cn.fujitsu.com>
3Date: Fri, 19 May 2017 04:27:50 +0900
4Subject: [PATCH] To fix errors as following:
5
6"test_main.cpp:45: undefined reference to `parseCustomOptions(int, char**)'"
7"perf_abs.cpp:13: undefined reference to `cvtest::param_seed'"
8"test_superres.cpp:270: undefined reference to `checkIppStatus()'"
9
10Signed-off-by: Huang Qiyu <huangqy.fnst@cn.fujitsu.com>
11
12Also add the visibility changes for certain OpenCL-related functions in
13ts module.
14
15Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
16
17---
18 modules/ts/include/opencv2/ts.hpp | 4 ++--
19 modules/ts/include/opencv2/ts/ocl_test.hpp | 2 +-
20 modules/ts/include/opencv2/ts/ts_ext.hpp | 2 +-
21 3 files changed, 4 insertions(+), 4 deletions(-)
22
23diff --git a/modules/ts/include/opencv2/ts.hpp b/modules/ts/include/opencv2/ts.hpp
24index ed7491a89a..80919d13ee 100644
25--- a/modules/ts/include/opencv2/ts.hpp
26+++ b/modules/ts/include/opencv2/ts.hpp
27@@ -728,7 +728,7 @@ protected:
28 }
29 };
30
31-extern uint64 param_seed;
32+CV_EXPORTS extern uint64 param_seed;
33
34 struct DefaultRngAuto
35 {
36@@ -791,7 +791,7 @@ private:
37 #endif
38 #endif
39
40-void parseCustomOptions(int argc, char **argv);
41+CV_EXPORTS void parseCustomOptions(int argc, char **argv);
42
43 #define CV_TEST_INIT0_NOOP (void)0
44
45diff --git a/modules/ts/include/opencv2/ts/ocl_test.hpp b/modules/ts/include/opencv2/ts/ocl_test.hpp
46index 11572e9f48..438112e2aa 100644
47--- a/modules/ts/include/opencv2/ts/ocl_test.hpp
48+++ b/modules/ts/include/opencv2/ts/ocl_test.hpp
49@@ -82,7 +82,7 @@ inline UMat ToUMat(InputArray src)
50 return dst;
51 }
52
53-extern int test_loop_times;
54+CV_EXPORTS extern int test_loop_times;
55
56 #define MAX_VALUE 357
57
58diff --git a/modules/ts/include/opencv2/ts/ts_ext.hpp b/modules/ts/include/opencv2/ts/ts_ext.hpp
59index b2a4cac241..b94c681c0c 100644
60--- a/modules/ts/include/opencv2/ts/ts_ext.hpp
61+++ b/modules/ts/include/opencv2/ts/ts_ext.hpp
62@@ -9,7 +9,7 @@
63 #define OPENCV_TS_EXT_HPP
64
65 namespace cvtest {
66-void checkIppStatus();
67+CV_EXPORTS void checkIppStatus();
68 extern bool skipUnstableTests;
69 extern bool runBigDataTests;
70 extern int testThreads;
diff --git a/recipes-support/opencv/opencv/OpenCV_DNN_examples.patch b/recipes-support/opencv/opencv/OpenCV_DNN_examples.patch
new file mode 100644
index 00000000..569d5b02
--- /dev/null
+++ b/recipes-support/opencv/opencv/OpenCV_DNN_examples.patch
@@ -0,0 +1,148 @@
1From 3c4daafb54f961e376104a461ca7ec114ff0331a Mon Sep 17 00:00:00 2001
2From: Ludek Slosarcik <ludek.slosarcik@nxp.com>
3Date: Fri, 14 Feb 2020 15:46:50 +0100
4Subject: [PATCH] opencv_dnn: added video device for 2 examples, and change text labels
5
6Signed-off-by: Ludek Slosarcik <ludek.slosarcik@nxp.com>
7
8Upstream-Status: Pending
9---
10 samples/cpp/logistic_regression.cpp | 2 +-
11 samples/dnn/classification.cpp | 7 ++++---
12 samples/dnn/object_detection.cpp | 10 +++++-----
13 samples/dnn/segmentation.cpp | 2 +-
14 samples/dnn/text_detection.cpp | 5 +++--
15 5 files changed, 14 insertions(+), 12 deletions(-)
16
17Index: git/samples/cpp/logistic_regression.cpp
18===================================================================
19--- git.orig/samples/cpp/logistic_regression.cpp
20+++ git/samples/cpp/logistic_regression.cpp
21@@ -83,7 +83,7 @@ static float calculateAccuracyPercent(co
22
23 int main()
24 {
25- const String filename = samples::findFile("data01.xml");
26+ const String filename = samples::findFile("../data/data01.xml");
27 cout << "**********************************************************************" << endl;
28 cout << filename
29 << " contains digits 0 and 1 of 20 samples each, collected on an Android device" << endl;
30Index: git/samples/dnn/classification.cpp
31===================================================================
32--- git.orig/samples/dnn/classification.cpp
33+++ git/samples/dnn/classification.cpp
34@@ -11,6 +11,7 @@ std::string keys =
35 "{ help h | | Print help message. }"
36 "{ @alias | | An alias name of model to extract preprocessing parameters from models.yml file. }"
37 "{ zoo | models.yml | An optional path to file with preprocessing parameters }"
38+ "{ device | 0 | camera device number. }"
39 "{ input i | | Path to input image or video file. Skip this argument to capture frames from a camera.}"
40 "{ framework f | | Optional name of an origin framework of the model. Detect it automatically if it does not set. }"
41 "{ classes | | Optional path to a text file with names of classes. }"
42@@ -94,7 +95,7 @@ int main(int argc, char** argv)
43 if (parser.has("input"))
44 cap.open(parser.get<String>("input"));
45 else
46- cap.open(0);
47+ cap.open(parser.get<int>("device"));
48 //! [Open a video file or an image file or a camera stream]
49
50 // Process frames.
51@@ -131,13 +132,13 @@ int main(int argc, char** argv)
52 double freq = getTickFrequency() / 1000;
53 double t = net.getPerfProfile(layersTimes) / freq;
54 std::string label = format("Inference time: %.2f ms", t);
55- putText(frame, label, Point(0, 15), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0));
56+ putText(frame, label, Point(0, 20), FONT_HERSHEY_SIMPLEX, 0.8, Scalar(0, 0, 255), 2, 8, false);
57
58 // Print predicted class.
59 label = format("%s: %.4f", (classes.empty() ? format("Class #%d", classId).c_str() :
60 classes[classId].c_str()),
61 confidence);
62- putText(frame, label, Point(0, 40), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0));
63+ putText(frame, label, Point(0, 45), FONT_HERSHEY_SIMPLEX, 0.8, Scalar(0, 0, 255), 2, 8, false);
64
65 imshow(kWinName, frame);
66 }
67Index: git/samples/dnn/object_detection.cpp
68===================================================================
69--- git.orig/samples/dnn/object_detection.cpp
70+++ git/samples/dnn/object_detection.cpp
71@@ -251,13 +251,13 @@ int main(int argc, char** argv)
72 if (predictionsQueue.counter > 1)
73 {
74 std::string label = format("Camera: %.2f FPS", framesQueue.getFPS());
75- putText(frame, label, Point(0, 15), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0));
76+ putText(frame, label, Point(0, 20), FONT_HERSHEY_SIMPLEX, 0.8, Scalar(0, 0, 255), 2, 8, false);
77
78 label = format("Network: %.2f FPS", predictionsQueue.getFPS());
79- putText(frame, label, Point(0, 30), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0));
80+ putText(frame, label, Point(0, 45), FONT_HERSHEY_SIMPLEX, 0.8, Scalar(0, 0, 255), 2, 8, false);
81
82 label = format("Skipped frames: %d", framesQueue.counter - predictionsQueue.counter);
83- putText(frame, label, Point(0, 45), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0));
84+ putText(frame, label, Point(0, 70), FONT_HERSHEY_SIMPLEX, 0.8, Scalar(0, 0, 255), 2, 8, false);
85 }
86 imshow(kWinName, frame);
87 }
88@@ -293,7 +293,7 @@ int main(int argc, char** argv)
89 double freq = getTickFrequency() / 1000;
90 double t = net.getPerfProfile(layersTimes) / freq;
91 std::string label = format("Inference time: %.2f ms", t);
92- putText(frame, label, Point(0, 15), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0));
93+ putText(frame, label, Point(0, 20), FONT_HERSHEY_SIMPLEX, 0.8, Scalar(0, 0, 255), 2, 8, false);
94
95 imshow(kWinName, frame);
96 }
97@@ -462,7 +462,7 @@ void drawPred(int classId, float conf, i
98 top = max(top, labelSize.height);
99 rectangle(frame, Point(left, top - labelSize.height),
100 Point(left + labelSize.width, top + baseLine), Scalar::all(255), FILLED);
101- putText(frame, label, Point(left, top), FONT_HERSHEY_SIMPLEX, 0.5, Scalar());
102+ putText(frame, label, Point(left, top), FONT_HERSHEY_SIMPLEX, 0.8, Scalar());
103 }
104
105 void callback(int pos, void*)
106Index: git/samples/dnn/segmentation.cpp
107===================================================================
108--- git.orig/samples/dnn/segmentation.cpp
109+++ git/samples/dnn/segmentation.cpp
110@@ -157,7 +157,7 @@ int main(int argc, char** argv)
111 double freq = getTickFrequency() / 1000;
112 double t = net.getPerfProfile(layersTimes) / freq;
113 std::string label = format("Inference time: %.2f ms", t);
114- putText(frame, label, Point(0, 15), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0));
115+ putText(frame, label, Point(0, 20), FONT_HERSHEY_SIMPLEX, 0.8, Scalar(0, 0, 255), 2, 8, false);
116
117 imshow(kWinName, frame);
118 if (!classes.empty())
119Index: git/samples/dnn/text_detection.cpp
120===================================================================
121--- git.orig/samples/dnn/text_detection.cpp
122+++ git/samples/dnn/text_detection.cpp
123@@ -25,6 +25,7 @@ using namespace cv::dnn;
124 const char* keys =
125 "{ help h | | Print help message. }"
126 "{ input i | | Path to input image or video file. Skip this argument to capture frames from a camera.}"
127+ "{ device | 0 | camera device number. }"
128 "{ model m | | Path to a binary .pb file contains trained detector network.}"
129 "{ ocr | | Path to a binary .pb or .onnx file contains trained recognition network.}"
130 "{ width | 320 | Preprocess input image by resizing to a specific width. It should be multiple by 32. }"
131@@ -75,7 +76,7 @@ int main(int argc, char** argv)
132
133 // Open a video file or an image file or a camera stream.
134 VideoCapture cap;
135- bool openSuccess = parser.has("input") ? cap.open(parser.get<String>("input")) : cap.open(0);
136+ bool openSuccess = parser.has("input") ? cap.open(parser.get<String>("input")) : cap.open(parser.get<int>("device"));
137 CV_Assert(openSuccess);
138
139 static const std::string kWinName = "EAST: An Efficient and Accurate Scene Text Detector";
140@@ -156,7 +157,7 @@ int main(int argc, char** argv)
141
142 // Put efficiency information.
143 std::string label = format("Inference time: %.2f ms", tickMeter.getTimeMilli());
144- putText(frame, label, Point(0, 15), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0));
145+ putText(frame, label, Point(0, 20), FONT_HERSHEY_SIMPLEX, 0.8, Scalar(0, 0, 255), 2, 8, false);
146
147 imshow(kWinName, frame);
148
diff --git a/recipes-support/opencv/opencv/download.patch b/recipes-support/opencv/opencv/download.patch
new file mode 100644
index 00000000..33ac4831
--- /dev/null
+++ b/recipes-support/opencv/opencv/download.patch
@@ -0,0 +1,41 @@
1From b18a280fab06a680d9f831bf8b462647f3cb6214 Mon Sep 17 00:00:00 2001
2From: Ross Burton <ross.burton@intel.com>
3Date: Thu, 9 Jan 2020 16:24:24 +0000
4Subject: [PATCH] opencv: abort configure if we need to download
5
6This CMake module will download files during do_configure. This is bad as it
7means we can't do offline builds.
8
9Add an option to disallow downloads by emitting a fatal error.
10
11Upstream-Status: Pending
12Signed-off-by: Ross Burton <ross.burton@intel.com>
13
14---
15 cmake/OpenCVDownload.cmake | 6 ++++++
16 1 file changed, 6 insertions(+)
17
18diff --git a/cmake/OpenCVDownload.cmake b/cmake/OpenCVDownload.cmake
19index 63cf6d3238..4acf477f70 100644
20--- a/cmake/OpenCVDownload.cmake
21+++ b/cmake/OpenCVDownload.cmake
22@@ -14,6 +14,7 @@
23 # RELATIVE_URL - if set, then URL is treated as a base, and FILENAME will be appended to it
24 # Note: uses OPENCV_DOWNLOAD_PATH folder as cache, default is <opencv>/.cache
25
26+set(OPENCV_ALLOW_DOWNLOADS ON CACHE BOOL "Allow downloads")
27 set(HELP_OPENCV_DOWNLOAD_PATH "Cache directory for downloaded files")
28 if(DEFINED ENV{OPENCV_DOWNLOAD_PATH})
29 set(OPENCV_DOWNLOAD_PATH "$ENV{OPENCV_DOWNLOAD_PATH}" CACHE PATH "${HELP_OPENCV_DOWNLOAD_PATH}")
30@@ -156,6 +157,11 @@ function(ocv_download)
31
32 # Download
33 if(NOT EXISTS "${CACHE_CANDIDATE}")
34+ if(NOT OPENCV_ALLOW_DOWNLOADS)
35+ message(FATAL_ERROR "Not going to download ${DL_FILENAME}")
36+ return()
37+ endif()
38+
39 ocv_download_log("#cmake_download \"${CACHE_CANDIDATE}\" \"${DL_URL}\"")
40 foreach(try ${OPENCV_DOWNLOAD_TRIES_LIST})
41 ocv_download_log("#try ${try}")
diff --git a/recipes-support/opencv/opencv_4.4.0.imx.bb b/recipes-support/opencv/opencv_4.4.0.imx.bb
new file mode 100644
index 00000000..f50cca8a
--- /dev/null
+++ b/recipes-support/opencv/opencv_4.4.0.imx.bb
@@ -0,0 +1,295 @@
1# This recipe is for the i.MX fork of opencv. For ease of
2# maintenance, the top section is a verbatim copy of an OE-core
3# recipe. The second section customizes the recipe for i.MX.
4
5########## meta-openembedded copy ###########
6
7SUMMARY = "Opencv : The Open Computer Vision Library"
8HOMEPAGE = "http://opencv.org/"
9SECTION = "libs"
10
11LICENSE = "BSD-3-Clause"
12LIC_FILES_CHKSUM = "file://LICENSE;md5=19598330421859a6dd353a4318091ac7"
13
14ARM_INSTRUCTION_SET_armv4 = "arm"
15ARM_INSTRUCTION_SET_armv5 = "arm"
16
17DEPENDS = "libtool swig-native bzip2 zlib glib-2.0 libwebp"
18
19SRCREV_opencv = "c3bb57afeaf030f10939204d48d7c2a3842f4293"
20SRCREV_contrib = "5fae4082cc493efa5cb7a7486f9e009618a5198b"
21SRCREV_ipp = "a56b6ac6f030c312b2dce17430eef13aed9af274"
22SRCREV_boostdesc = "34e4206aef44d50e6bbcd0ab06354b52e7466d26"
23SRCREV_vgg = "fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d"
24SRCREV_face = "8afa57abc8229d611c4937165d20e2a2d9fc5a12"
25
26def ipp_filename(d):
27 import re
28 arch = d.getVar('TARGET_ARCH')
29 if re.match("i.86$", arch):
30 return "ippicv_2020_lnx_ia32_20191018_general.tgz"
31 else:
32 return "ippicv_2020_lnx_intel64_20191018_general.tgz"
33
34def ipp_md5sum(d):
35 import re
36 arch = d.getVar('TARGET_ARCH')
37 if re.match("i.86$", arch):
38 return "ad189a940fb60eb71f291321322fe3e8"
39 else:
40 return "7421de0095c7a39162ae13a6098782f9"
41
42IPP_FILENAME = "${@ipp_filename(d)}"
43IPP_MD5 = "${@ipp_md5sum(d)}"
44
45SRCREV_FORMAT = "opencv_contrib_ipp_boostdesc_vgg"
46SRC_URI = "git://github.com/opencv/opencv.git;name=opencv \
47 git://github.com/opencv/opencv_contrib.git;destsuffix=contrib;name=contrib \
48 git://github.com/opencv/opencv_3rdparty.git;branch=ippicv/master_20191018;destsuffix=ipp;name=ipp \
49 git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_boostdesc_20161012;destsuffix=boostdesc;name=boostdesc \
50 git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_vgg_20160317;destsuffix=vgg;name=vgg \
51 git://github.com/opencv/opencv_3rdparty.git;branch=contrib_face_alignment_20170818;destsuffix=face;name=face \
52 file://0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch \
53 file://0003-To-fix-errors-as-following.patch \
54 file://0001-Temporarliy-work-around-deprecated-ffmpeg-RAW-functi.patch \
55 file://0001-Dont-use-isystem.patch \
56 file://download.patch \
57 file://0001-Make-ts-module-external.patch \
58 "
59SRC_URI_append_riscv64 = " file://0001-Use-Os-to-compile-tinyxml2.cpp.patch;patchdir=../contrib"
60
61S = "${WORKDIR}/git"
62
63# OpenCV wants to download more files during configure. We download these in
64# do_fetch and construct a source cache in the format it expects
65OPENCV_DLDIR = "${WORKDIR}/downloads"
66
67do_unpack_extra() {
68 tar xzf ${WORKDIR}/ipp/ippicv/${IPP_FILENAME} -C ${WORKDIR}
69
70 md5() {
71 # Return the MD5 of $1
72 echo $(md5sum $1 | cut -d' ' -f1)
73 }
74 cache() {
75 TAG=$1
76 shift
77 mkdir --parents ${OPENCV_DLDIR}/$TAG
78 for F in $*; do
79 DEST=${OPENCV_DLDIR}/$TAG/$(md5 $F)-$(basename $F)
80 test -e $DEST || ln -s $F $DEST
81 done
82 }
83 cache xfeatures2d/boostdesc ${WORKDIR}/boostdesc/*.i
84 cache xfeatures2d/vgg ${WORKDIR}/vgg/*.i
85 cache data ${WORKDIR}/face/*.dat
86}
87addtask unpack_extra after do_unpack before do_patch
88
89CMAKE_VERBOSE = "VERBOSE=1"
90
91EXTRA_OECMAKE = "-DOPENCV_EXTRA_MODULES_PATH=${WORKDIR}/contrib/modules \
92 -DWITH_1394=OFF \
93 -DENABLE_PRECOMPILED_HEADERS=OFF \
94 -DCMAKE_SKIP_RPATH=ON \
95 -DOPENCV_ICV_HASH=${IPP_MD5} \
96 -DIPPROOT=${WORKDIR}/ippicv_lnx \
97 -DOPENCV_GENERATE_PKGCONFIG=ON \
98 -DOPENCV_DOWNLOAD_PATH=${OPENCV_DLDIR} \
99 -DOPENCV_ALLOW_DOWNLOADS=OFF \
100 ${@bb.utils.contains("TARGET_CC_ARCH", "-msse3", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1", "", d)} \
101 ${@bb.utils.contains("TARGET_CC_ARCH", "-msse4.1", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1 -DENABLE_SSE41=1", "", d)} \
102 ${@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)} \
103"
104EXTRA_OECMAKE_append_x86 = " -DX86=ON"
105
106PACKAGECONFIG ??= "gapi python3 eigen jpeg png tiff v4l libv4l gstreamer samples tbb gphoto2 \
107 ${@bb.utils.contains("DISTRO_FEATURES", "x11", "gtk", "", d)} \
108 ${@bb.utils.contains("LICENSE_FLAGS_WHITELIST", "commercial", "libav", "", d)}"
109
110PACKAGECONFIG[gapi] = "-DWITH_ADE=ON -Dade_DIR=${STAGING_LIBDIR},-DWITH_ADE=OFF,ade"
111PACKAGECONFIG[amdblas] = "-DWITH_OPENCLAMDBLAS=ON,-DWITH_OPENCLAMDBLAS=OFF,libclamdblas,"
112PACKAGECONFIG[amdfft] = "-DWITH_OPENCLAMDFFT=ON,-DWITH_OPENCLAMDFFT=OFF,libclamdfft,"
113PACKAGECONFIG[dnn] = "-DBUILD_opencv_dnn=ON -DPROTOBUF_UPDATE_FILES=ON -DBUILD_PROTOBUF=OFF,-DBUILD_opencv_dnn=OFF,protobuf protobuf-native,"
114PACKAGECONFIG[eigen] = "-DWITH_EIGEN=ON,-DWITH_EIGEN=OFF,libeigen gflags glog,"
115PACKAGECONFIG[freetype] = "-DBUILD_opencv_freetype=ON,-DBUILD_opencv_freetype=OFF,freetype,"
116PACKAGECONFIG[gphoto2] = "-DWITH_GPHOTO2=ON,-DWITH_GPHOTO2=OFF,libgphoto2,"
117PACKAGECONFIG[gstreamer] = "-DWITH_GSTREAMER=ON,-DWITH_GSTREAMER=OFF,gstreamer1.0 gstreamer1.0-plugins-base,"
118PACKAGECONFIG[gtk] = "-DWITH_GTK=ON,-DWITH_GTK=OFF,gtk+3,"
119PACKAGECONFIG[jasper] = "-DWITH_JASPER=ON,-DWITH_JASPER=OFF,jasper,"
120PACKAGECONFIG[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,"
121PACKAGECONFIG[jpeg] = "-DWITH_JPEG=ON,-DWITH_JPEG=OFF,jpeg,"
122PACKAGECONFIG[libav] = "-DWITH_FFMPEG=ON,-DWITH_FFMPEG=OFF,libav,"
123PACKAGECONFIG[libv4l] = "-DWITH_LIBV4L=ON,-DWITH_LIBV4L=OFF,v4l-utils,"
124PACKAGECONFIG[opencl] = "-DWITH_OPENCL=ON,-DWITH_OPENCL=OFF,opencl-headers virtual/opencl-icd,"
125PACKAGECONFIG[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,"
126PACKAGECONFIG[png] = "-DWITH_PNG=ON,-DWITH_PNG=OFF,libpng,"
127PACKAGECONFIG[python2] = "-DPYTHON2_NUMPY_INCLUDE_DIRS:PATH=${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/numpy/core/include,,python-numpy,"
128PACKAGECONFIG[python3] = "-DPYTHON3_NUMPY_INCLUDE_DIRS:PATH=${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/numpy/core/include,,python3-numpy,"
129PACKAGECONFIG[samples] = "-DBUILD_EXAMPLES=ON -DINSTALL_PYTHON_EXAMPLES=ON,-DBUILD_EXAMPLES=OFF,,"
130PACKAGECONFIG[tbb] = "-DWITH_TBB=ON,-DWITH_TBB=OFF,tbb,"
131PACKAGECONFIG[text] = "-DBUILD_opencv_text=ON,-DBUILD_opencv_text=OFF,tesseract,"
132PACKAGECONFIG[tiff] = "-DWITH_TIFF=ON,-DWITH_TIFF=OFF,tiff,"
133PACKAGECONFIG[v4l] = "-DWITH_V4L=ON,-DWITH_V4L=OFF,v4l-utils,"
134
135inherit pkgconfig cmake
136
137inherit ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'distutils3-base', '', d)}
138inherit ${@bb.utils.contains('PACKAGECONFIG', 'python2', 'distutils-base', '', d)}
139
140export PYTHON_CSPEC="-I${STAGING_INCDIR}/${PYTHON_DIR}"
141export PYTHON="${STAGING_BINDIR_NATIVE}/${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3', 'python', d)}"
142export ORACLE_JAVA_HOME="${STAGING_DIR_NATIVE}/usr/bin/java"
143export JAVA_HOME="${STAGING_DIR_NATIVE}/usr/lib/jvm/openjdk-8-native"
144export ANT_DIR="${STAGING_DIR_NATIVE}/usr/share/ant/"
145
146TARGET_CC_ARCH += "-I${S}/include "
147
148PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'samples', '${PN}-samples', '', d)} \
149 ${@bb.utils.contains('PACKAGECONFIG', 'oracle-java', '${PN}-java', '', d)} \
150 ${@bb.utils.contains('PACKAGECONFIG', 'java', '${PN}-java', '', d)} \
151 ${@bb.utils.contains('PACKAGECONFIG', 'python2', 'python-${BPN}', '', d)} \
152 ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3-${BPN}', '', d)} \
153 ${PN}-apps"
154
155python populate_packages_prepend () {
156 cv_libdir = d.expand('${libdir}')
157 do_split_packages(d, cv_libdir, '^lib(.*)\.so$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev', allow_links=True)
158 do_split_packages(d, cv_libdir, '^lib(.*)\.la$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev')
159 do_split_packages(d, cv_libdir, '^lib(.*)\.a$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev')
160 do_split_packages(d, cv_libdir, '^lib(.*)\.so\.*', 'lib%s', 'OpenCV %s library', extra_depends='', allow_links=True)
161
162 pn = d.getVar('PN')
163 metapkg = pn + '-dev'
164 d.setVar('ALLOW_EMPTY_' + metapkg, "1")
165 blacklist = [ metapkg ]
166 metapkg_rdepends = [ ]
167 packages = d.getVar('PACKAGES').split()
168 for pkg in packages[1:]:
169 if not pkg in blacklist and not pkg in metapkg_rdepends and pkg.endswith('-dev'):
170 metapkg_rdepends.append(pkg)
171 d.setVar('RRECOMMENDS_' + metapkg, ' '.join(metapkg_rdepends))
172
173 metapkg = pn
174 d.setVar('ALLOW_EMPTY_' + metapkg, "1")
175 blacklist = [ metapkg, "libopencv-ts" ]
176 metapkg_rdepends = [ ]
177 for pkg in packages[1:]:
178 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'):
179 metapkg_rdepends.append(pkg)
180 d.setVar('RDEPENDS_' + metapkg, ' '.join(metapkg_rdepends))
181}
182
183PACKAGES_DYNAMIC += "^libopencv-.*"
184
185FILES_${PN} = ""
186FILES_${PN}-dbg += "${datadir}/OpenCV/java/.debug/* ${datadir}/OpenCV/samples/bin/.debug/*"
187FILES_${PN}-dev = "${includedir} ${libdir}/pkgconfig ${libdir}/cmake/opencv4/*.cmake"
188FILES_${PN}-staticdev += "${libdir}/opencv4/3rdparty/*.a"
189FILES_${PN}-apps = "${bindir}/* ${datadir}/opencv4 ${datadir}/licenses"
190FILES_${PN}-java = "${datadir}/OpenCV/java"
191FILES_${PN}-samples = "${datadir}/opencv4/samples/"
192
193INSANE_SKIP_${PN}-java = "libdir"
194INSANE_SKIP_${PN}-dbg = "libdir"
195
196ALLOW_EMPTY_${PN} = "1"
197
198SUMMARY_python-opencv = "Python bindings to opencv"
199FILES_python-opencv = "${PYTHON_SITEPACKAGES_DIR}/*"
200RDEPENDS_python-opencv = "python-core python-numpy"
201
202SUMMARY_python3-opencv = "Python bindings to opencv"
203FILES_python3-opencv = "${PYTHON_SITEPACKAGES_DIR}/*"
204RDEPENDS_python3-opencv = "python3-core python3-numpy"
205
206RDEPENDS_${PN}-apps = "bash"
207
208do_compile_prepend() {
209 # remove the build host info to improve reproducibility
210 if [ -f ${WORKDIR}/build/modules/core/version_string.inc ]; then
211 sed -i "s#${WORKDIR}#/workdir#g" ${WORKDIR}/build/modules/core/version_string.inc
212 fi
213}
214
215do_install_append() {
216 # Move Python files into correct library folder (for multilib build)
217 if [ "$libdir" != "/usr/lib" -a -d ${D}/usr/lib ]; then
218 mv ${D}/usr/lib/* ${D}/${libdir}/
219 rm -rf ${D}/usr/lib
220 fi
221}
222
223TOOLCHAIN = "gcc"
224
225########## End of meta-openembedded copy ##########
226
227########## i.MX overrides ##########
228
229SUMMARY = "Opencv : The Open Computer Vision Library, i.MX Fork"
230
231LIC_FILES_CHKSUM = "file://LICENSE;md5=19598330421859a6dd353a4318091ac7"
232
233SRCREV_opencv = "e39e6eded2d365a5dc370e1a72717e132166cf07"
234SRCREV_contrib = "5fae4082cc493efa5cb7a7486f9e009618a5198b"
235SRCREV_extra = "65796edadce27ed013e3deeedb3c081ff527e4ec"
236SRC_URI[tinydnn.md5sum] = "adb1c512e09ca2c7a6faef36f9c53e59"
237SRC_URI[tinydnn.sha256sum] = "e2c61ce8c5debaa644121179e9dbdcf83f497f39de853f8dd5175846505aa18b"
238SRCREV_FORMAT_append = "_extra"
239
240OPENCV_SRC ?= "git://source.codeaurora.org/external/imx/opencv-imx.git;protocol=https"
241SRCBRANCH = "4.4.0_imx"
242SRC_URI = "${OPENCV_SRC};branch=${SRCBRANCH};name=opencv \
243 git://github.com/opencv/opencv_extra.git;destsuffix=extra;name=extra \
244 git://github.com/opencv/opencv_contrib.git;destsuffix=contrib;name=contrib \
245 git://github.com/opencv/opencv_3rdparty.git;branch=ippicv/master_20191018;destsuffix=ipp;name=ipp \
246 git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_boostdesc_20161012;destsuffix=boostdesc;name=boostdesc \
247 git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_vgg_20160317;destsuffix=vgg;name=vgg \
248 git://github.com/opencv/opencv_3rdparty.git;branch=contrib_face_alignment_20170818;destsuffix=face;name=face \
249 https://github.com/tiny-dnn/tiny-dnn/archive/v1.0.0a3.tar.gz;destsuffix=git/3rdparty/tinydnn/tiny-dnn-1.0.0a3;name=tinydnn;unpack=false \
250 file://0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch \
251 file://0003-To-fix-errors-as-following.patch \
252 file://0001-Temporarliy-work-around-deprecated-ffmpeg-RAW-functi.patch \
253 file://0001-Dont-use-isystem.patch \
254 file://download.patch \
255 file://0001-Make-ts-module-external.patch \
256 file://OpenCV_DNN_examples.patch \
257 file://0001-Add-smaller-version-of-download_models.py.patch;patchdir=../extra \
258 "
259PV = "4.4.0.imx"
260
261PACKAGECONFIG_remove = "eigen"
262PACKAGECONFIG_append_mx8 = " dnn text"
263PACKAGECONFIG_OPENCL = ""
264PACKAGECONFIG_OPENCL_mx8 = "opencl"
265PACKAGECONFIG_OPENCL_mx8dxl = ""
266PACKAGECONFIG_OPENCL_mx8phantomdxl = ""
267PACKAGECONFIG_OPENCL_mx8mm = ""
268PACKAGECONFIG_OPENCL_mx8mnlite = ""
269PACKAGECONFIG_append = " ${PACKAGECONFIG_OPENCL}"
270
271PACKAGECONFIG[openvx] = "-DWITH_OPENVX=ON -DOPENVX_ROOT=${STAGING_LIBDIR} -DOPENVX_LIB_CANDIDATES='OpenVX;OpenVXU',-DWITH_OPENVX=OFF,virtual/libopenvx,"
272PACKAGECONFIG[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,"
273PACKAGECONFIG[test] = "-DBUILD_TESTS=ON -DINSTALL_TESTS=ON -DOPENCV_TEST_DATA_PATH=${S}/../extra/testdata, -DBUILD_TESTS=OFF -DINSTALL_TESTS=OFF,"
274
275do_unpack_extra_append() {
276 mkdir -p ${S}/3rdparty/tinydnn/
277 tar xzf ${WORKDIR}/v1.0.0a3.tar.gz -C ${S}/3rdparty/tinydnn/
278}
279
280do_install_append() {
281 ln -sf opencv4/opencv2 ${D}${includedir}/opencv2
282 install -d ${D}${datadir}/OpenCV/samples/data
283 cp -r ${S}/samples/data/* ${D}${datadir}/OpenCV/samples/data
284 install -d ${D}${datadir}/OpenCV/samples/bin/
285 cp -f bin/example_* ${D}${datadir}/OpenCV/samples/bin/
286 if ${@bb.utils.contains('PACKAGECONFIG', 'test', 'true', 'false', d)}; then
287 cp -r share/opencv4/testdata/cv/face/* ${D}${datadir}/opencv4/testdata/cv/face/
288 fi
289}
290
291FILES_${PN}-samples += "${datadir}/OpenCV/samples"
292
293COMPATIBLE_MACHINE = "(mx8)"
294
295########## End of i.MX overrides ##########