diff options
Diffstat (limited to 'recipes-support/opencv/opencv')
9 files changed, 606 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 @@ | |||
1 | From 9b4959b97d2e95d4b49cf6ca2a3fce3cdb484f2d Mon Sep 17 00:00:00 2001 | ||
2 | From: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> | ||
3 | Date: Thu, 31 Mar 2016 00:20:15 +0200 | ||
4 | Subject: [PATCH] 3rdparty/ippicv: Use pre-downloaded ipp | ||
5 | |||
6 | Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> | ||
7 | Signed-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 | |||
13 | diff --git a/3rdparty/ippicv/ippicv.cmake b/3rdparty/ippicv/ippicv.cmake | ||
14 | index 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 @@ | |||
1 | From fca4d9eec289f22c081daa2c61a1110e3f268f92 Mon Sep 17 00:00:00 2001 | ||
2 | From: Tom Hochstein <tom.hochstein@nxp.com> | ||
3 | Date: Tue, 1 Sep 2020 14:57:07 -0500 | ||
4 | Subject: [PATCH] Add smaller version of download_models.py | ||
5 | |||
6 | Signed-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 | |||
12 | diff --git a/testdata/dnn/download_models_basic.py b/testdata/dnn/download_models_basic.py | ||
13 | new file mode 100644 | ||
14 | index 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 | -- | ||
178 | 2.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 @@ | |||
1 | From 66e50ee69fa9ee2469d349100e70d8b296c4b4dc Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Tue, 11 Sep 2018 00:21:18 -0700 | ||
4 | Subject: [PATCH] Dont use isystem | ||
5 | |||
6 | clang really does not like it | ||
7 | |||
8 | Upstream-Status: Pending | ||
9 | |||
10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
11 | |||
12 | --- | ||
13 | cmake/OpenCVPCHSupport.cmake | 2 ++ | ||
14 | 1 file changed, 2 insertions(+) | ||
15 | |||
16 | diff --git a/cmake/OpenCVPCHSupport.cmake b/cmake/OpenCVPCHSupport.cmake | ||
17 | index 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 @@ | |||
1 | From 11bbf909e08594628bd757d989ae34cf1bfe200b Mon Sep 17 00:00:00 2001 | ||
2 | From: Mingli Yu <mingli.yu@windriver.com> | ||
3 | Date: Thu, 18 Jun 2020 05:51:38 +0000 | ||
4 | Subject: [PATCH] Make ts module external | ||
5 | |||
6 | Make ts module external | ||
7 | |||
8 | Reference: https://github.com/qbonnard/opencv/commit/6b229c5834cb9a0930425e762a6c7b03244d7abb | ||
9 | |||
10 | Upstream-Status: Submitted [https://github.com/opencv/opencv/issues/8408] | ||
11 | |||
12 | Signed-off-by: Mingli Yu <mingli.yu@windriver.com> | ||
13 | --- | ||
14 | modules/ts/CMakeLists.txt | 5 +---- | ||
15 | 1 file changed, 1 insertion(+), 4 deletions(-) | ||
16 | |||
17 | diff --git a/modules/ts/CMakeLists.txt b/modules/ts/CMakeLists.txt | ||
18 | index 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 | -- | ||
41 | 2.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 @@ | |||
1 | From e4ec6cea72da9e9ae5ba57140fa2f5c63f1f8295 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jason Wessel <jason.wessel@windriver.com> | ||
3 | Date: Wed, 9 May 2018 13:33:59 -0700 | ||
4 | Subject: [PATCH] Temporarliy work around deprecated ffmpeg RAW function | ||
5 | compile failure until next uprev | ||
6 | |||
7 | Signed-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 | |||
13 | diff --git a/modules/videoio/src/cap_ffmpeg_impl.hpp b/modules/videoio/src/cap_ffmpeg_impl.hpp | ||
14 | index 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 @@ | |||
1 | From 59fafe6e39759e193b5764b36b4c5a93da352123 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Tue, 18 Aug 2020 00:36:49 -0700 | ||
4 | Subject: [PATCH] Use -Os to compile tinyxml2.cpp | ||
5 | |||
6 | This workarounds issue [1] seen on riscv with gcc | ||
7 | |||
8 | [1] https://github.com/riscv/riscv-gnu-toolchain/issues/624 | ||
9 | |||
10 | Upstream-Status: Inappropriate [ OE-Specific ] | ||
11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
12 | --- | ||
13 | modules/datasets/CMakeLists.txt | 2 +- | ||
14 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
15 | |||
16 | diff --git a/modules/datasets/CMakeLists.txt b/modules/datasets/CMakeLists.txt | ||
17 | index 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 | -- | ||
30 | 2.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 @@ | |||
1 | From f42c9b8c7bafcadc7e95fb25a391707f970eb426 Mon Sep 17 00:00:00 2001 | ||
2 | From: Huang Qiyu <huangqy.fnst@cn.fujitsu.com> | ||
3 | Date: Fri, 19 May 2017 04:27:50 +0900 | ||
4 | Subject: [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 | |||
10 | Signed-off-by: Huang Qiyu <huangqy.fnst@cn.fujitsu.com> | ||
11 | |||
12 | Also add the visibility changes for certain OpenCL-related functions in | ||
13 | ts module. | ||
14 | |||
15 | Signed-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 | |||
23 | diff --git a/modules/ts/include/opencv2/ts.hpp b/modules/ts/include/opencv2/ts.hpp | ||
24 | index 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 | |||
45 | diff --git a/modules/ts/include/opencv2/ts/ocl_test.hpp b/modules/ts/include/opencv2/ts/ocl_test.hpp | ||
46 | index 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 | |||
58 | diff --git a/modules/ts/include/opencv2/ts/ts_ext.hpp b/modules/ts/include/opencv2/ts/ts_ext.hpp | ||
59 | index 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 @@ | |||
1 | From 3c4daafb54f961e376104a461ca7ec114ff0331a Mon Sep 17 00:00:00 2001 | ||
2 | From: Ludek Slosarcik <ludek.slosarcik@nxp.com> | ||
3 | Date: Fri, 14 Feb 2020 15:46:50 +0100 | ||
4 | Subject: [PATCH] opencv_dnn: added video device for 2 examples, and change text labels | ||
5 | |||
6 | Signed-off-by: Ludek Slosarcik <ludek.slosarcik@nxp.com> | ||
7 | |||
8 | Upstream-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 | |||
17 | Index: 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; | ||
30 | Index: 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 | } | ||
67 | Index: 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*) | ||
106 | Index: 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()) | ||
119 | Index: 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 @@ | |||
1 | From b18a280fab06a680d9f831bf8b462647f3cb6214 Mon Sep 17 00:00:00 2001 | ||
2 | From: Ross Burton <ross.burton@intel.com> | ||
3 | Date: Thu, 9 Jan 2020 16:24:24 +0000 | ||
4 | Subject: [PATCH] opencv: abort configure if we need to download | ||
5 | |||
6 | This CMake module will download files during do_configure. This is bad as it | ||
7 | means we can't do offline builds. | ||
8 | |||
9 | Add an option to disallow downloads by emitting a fatal error. | ||
10 | |||
11 | Upstream-Status: Pending | ||
12 | Signed-off-by: Ross Burton <ross.burton@intel.com> | ||
13 | |||
14 | --- | ||
15 | cmake/OpenCVDownload.cmake | 6 ++++++ | ||
16 | 1 file changed, 6 insertions(+) | ||
17 | |||
18 | diff --git a/cmake/OpenCVDownload.cmake b/cmake/OpenCVDownload.cmake | ||
19 | index 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}") | ||