zeus migration: opencv: update recipe to v4.2.0

https://jira.digi.com/browse/DEL-7013

Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
This commit is contained in:
Arturo Buzarra 2020-04-07 11:40:20 +02:00
parent 1c1b8943b3
commit f6a9557506
9 changed files with 265 additions and 254 deletions

View File

@ -1,220 +0,0 @@
SUMMARY = "Opencv : The Open Computer Vision Library"
HOMEPAGE = "http://opencv.org/"
SECTION = "libs"
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://LICENSE;md5=62d89c5dcb0583609ea919c56be0ee76"
ARM_INSTRUCTION_SET_armv4 = "arm"
ARM_INSTRUCTION_SET_armv5 = "arm"
DEPENDS = "libtool swig-native bzip2 zlib glib-2.0 libwebp"
SRCREV_opencv = "c3d56b9aea993de1ff3fec28627372f2e24d7eda"
SRCREV_contrib = "25221244732dcf44c1450d0f93edc2529a61c0e1"
SRCREV_ipp = "32e315a5b106a7b89dbed51c28f8120a48b368b4"
SRCREV_boostdesc = "34e4206aef44d50e6bbcd0ab06354b52e7466d26"
SRCREV_vgg = "fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d"
SRCREV_extra = "d29d003e00dacf4ed686577c3f2c0aa048d5a80a"
SRC_URI[tinydnn.md5sum] = "adb1c512e09ca2c7a6faef36f9c53e59"
SRC_URI[tinydnn.sha256sum] = "e2c61ce8c5debaa644121179e9dbdcf83f497f39de853f8dd5175846505aa18b"
def ipp_filename(d):
import re
arch = d.getVar('TARGET_ARCH', True)
if re.match("i.86$", arch):
return "ippicv_2019_lnx_ia32_general_20180723.tgz"
else:
return "ippicv_2019_lnx_intel64_general_20180723.tgz"
def ipp_md5sum(d):
import re
arch = d.getVar('TARGET_ARCH', True)
if re.match("i.86$", arch):
return "ea72de74dae3c604eb6348395366e78e"
else:
return "b7cc351267db2d34b9efa1cd22ff0572"
IPP_FILENAME = "${@ipp_filename(d)}"
IPP_MD5 = "${@ipp_md5sum(d)}"
SRCREV_FORMAT = "opencv_contrib_ipp_boostdesc_vgg_extra"
OPENCV_SRC ?= "git://source.codeaurora.org/external/imx/opencv-imx.git;protocol=https"
SRCBRANCH = "4.0.1_imx"
SRC_URI = "${OPENCV_SRC};branch=${SRCBRANCH};name=opencv \
git://github.com/opencv/opencv_contrib.git;destsuffix=contrib;name=contrib \
git://github.com/opencv/opencv_3rdparty.git;branch=ippicv/master_20180723;destsuffix=ipp;name=ipp \
git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_boostdesc_20161012;destsuffix=boostdesc;name=boostdesc \
git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_vgg_20160317;destsuffix=vgg;name=vgg \
git://github.com/opencv/opencv_extra.git;destsuffix=extra;name=extra \
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 \
file://0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch \
file://uselocalxfeatures.patch;patchdir=../contrib/ \
file://0003-To-fix-errors-as-following.patch \
file://0001-Temporarliy-work-around-deprecated-ffmpeg-RAW-functi.patch \
file://0001-Dont-use-isystem.patch \
"
PV = "4.0.1.imx+git${SRCPV}"
S = "${WORKDIR}/git"
do_unpack_extra() {
mkdir -p ${S}/3rdparty/tinydnn/
tar xzf ${WORKDIR}/v1.0.0a3.tar.gz -C ${S}/3rdparty/tinydnn/
tar xzf ${WORKDIR}/ipp/ippicv/${IPP_FILENAME} -C ${WORKDIR}
cp ${WORKDIR}/vgg/*.i ${WORKDIR}/contrib/modules/xfeatures2d/src
cp ${WORKDIR}/boostdesc/*.i ${WORKDIR}/contrib/modules/xfeatures2d/src
}
addtask unpack_extra after do_unpack before do_patch
EXTRA_OECMAKE = "-DOPENCV_EXTRA_MODULES_PATH=${WORKDIR}/contrib/modules \
-DWITH_1394=OFF \
-DENABLE_PRECOMPILED_HEADERS=OFF \
-DCMAKE_SKIP_RPATH=ON \
-DOPENCV_ICV_HASH=${IPP_MD5} \
-DIPPROOT=${WORKDIR}/ippicv_lnx \
${@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)} \
"
EXTRA_OECMAKE_append_x86 = " -DX86=ON"
PACKAGECONFIG_GTK ?= " \
${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'gtk', '', d)} \
"
PACKAGECONFIG_GTK_mx8 ?= " \
${@bb.utils.contains('DISTRO_FEATURES', 'wayland x11', '', \
bb.utils.contains('DISTRO_FEATURES', 'x11', 'gtk', \
'', d), d)} \
"
PACKAGECONFIG ??= "python3 jpeg png tiff v4l libv4l gstreamer samples tbb gphoto2 \
${PACKAGECONFIG_GTK} \
${@bb.utils.contains("LICENSE_FLAGS_WHITELIST", "commercial", "libav", "", d)}"
PACKAGECONFIG_append_mx8 = " dnn text"
PACKAGECONFIG_append_mx8dv = " openvx"
PACKAGECONFIG_append_mx8qm = " openvx"
PACKAGECONFIG_OPENCL = ""
PACKAGECONFIG_OPENCL_mx8 = "opencl"
PACKAGECONFIG_OPENCL_mx8mm = ""
PACKAGECONFIG_append = " ${PACKAGECONFIG_OPENCL}"
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[openvx] = "-DWITH_OPENVX=ON -DOPENVX_ROOT=${STAGING_LIBDIR} -DOPENVX_LIB_CANDIDATES='OpenVX;OpenVXU',-DWITH_OPENVX=OFF,virtual/libopenvx,"
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[qt5] = "-DWITH_QT=ON -DWITH_GTK=OFF -DOE_QMAKE_PATH_EXTERNAL_HOST_BINS=${STAGING_BINDIR_NATIVE}/qt5 -DCMAKE_PREFIX_PATH=${STAGING_BINDIR_NATIVE}/cmake,-DWITH_QT=OFF,qtbase qtbase-native,"
PACKAGECONFIG[samples] = "-DBUILD_EXAMPLES=ON -DINSTALL_PYTHON_EXAMPLES=ON,-DBUILD_EXAMPLES=OFF,,"
PACKAGECONFIG[tbb] = "-DWITH_TBB=ON,-DWITH_TBB=OFF,tbb,"
PACKAGECONFIG[test] = "-DBUILD_TESTS=ON -DINSTALL_TESTS=ON -DOPENCV_TEST_DATA_PATH=${S}/../extra/testdata, -DBUILD_TESTS=OFF -DINSTALL_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', 'distutils3-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, '^lib(.*)\.so$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev', allow_links=True)
do_split_packages(d, cv_libdir, '^lib(.*)\.la$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev')
do_split_packages(d, cv_libdir, '^lib(.*)\.a$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev')
do_split_packages(d, cv_libdir, '^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, "libopencv-ts" ]
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} = "${datadir}/licenses"
FILES_${PN}-dbg += "${datadir}/OpenCV/java/.debug/* ${datadir}/OpenCV/samples/bin/.debug/* ${datadir}/opencv4/valgrind*.supp"
FILES_${PN}-dev = "${includedir} ${libdir}/pkgconfig ${datadir}/OpenCV/*.cmake ${libdir}/cmake"
FILES_${PN}-staticdev += "${datadir}/OpenCV/3rdparty/lib/*.a"
FILES_${PN}-apps = "${bindir}/* ${datadir}/OpenCV"
FILES_${PN}-java = "${datadir}/OpenCV/java"
FILES_${PN}-samples = "${datadir}/OpenCV/samples ${datadir}/opencv4/samples ${datadir}/opencv4/*cascades ${datadir}/opencv4/testdata/"
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"
do_install_append() {
# Fix OpenCV 2 compatibility, broken by OpenCV 4
ln -sf opencv4/opencv2 ${D}${includedir}/opencv2
# 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
if ${@bb.utils.contains("PACKAGECONFIG", "samples", "true", "false", d)}; then
install -d ${D}${datadir}/OpenCV/samples/data
cp -r ${S}/samples/data/* ${D}${datadir}/OpenCV/samples/data
install -d ${D}${datadir}/OpenCV/samples/bin/
cp -f bin/example_* ${D}${datadir}/OpenCV/samples/bin/
fi
}
RDEPENDS_opencv-apps += "bash"

View File

@ -1,16 +1,17 @@
From 4801a057730632225337d7f6d26b9335e6b9b078 Mon Sep 17 00:00:00 2001
From 85b882b4ceb57fe6538f47af58d0a970923fde0e 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 d601da4bb..f6fc1098c 100644
index ae8748c..305abdb 100644
--- a/3rdparty/ippicv/ippicv.cmake
+++ b/3rdparty/ippicv/ippicv.cmake
@@ -39,18 +39,5 @@ function(download_ippicv root_var)
@ -33,6 +34,3 @@ index d601da4bb..f6fc1098c 100644
- endif()
+ set(${root_var} "${THE_ROOT}/${OPENCV_ICV_PACKAGE_SUBDIR}" PARENT_SCOPE)
endfunction()
--
2.13.4

View File

@ -1,4 +1,4 @@
From 7144c44ec70dee73a628463b99ffeed74b1a8ef6 Mon Sep 17 00:00:00 2001
From 9659f5a1e75fc29c9879c301767bba72ecf9042a 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
@ -8,12 +8,13 @@ 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 f9b1b48b65..fe27a136f5 100644
index 59bc826..055dfce 100644
--- a/cmake/OpenCVPCHSupport.cmake
+++ b/cmake/OpenCVPCHSupport.cmake
@@ -18,6 +18,8 @@ IF(CV_GCC)
@ -25,6 +26,3 @@ index f9b1b48b65..fe27a136f5 100644
SET(_PCH_include_prefix "-I")
SET(_PCH_isystem_prefix "-isystem")
SET(_PCH_define_prefix "-D")
--
2.18.0

View File

@ -1,19 +1,20 @@
From 7d31f41d2a6759e244983504ce855fc32916b97a Mon Sep 17 00:00:00 2001
From fe27d0e2341683606704115949d16250e4cacbfa 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 5a9b10f075..97c6b74b07 100644
index 0d360ad..566df66 100644
--- a/modules/videoio/src/cap_ffmpeg_impl.hpp
+++ b/modules/videoio/src/cap_ffmpeg_impl.hpp
@@ -667,6 +667,14 @@ struct ImplMutex::Impl
@@ -736,6 +736,14 @@ struct ImplMutex::Impl
#endif
@ -28,6 +29,3 @@ index 5a9b10f075..97c6b74b07 100644
void ImplMutex::init()
{
impl = new Impl();
--
2.11.0

View File

@ -1,7 +1,7 @@
From ace48a628dca34d742615598afeef42ed323a029 Mon Sep 17 00:00:00 2001
From 867caccc358266f7021f076fc8c8e41bf048782c 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 3/3] To fix errors as following:
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'"
@ -13,17 +13,18 @@ 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 | 6 +++---
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, 5 insertions(+), 5 deletions(-)
3 files changed, 4 insertions(+), 4 deletions(-)
Index: git/modules/ts/include/opencv2/ts.hpp
===================================================================
--- git.orig/modules/ts/include/opencv2/ts.hpp
+++ git/modules/ts/include/opencv2/ts.hpp
@@ -608,7 +608,7 @@ protected:
diff --git a/modules/ts/include/opencv2/ts.hpp b/modules/ts/include/opencv2/ts.hpp
index b9d6b74..f1ee7ee 100644
--- a/modules/ts/include/opencv2/ts.hpp
+++ b/modules/ts/include/opencv2/ts.hpp
@@ -622,7 +622,7 @@ protected:
}
};
@ -32,7 +33,7 @@ Index: git/modules/ts/include/opencv2/ts.hpp
struct DefaultRngAuto
{
@@ -671,7 +671,7 @@ private:
@@ -685,7 +685,7 @@ private:
#endif
#endif
@ -41,10 +42,10 @@ Index: git/modules/ts/include/opencv2/ts.hpp
#define CV_TEST_INIT0_NOOP (void)0
Index: git/modules/ts/include/opencv2/ts/ocl_test.hpp
===================================================================
--- git.orig/modules/ts/include/opencv2/ts/ocl_test.hpp
+++ git/modules/ts/include/opencv2/ts/ocl_test.hpp
diff --git a/modules/ts/include/opencv2/ts/ocl_test.hpp b/modules/ts/include/opencv2/ts/ocl_test.hpp
index 11572e9..438112e 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;
}
@ -54,10 +55,10 @@ Index: git/modules/ts/include/opencv2/ts/ocl_test.hpp
#define MAX_VALUE 357
Index: git/modules/ts/include/opencv2/ts/ts_ext.hpp
===================================================================
--- git.orig/modules/ts/include/opencv2/ts/ts_ext.hpp
+++ git/modules/ts/include/opencv2/ts/ts_ext.hpp
diff --git a/modules/ts/include/opencv2/ts/ts_ext.hpp b/modules/ts/include/opencv2/ts/ts_ext.hpp
index b5cea3e..e5b0b4b 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

View File

@ -0,0 +1,151 @@
From 3c4daafb54f961e376104a461ca7ec114ff0331a Mon Sep 17 00:00:00 2001
From: Ludek Slosarcik <ludek.slosarcik@nxp.com>
Date: Fri, 14 Feb 2020 15:46:50 +0100
Subject: [PATCH] opencv_dnn: added video device for 2 examples, and change text labels
Signed-off-by: Ludek Slosarcik <ludek.slosarcik@nxp.com>
Upstream-Status: Pending
---
samples/cpp/logistic_regression.cpp | 2 +-
samples/dnn/classification.cpp | 7 ++++---
samples/dnn/object_detection.cpp | 10 +++++-----
samples/dnn/segmentation.cpp | 2 +-
samples/dnn/text_detection.cpp | 5 +++--
5 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/samples/cpp/logistic_regression.cpp b/samples/cpp/logistic_regression.cpp
index 365b32e523..5dca6b3835 100644
--- a/samples/cpp/logistic_regression.cpp
+++ b/samples/cpp/logistic_regression.cpp
@@ -83,7 +83,7 @@ static float calculateAccuracyPercent(const Mat &original, const Mat &predicted)
int main()
{
- const String filename = samples::findFile("data01.xml");
+ const String filename = samples::findFile("../data/data01.xml");
cout << "**********************************************************************" << endl;
cout << filename
<< " contains digits 0 and 1 of 20 samples each, collected on an Android device" << endl;
diff --git a/samples/dnn/classification.cpp b/samples/dnn/classification.cpp
index 0ae9e6ed94..0a290a8f33 100644
--- a/samples/dnn/classification.cpp
+++ b/samples/dnn/classification.cpp
@@ -11,6 +11,7 @@ std::string keys =
"{ help h | | Print help message. }"
"{ @alias | | An alias name of model to extract preprocessing parameters from models.yml file. }"
"{ zoo | models.yml | An optional path to file with preprocessing parameters }"
+ "{ device | 0 | camera device number. }"
"{ input i | | Path to input image or video file. Skip this argument to capture frames from a camera.}"
"{ framework f | | Optional name of an origin framework of the model. Detect it automatically if it does not set. }"
"{ classes | | Optional path to a text file with names of classes. }"
@@ -94,7 +95,7 @@ int main(int argc, char** argv)
if (parser.has("input"))
cap.open(parser.get<String>("input"));
else
- cap.open(0);
+ cap.open(parser.get<int>("device"));
//! [Open a video file or an image file or a camera stream]
// Process frames.
@@ -131,13 +132,13 @@ int main(int argc, char** argv)
double freq = getTickFrequency() / 1000;
double t = net.getPerfProfile(layersTimes) / freq;
std::string label = format("Inference time: %.2f ms", t);
- putText(frame, label, Point(0, 15), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0));
+ putText(frame, label, Point(0, 20), FONT_HERSHEY_SIMPLEX, 0.8, Scalar(0, 0, 255), 2, 8, false);
// Print predicted class.
label = format("%s: %.4f", (classes.empty() ? format("Class #%d", classId).c_str() :
classes[classId].c_str()),
confidence);
- putText(frame, label, Point(0, 40), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0));
+ putText(frame, label, Point(0, 45), FONT_HERSHEY_SIMPLEX, 0.8, Scalar(0, 0, 255), 2, 8, false);
imshow(kWinName, frame);
}
diff --git a/samples/dnn/object_detection.cpp b/samples/dnn/object_detection.cpp
index 83ed10db5d..6fa8e08ad8 100644
--- a/samples/dnn/object_detection.cpp
+++ b/samples/dnn/object_detection.cpp
@@ -250,13 +250,13 @@ int main(int argc, char** argv)
if (predictionsQueue.counter > 1)
{
std::string label = format("Camera: %.2f FPS", framesQueue.getFPS());
- putText(frame, label, Point(0, 15), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0));
+ putText(frame, label, Point(0, 20), FONT_HERSHEY_SIMPLEX, 0.8, Scalar(0, 0, 255), 2, 8, false);
label = format("Network: %.2f FPS", predictionsQueue.getFPS());
- putText(frame, label, Point(0, 30), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0));
+ putText(frame, label, Point(0, 45), FONT_HERSHEY_SIMPLEX, 0.8, Scalar(0, 0, 255), 2, 8, false);
label = format("Skipped frames: %d", framesQueue.counter - predictionsQueue.counter);
- putText(frame, label, Point(0, 45), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0));
+ putText(frame, label, Point(0, 70), FONT_HERSHEY_SIMPLEX, 0.8, Scalar(0, 0, 255), 2, 8, false);
}
imshow(kWinName, frame);
}
@@ -292,7 +292,7 @@ int main(int argc, char** argv)
double freq = getTickFrequency() / 1000;
double t = net.getPerfProfile(layersTimes) / freq;
std::string label = format("Inference time: %.2f ms", t);
- putText(frame, label, Point(0, 15), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0));
+ putText(frame, label, Point(0, 20), FONT_HERSHEY_SIMPLEX, 0.8, Scalar(0, 0, 255), 2, 8, false);
imshow(kWinName, frame);
}
@@ -424,7 +424,7 @@ void drawPred(int classId, float conf, int left, int top, int right, int bottom,
top = max(top, labelSize.height);
rectangle(frame, Point(left, top - labelSize.height),
Point(left + labelSize.width, top + baseLine), Scalar::all(255), FILLED);
- putText(frame, label, Point(left, top), FONT_HERSHEY_SIMPLEX, 0.5, Scalar());
+ putText(frame, label, Point(left, top), FONT_HERSHEY_SIMPLEX, 0.8, Scalar());
}
void callback(int pos, void*)
diff --git a/samples/dnn/segmentation.cpp b/samples/dnn/segmentation.cpp
index d9fbad8974..2e0c6908d5 100644
--- a/samples/dnn/segmentation.cpp
+++ b/samples/dnn/segmentation.cpp
@@ -157,7 +157,7 @@ int main(int argc, char** argv)
double freq = getTickFrequency() / 1000;
double t = net.getPerfProfile(layersTimes) / freq;
std::string label = format("Inference time: %.2f ms", t);
- putText(frame, label, Point(0, 15), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0));
+ putText(frame, label, Point(0, 20), FONT_HERSHEY_SIMPLEX, 0.8, Scalar(0, 0, 255), 2, 8, false);
imshow(kWinName, frame);
if (!classes.empty())
diff --git a/samples/dnn/text_detection.cpp b/samples/dnn/text_detection.cpp
index e7b0f237d3..00cd22e144 100644
--- a/samples/dnn/text_detection.cpp
+++ b/samples/dnn/text_detection.cpp
@@ -8,6 +8,7 @@ using namespace cv::dnn;
const char* keys =
"{ help h | | Print help message. }"
"{ input i | | Path to input image or video file. Skip this argument to capture frames from a camera.}"
+ "{ device | 0 | camera device number. }"
"{ model m | | Path to a binary .pb file contains trained network.}"
"{ width | 320 | Preprocess input image by resizing to a specific width. It should be multiple by 32. }"
"{ height | 320 | Preprocess input image by resizing to a specific height. It should be multiple by 32. }"
@@ -51,7 +52,7 @@ int main(int argc, char** argv)
if (parser.has("input"))
cap.open(parser.get<String>("input"));
else
- cap.open(0);
+ cap.open(parser.get<int>("device"));
static const std::string kWinName = "EAST: An Efficient and Accurate Scene Text Detector";
namedWindow(kWinName, WINDOW_NORMAL);
@@ -109,7 +110,7 @@ int main(int argc, char** argv)
double freq = getTickFrequency() / 1000;
double t = net.getPerfProfile(layersTimes) / freq;
std::string label = format("Inference time: %.2f ms", t);
- putText(frame, label, Point(0, 15), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0));
+ putText(frame, label, Point(0, 20), FONT_HERSHEY_SIMPLEX, 0.8, Scalar(0, 0, 255), 2, 8, false);
imshow(kWinName, frame);
}
--
2.17.1

View File

@ -0,0 +1,32 @@
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>
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,53 @@
require recipes-support/opencv/opencv_4.1.0.bb
LIC_FILES_CHKSUM = "file://LICENSE;md5=014935351b2df6f3094bf25de8d50ed8"
SRCREV_opencv = "c4fbe8651af1d7e22e707dba7a93d001eaca4a15"
SRCREV_contrib = "65abc7090dedc84bbedec4dfd143f0340e52114f"
SRCREV_extra = "322b475403899abc2411c4fbf68318afa77d3191"
SRC_URI[tinydnn.md5sum] = "adb1c512e09ca2c7a6faef36f9c53e59"
SRC_URI[tinydnn.sha256sum] = "e2c61ce8c5debaa644121179e9dbdcf83f497f39de853f8dd5175846505aa18b"
SRCREV_FORMAT_append = "_extra"
SRC_URI_remove = " \
git://github.com/opencv/opencv.git;name=opencv \
file://0002-Make-opencv-ts-create-share-library-intead-of-static.patch \
"
OPENCV_SRC ?= "git://source.codeaurora.org/external/imx/opencv-imx.git;protocol=https"
SRCBRANCH = "4.2.0_imx"
SRC_URI =+ "${OPENCV_SRC};branch=${SRCBRANCH};name=opencv"
SRC_URI += " \
git://github.com/opencv/opencv_extra.git;destsuffix=extra;name=extra \
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 \
file://uselocalxfeatures.patch;patchdir=../contrib/ \
file://OpenCV_DNN_examples.patch \
"
PV = "4.2.0.imx"
PACKAGECONFIG_remove = "eigen"
PACKAGECONFIG_append_mx8 = " dnn text"
PACKAGECONFIG_OPENCL = ""
PACKAGECONFIG_OPENCL_mx8 = "opencl"
PACKAGECONFIG_OPENCL_mx8dxl = ""
PACKAGECONFIG_OPENCL_mx8phantomdxl = ""
PACKAGECONFIG_OPENCL_mx8mm = ""
PACKAGECONFIG_append = " ${PACKAGECONFIG_OPENCL}"
PACKAGECONFIG[openvx] = "-DWITH_OPENVX=ON -DOPENVX_ROOT=${STAGING_LIBDIR} -DOPENVX_LIB_CANDIDATES='OpenVX;OpenVXU',-DWITH_OPENVX=OFF,virtual/libopenvx,"
PACKAGECONFIG[qt5] = "-DWITH_QT=ON -DOE_QMAKE_PATH_EXTERNAL_HOST_BINS=${STAGING_BINDIR_NATIVE} -DCMAKE_PREFIX_PATH=${STAGING_BINDIR_NATIVE}/cmake,-DWITH_QT=OFF,qtbase qtbase-native,"
PACKAGECONFIG[test] = "-DBUILD_TESTS=ON -DINSTALL_TESTS=ON -DOPENCV_TEST_DATA_PATH=${S}/../extra/testdata, -DBUILD_TESTS=OFF -DINSTALL_TESTS=OFF,"
do_unpack_extra_append() {
mkdir -p ${S}/3rdparty/tinydnn/
tar xzf ${WORKDIR}/v1.0.0a3.tar.gz -C ${S}/3rdparty/tinydnn/
}
do_install_append() {
ln -sf opencv4/opencv2 ${D}${includedir}/opencv2
install -d ${D}${datadir}/OpenCV/samples/data
cp -r ${S}/samples/data/* ${D}${datadir}/OpenCV/samples/data
install -d ${D}${datadir}/OpenCV/samples/bin/
cp -f bin/example_* ${D}${datadir}/OpenCV/samples/bin/
}
FILES_${PN}-samples += "${datadir}/OpenCV/samples"