diff options
author | Grigory Kletsko <grigory.kletsko@cogentembedded.com> | 2017-08-18 12:20:31 +0300 |
---|---|---|
committer | Grigory Kletsko <grigory.kletsko@cogentembedded.com> | 2017-09-18 18:49:12 +0300 |
commit | 1188bae340037667e958665fede72fd40d9a60b8 (patch) | |
tree | b2527e2c2876072692f7bafb2e73bce705b90b6c /meta-rcar-gen3-adas/recipes-graphics | |
parent | 281c2865aea51b0ff7c9748d169ee3542ace4679 (diff) |
Add opencv 3.2 and use it by default
Diffstat (limited to 'meta-rcar-gen3-adas/recipes-graphics')
6 files changed, 285 insertions, 0 deletions
diff --git a/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch b/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch new file mode 100644 index 0000000..1077d05 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch @@ -0,0 +1,28 @@ +From 049f931207631aa54af55a2917318d032b2ef3fa 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> +--- + 3rdparty/ippicv/downloader.cmake | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/3rdparty/ippicv/downloader.cmake b/3rdparty/ippicv/downloader.cmake +index a6016dbe10bc..af4062c8e95e 100644 +--- a/3rdparty/ippicv/downloader.cmake ++++ b/3rdparty/ippicv/downloader.cmake +@@ -31,8 +31,10 @@ function(_icv_downloader) + return() # Not supported + endif() + ++ if(NOT DEFINED OPENCV_ICV_PATH) + set(OPENCV_ICV_UNPACK_PATH "${CMAKE_BINARY_DIR}/3rdparty/ippicv") + set(OPENCV_ICV_PATH "${OPENCV_ICV_UNPACK_PATH}${OPENCV_ICV_PACKAGE_SUBDIR}") ++ endif() + + if(DEFINED OPENCV_ICV_PACKAGE_DOWNLOADED + AND OPENCV_ICV_PACKAGE_DOWNLOADED STREQUAL OPENCV_ICV_PACKAGE_HASH +-- +2.8.0.rc3 + diff --git a/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/0001-Revert-cuda-fix-fp16-compilation.patch b/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/0001-Revert-cuda-fix-fp16-compilation.patch new file mode 100644 index 0000000..507d796 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/0001-Revert-cuda-fix-fp16-compilation.patch @@ -0,0 +1,27 @@ +From 69f9707678190f6a0948a547dce948251f972676 Mon Sep 17 00:00:00 2001 +From: Randy MacLeod <Randy.MacLeod@windriver.com> +Date: Wed, 26 Apr 2017 14:57:30 -0400 +Subject: [PATCH 1/2] Revert "cuda: fix fp16 compilation" + +This reverts commit 12e00827be40576b686ea4438a6e6ef85208743d. +--- + modules/core/include/opencv2/core/cvdef.h | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/modules/core/include/opencv2/core/cvdef.h b/modules/core/include/opencv2/core/cvdef.h +index 699b166..efc24ca 100644 +--- a/modules/core/include/opencv2/core/cvdef.h ++++ b/modules/core/include/opencv2/core/cvdef.h +@@ -303,8 +303,7 @@ enum CpuFeatures { + #define CV_2PI 6.283185307179586476925286766559 + #define CV_LOG2 0.69314718055994530941723212145818 + +-#if defined __ARM_FP16_FORMAT_IEEE \ +- && !defined __CUDACC__ ++#if defined (__ARM_FP16_FORMAT_IEEE) + # define CV_FP16_TYPE 1 + #else + # define CV_FP16_TYPE 0 +-- +2.9.3 + diff --git a/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/fixpkgconfig.patch b/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/fixpkgconfig.patch new file mode 100644 index 0000000..3aeda7d --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/fixpkgconfig.patch @@ -0,0 +1,29 @@ +diff --git a/cmake/OpenCVGenPkgconfig.cmake b/cmake/OpenCVGenPkgconfig.cmake +index b8cb8777c06b..75281ee964fd 100644 +--- a/cmake/OpenCVGenPkgconfig.cmake ++++ b/cmake/OpenCVGenPkgconfig.cmake +@@ -27,7 +27,7 @@ macro(fix_prefix lst isown) + get_filename_component(libdir "${item}" PATH) + get_filename_component(libname "${item}" NAME_WE) + string(REGEX REPLACE "^lib(.*)" "\\1" libname "${libname}") +- list(APPEND _lst "-L${libdir}" "-l${libname}") ++ list(APPEND _lst "-l${libname}") + else() + list(APPEND _lst "-l${item}") + endif() +@@ -66,10 +66,14 @@ ocv_list_unique(_3rdparty) + + set(OPENCV_PC_LIBS + "-L\${exec_prefix}/${OPENCV_LIB_INSTALL_PATH}" ++ "-L\${exec_prefix}/${OPENCV_3P_LIB_INSTALL_PATH}" + "${_modules}" + ) + if (BUILD_SHARED_LIBS) +- set(OPENCV_PC_LIBS_PRIVATE "${_extra}") ++ set(OPENCV_PC_LIBS_PRIVATE ++ "-L\${exec_prefix}/${OPENCV_LIB_INSTALL_PATH}" ++ "${_extra}" ++ ) + else() + set(OPENCV_PC_LIBS_PRIVATE + "-L\${exec_prefix}/${OPENCV_3P_LIB_INSTALL_PATH}" diff --git a/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/uselocalxfeatures.patch b/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/uselocalxfeatures.patch new file mode 100644 index 0000000..a2db48d --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/uselocalxfeatures.patch @@ -0,0 +1,12 @@ +diff --git a/modules/xfeatures2d/CMakeLists.txt b/modules/xfeatures2d/CMakeLists.txt +index f295bddaed66..6086e75ec37b 100644 +--- a/modules/xfeatures2d/CMakeLists.txt ++++ b/modules/xfeatures2d/CMakeLists.txt +@@ -1,5 +1,5 @@ + set(the_description "Contributed/Experimental Algorithms for Salient 2D Features Detection") + ocv_define_module(xfeatures2d opencv_core opencv_imgproc opencv_features2d opencv_calib3d opencv_shape opencv_highgui opencv_videoio opencv_ml + OPTIONAL opencv_cudaarithm WRAP python java) +-include(cmake/download_vgg.cmake) +-include(cmake/download_boostdesc.cmake) ++#include(cmake/download_vgg.cmake) ++#include(cmake/download_boostdesc.cmake) diff --git a/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/useoeprotobuf.patch b/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/useoeprotobuf.patch new file mode 100644 index 0000000..3068bd4 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv/useoeprotobuf.patch @@ -0,0 +1,13 @@ +diff --git a/modules/dnn/cmake/OpenCVFindLibProtobuf.cmake b/modules/dnn/cmake/OpenCVFindLibProtobuf.cmake +index eb2a729cc2eb..8717736484de 100644 +--- a/modules/dnn/cmake/OpenCVFindLibProtobuf.cmake ++++ b/modules/dnn/cmake/OpenCVFindLibProtobuf.cmake +@@ -24,7 +24,7 @@ if(NOT BUILD_PROTOBUF AND NOT (DEFINED PROTOBUF_INCLUDE_DIR AND DEFINED PROTOBUF + find_package(Protobuf QUIET) + endif() + +-if(PROTOBUF_FOUND) ++if(PROTOBUF_FOUND OR (DEFINED PROTOBUF_INCLUDE_DIR AND DEFINED PROTOBUF_LIBRARIES)) + # nothing + else() + include(${CMAKE_CURRENT_LIST_DIR}/download_protobuf.cmake) diff --git a/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv_3.2.bb b/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv_3.2.bb new file mode 100644 index 0000000..a5ef014 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-graphics/opencv/opencv_3.2.bb @@ -0,0 +1,176 @@ +SUMMARY = "Opencv : The Open Computer Vision Library" +HOMEPAGE = "http://opencv.org/" +SECTION = "libs" + +LICENSE = "BSD-3-Clause" +LIC_FILES_CHKSUM = "file://LICENSE;md5=2b2f8752cc5edf504d283107d033f544" + +ARM_INSTRUCTION_SET_armv4 = "arm" +ARM_INSTRUCTION_SET_armv5 = "arm" + +DEPENDS = "libtool swig-native bzip2 zlib glib-2.0" + +#DEPENDS = "libwebp" + +SRCREV_opencv = "70bbf17b133496bd7d54d034b0f94bd869e0e810" +SRCREV_contrib = "86342522b0eb2b16fa851c020cc4e0fef4e010b7" +SRCREV_ipp = "81a676001ca8075ada498583e4166079e5744668" +SRCREV_bootdesc = "34e4206aef44d50e6bbcd0ab06354b52e7466d26" +SRCREV_vgg = "fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d" +IPP_MD5 = "808b791a6eac9ed78d32a7666804320e" + +SRCREV_FORMAT = "opencv" +SRC_URI = "git://github.com/opencv/opencv.git;name=opencv \ + git://github.com/opencv/opencv_contrib.git;destsuffix=contrib;name=contrib \ + git://github.com/opencv/opencv_3rdparty.git;branch=ippicv/master_20151201;destsuffix=ipp;name=ipp \ + git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_boostdesc_20161012;destsuffix=bootdesc;name=bootdesc \ + git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_vgg_20160317;destsuffix=vgg;name=vgg \ + file://0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch \ + file://fixpkgconfig.patch \ + file://uselocalxfeatures.patch;patchdir=../contrib/ \ + file://useoeprotobuf.patch;patchdir=../contrib/ \ + file://0001-Revert-cuda-fix-fp16-compilation.patch \ +" +# file://0002-Revert-check-FP16-build-condition-correctly.patch \ +# + +PV = "3.2+git${SRCPV}" + +S = "${WORKDIR}/git" + +do_unpack_extra() { + tar xzf ${WORKDIR}/ipp/ippicv/ippicv_linux_20151201.tgz -C ${WORKDIR} + cp ${WORKDIR}/vgg/*.i ${WORKDIR}/contrib/modules/xfeatures2d/src + cp ${WORKDIR}/bootdesc/*.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 \ + -DCMAKE_SKIP_RPATH=ON \ + -DOPENCV_ICV_PACKAGE_DOWNLOADED=${IPP_MD5} \ + -DOPENCV_ICV_PATH=${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)} \ + ${@base_conditional("libdir", "/usr/lib64", "-DLIB_SUFFIX=64", "", d)} \ + ${@base_conditional("libdir", "/usr/lib32", "-DLIB_SUFFIX=32", "", d)} \ +" +EXTRA_OECMAKE_append_x86 = " -DX86=ON" + +PACKAGECONFIG ??= "eigen jpeg png tiff v4l libv4l gstreamer samples tbb \ + ${@bb.utils.contains("DISTRO_FEATURES", "x11", "gtk", "", d)} \ + ${@bb.utils.contains("LICENSE_FLAGS_WHITELIST", "commercial", "libav", "", d)} \ + ${@bb.utils.contains("DISTRO_FEATURES", "qt5", "qt5", "", d)}" + +PACKAGECONFIG[amdblas] = "-DWITH_OPENCLAMDBLAS=ON,-DWITH_OPENCLAMDBLAS=OFF,libclamdblas," +PACKAGECONFIG[amdfft] = "-DWITH_OPENCLAMDFFT=ON,-DWITH_OPENCLAMDFFT=OFF,libclamdfft," +PACKAGECONFIG[dnn] = "-DBUILD_opencv_dnn=ON -DUPDATE_PROTO_FILES=ON -DBUILD_PROTOBUF=OFF,-DBUILD_opencv_dnn=OFF,lapack 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[oracle-java] = "-DJAVA_INCLUDE_PATH=${ORACLE_JAVA_HOME}/include -DJAVA_INCLUDE_PATH2=${ORACLE_JAVA_HOME}/include/linux -DJAVA_AWT_INCLUDE_PATH=${ORACLE_JAVA_HOME}/include -DJAVA_AWT_LIBRARY=${ORACLE_JAVA_HOME}/lib/amd64/libjawt.so -DJAVA_JVM_LIBRARY=${ORACLE_JAVA_HOME}/lib/amd64/server/libjvm.so,,ant-native oracle-jse-jdk oracle-jse-jdk-native," +PACKAGECONFIG[png] = "-DWITH_PNG=ON,-DWITH_PNG=OFF,libpng," +PACKAGECONFIG[python2] = "-DPYTHON2_NUMPY_INCLUDE_DIRS:PATH=${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/numpy/core/include,,python-numpy," +PACKAGECONFIG[python3] = "-DPYTHON3_NUMPY_INCLUDE_DIRS:PATH=${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/numpy/core/include,,python3-numpy," +PACKAGECONFIG[samples] = "-DBUILD_EXAMPLES=ON -DINSTALL_PYTHON_EXAMPLES=ON,-DBUILD_EXAMPLES=OFF,," +PACKAGECONFIG[tbb] = "-DWITH_TBB=ON,-DWITH_TBB=OFF,tbb," +PACKAGECONFIG[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," +PACKAGECONFIG[qt5] = "-DWITH_QT=ON,-DWITH_QT=OFF,qtbase," + +inherit pkgconfig cmake ${@bb.utils.contains( 'DISTRO_FEATURES', 'qt5', 'cmake_qt5','', d)} + +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', 1) + metapkg = pn + '-dev' + d.setVar('ALLOW_EMPTY_' + metapkg, "1") + blacklist = [ metapkg ] + metapkg_rdepends = [ ] + packages = d.getVar('PACKAGES', 1).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 + blacklist = [ metapkg ] + metapkg_rdepends = [ ] + for pkg in packages[1:]: + if not pkg in blacklist and not pkg in metapkg_rdepends and not pkg.endswith('-dev') and not pkg.endswith('-dbg') and not pkg.endswith('-doc') and not pkg.endswith('-locale') and not pkg.endswith('-staticdev'): + metapkg_rdepends.append(pkg) + d.setVar('RDEPENDS_' + metapkg, ' '.join(metapkg_rdepends)) + +} + +PACKAGES_DYNAMIC += "^libopencv-.*" + +FILES_${PN} = "" +FILES_${PN}-dbg += "${datadir}/OpenCV/java/.debug/* ${datadir}/OpenCV/samples/bin/.debug/*" +FILES_${PN}-dev = "${includedir} ${libdir}/pkgconfig ${datadir}/OpenCV/*.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/" + +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() { + cp ${S}/include/opencv/*.h ${D}${includedir}/opencv/ + sed -i '/blobtrack/d' ${D}${includedir}/opencv/cvaux.h + + # 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/bin/ + cp -f bin/*-tutorial-* bin/*-example-* ${D}${datadir}/OpenCV/samples/bin/ + fi +} |