diff options
| author | Koen Kooi <koen@dominion.thruhere.net> | 2012-07-11 12:39:15 +0000 |
|---|---|---|
| committer | Koen Kooi <koen@dominion.thruhere.net> | 2012-07-13 10:19:57 +0200 |
| commit | 888509e75f70f9a16eb213ebb35c0535646a05ab (patch) | |
| tree | 22c8056e3130a7cf307f50ab70064ced02a8d427 | |
| parent | 2f9d8fef13e592d232a9bec3c1eb7c59fe048878 (diff) | |
| download | meta-openembedded-888509e75f70f9a16eb213ebb35c0535646a05ab.tar.gz | |
opencv, opencv-samples: add 2.4.2
Libav is easier to get right than gstreamer, so switch back. Also enable libv4l for better v4l(2) support
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
3 files changed, 155 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/opencv/opencv-2.4.2/0001-Fix-CMakeLists.txt-numpy-detection.patch b/meta-oe/recipes-support/opencv/opencv-2.4.2/0001-Fix-CMakeLists.txt-numpy-detection.patch new file mode 100644 index 0000000000..43f03d31fc --- /dev/null +++ b/meta-oe/recipes-support/opencv/opencv-2.4.2/0001-Fix-CMakeLists.txt-numpy-detection.patch | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | From 965616bdc73247448b8f07572a9a479235dd092d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Connor Abbott <cwabbott0@gmail.com> | ||
| 3 | Date: Wed, 11 Jul 2012 13:55:38 +0200 | ||
| 4 | Subject: [PATCH] Fix CMakeLists.txt numpy detection | ||
| 5 | |||
| 6 | Right now, the code opencv uses to detect where the numpy include files are doesn't work with cross-compiling because it uses the native python to determine the environment. To make this a little better, allow the user to explictly specify the path using -DPYTHON_NUMPY_INCLUDE_DIRS=path/to/numpy/include/dir . | ||
| 7 | |||
| 8 | Signed-off-by: Connor Abbott <cwabbott0@gmail.com> | ||
| 9 | --- | ||
| 10 | cmake/OpenCVDetectPython.cmake | 8 ++++++-- | ||
| 11 | 1 file changed, 6 insertions(+), 2 deletions(-) | ||
| 12 | |||
| 13 | diff --git a/cmake/OpenCVDetectPython.cmake b/cmake/OpenCVDetectPython.cmake | ||
| 14 | index 8be94ca..5825a04 100644 | ||
| 15 | --- a/cmake/OpenCVDetectPython.cmake | ||
| 16 | +++ b/cmake/OpenCVDetectPython.cmake | ||
| 17 | @@ -74,10 +74,14 @@ if(PYTHON_EXECUTABLE) | ||
| 18 | |||
| 19 | if(NOT PYTHON_NUMPY_INCLUDE_DIR) | ||
| 20 | # Attempt to discover the NumPy include directory. If this succeeds, then build python API with NumPy | ||
| 21 | - execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.environ['DISTUTILS_USE_SDK']='1'; import numpy.distutils; print numpy.distutils.misc_util.get_numpy_include_dirs()[0]" | ||
| 22 | + if(NOT DEFINED PYTHON_NUMPY_INCLUDE_DIRS) | ||
| 23 | + execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.environ['DISTUTILS_USE_SDK']='1'; import numpy.distutils; print numpy.distutils.misc_util.get_numpy_include_dirs()[0]" | ||
| 24 | RESULT_VARIABLE PYTHON_NUMPY_PROCESS | ||
| 25 | - OUTPUT_VARIABLE PYTHON_NUMPY_INCLUDE_DIR | ||
| 26 | + OUTPUT_VARIABLE PYTHON_NUMPY_INCLUDE_DIRS | ||
| 27 | OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
| 28 | + else() | ||
| 29 | + set(PYTHON_NUMPY_PROCESS 0) | ||
| 30 | + endif() | ||
| 31 | |||
| 32 | if(PYTHON_NUMPY_PROCESS EQUAL 0) | ||
| 33 | file(TO_CMAKE_PATH "${PYTHON_NUMPY_INCLUDE_DIR}" _PYTHON_NUMPY_INCLUDE_DIR) | ||
| 34 | -- | ||
| 35 | 1.7.10 | ||
| 36 | |||
diff --git a/meta-oe/recipes-support/opencv/opencv-samples_2.4.bb b/meta-oe/recipes-support/opencv/opencv-samples_2.4.bb new file mode 100644 index 0000000000..90f7536ce8 --- /dev/null +++ b/meta-oe/recipes-support/opencv/opencv-samples_2.4.bb | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | DESCRIPTION = "Opencv : The Open Computer Vision Library" | ||
| 2 | HOMEPAGE = "http://opencv.willowgarage.com/wiki/" | ||
| 3 | SECTION = "libs" | ||
| 4 | LICENSE = "BSD" | ||
| 5 | |||
| 6 | DEPENDS = "opencv" | ||
| 7 | |||
| 8 | LIC_FILES_CHKSUM = "file://include/opencv2/opencv.hpp;endline=41;md5=6d690d8488a6fca7a2c192932466bb14 \ | ||
| 9 | " | ||
| 10 | |||
| 11 | SRC_URI = "svn://code.opencv.org/svn/opencv/branches/2.4;module=opencv;proto=http \ | ||
| 12 | " | ||
| 13 | |||
| 14 | SRCREV = "8988" | ||
| 15 | |||
| 16 | PV = "2.4.2" | ||
| 17 | |||
| 18 | S = "${WORKDIR}/opencv" | ||
| 19 | |||
| 20 | do_install() { | ||
| 21 | cd samples/c | ||
| 22 | install -d ${D}/${bindir} | ||
| 23 | install -d ${D}/${datadir}/opencv/samples | ||
| 24 | |||
| 25 | cp * ${D}/${datadir}/opencv/samples || true | ||
| 26 | |||
| 27 | for i in *.c; do | ||
| 28 | echo "compiling $i" | ||
| 29 | ${CXX} ${CFLAGS} ${LDFLAGS} -ggdb `pkg-config --cflags opencv` -o `basename $i .c` $i `pkg-config --libs opencv` || true | ||
| 30 | install -m 0755 `basename $i .c` ${D}/${bindir} || true | ||
| 31 | rm ${D}/${datadir}/opencv/samples/`basename $i .c` || true | ||
| 32 | done | ||
| 33 | for i in *.cpp; do | ||
| 34 | echo "compiling $i" | ||
| 35 | ${CXX} ${CFLAGS} ${LDFLAGS} -ggdb `pkg-config --cflags opencv` -o `basename $i .cpp` $i `pkg-config --libs opencv` || true | ||
| 36 | install -m 0755 `basename $i .cpp` ${D}/${bindir} || true | ||
| 37 | rm ${D}/${datadir}/opencv/samples/`basename $i .cpp` || true | ||
| 38 | done | ||
| 39 | } | ||
| 40 | |||
| 41 | FILES_${PN}-dev += "${datadir}/opencv/samples/*.c* ${datadir}/opencv/samples/*.vcp* ${datadir}/opencv/samples/build*" | ||
| 42 | FILES_${PN} += "${bindir} ${datadir}/opencv" | ||
diff --git a/meta-oe/recipes-support/opencv/opencv_2.4.bb b/meta-oe/recipes-support/opencv/opencv_2.4.bb new file mode 100644 index 0000000000..e56eacdc21 --- /dev/null +++ b/meta-oe/recipes-support/opencv/opencv_2.4.bb | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | DESCRIPTION = "Opencv : The Open Computer Vision Library" | ||
| 2 | HOMEPAGE = "http://opencv.willowgarage.com/wiki/" | ||
| 3 | SECTION = "libs" | ||
| 4 | |||
| 5 | LICENSE = "BSD" | ||
| 6 | LIC_FILES_CHKSUM = "file://include/opencv2/opencv.hpp;endline=41;md5=6d690d8488a6fca7a2c192932466bb14" | ||
| 7 | |||
| 8 | ARM_INSTRUCTION_SET = "arm" | ||
| 9 | |||
| 10 | DEPENDS = "python-numpy v4l-utils libav gtk+ libtool swig swig-native python jpeg bzip2 zlib libpng tiff glib-2.0" | ||
| 11 | |||
| 12 | SRC_URI = "svn://code.opencv.org/svn/opencv/branches/2.4;module=opencv;proto=http \ | ||
| 13 | file://0001-Fix-CMakeLists.txt-numpy-detection.patch \ | ||
| 14 | " | ||
| 15 | |||
| 16 | SRCREV = "8988" | ||
| 17 | |||
| 18 | PV = "2.4.2" | ||
| 19 | |||
| 20 | S = "${WORKDIR}/opencv" | ||
| 21 | |||
| 22 | EXTRA_OECMAKE = "-DPYTHON_NUMPY_INCLUDE_DIRS=${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/numpy/core/include \ | ||
| 23 | -DBUILD_PYTHON_SUPPORT=ON \ | ||
| 24 | -DWITH_FFMPEG=ON \ | ||
| 25 | -DWITH_GSTREAMER=OFF \ | ||
| 26 | -DWITH_V4L=ON \ | ||
| 27 | -DWITH_GTK=ON \ | ||
| 28 | " | ||
| 29 | |||
| 30 | inherit distutils-base pkgconfig cmake | ||
| 31 | |||
| 32 | export BUILD_SYS | ||
| 33 | export HOST_SYS | ||
| 34 | export PYTHON_CSPEC="-I${STAGING_INCDIR}/${PYTHON_DIR}" | ||
| 35 | export PYTHON="${STAGING_BINDIR_NATIVE}/python" | ||
| 36 | |||
| 37 | TARGET_CC_ARCH += "-I${S}/include " | ||
| 38 | |||
| 39 | PACKAGES += "${PN}-apps python-opencv" | ||
| 40 | |||
| 41 | python populate_packages_prepend () { | ||
| 42 | cv_libdir = bb.data.expand('${libdir}', d) | ||
| 43 | cv_libdir_dbg = bb.data.expand('${libdir}/.debug', d) | ||
| 44 | do_split_packages(d, cv_libdir, '^lib(.*)\.so$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev', allow_links=True) | ||
| 45 | do_split_packages(d, cv_libdir, '^lib(.*)\.la$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev') | ||
| 46 | do_split_packages(d, cv_libdir, '^lib(.*)\.a$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev') | ||
| 47 | do_split_packages(d, cv_libdir, '^lib(.*)\.so\.*', 'lib%s', 'OpenCV %s library', extra_depends='', allow_links=True) | ||
| 48 | |||
| 49 | pn = bb.data.getVar('PN', d, 1) | ||
| 50 | metapkg = pn + '-dev' | ||
| 51 | bb.data.setVar('ALLOW_EMPTY_' + metapkg, "1", d) | ||
| 52 | blacklist = [ metapkg ] | ||
| 53 | metapkg_rdepends = [ ] | ||
| 54 | packages = bb.data.getVar('PACKAGES', d, 1).split() | ||
| 55 | for pkg in packages[1:]: | ||
| 56 | if not pkg in blacklist and not pkg in metapkg_rdepends and pkg.endswith('-dev'): | ||
| 57 | metapkg_rdepends.append(pkg) | ||
| 58 | bb.data.setVar('RRECOMMENDS_' + metapkg, ' '.join(metapkg_rdepends), d) | ||
| 59 | } | ||
| 60 | |||
| 61 | FILES_${PN} = "" | ||
| 62 | FILES_${PN}-apps = "${bindir}/* ${datadir}/OpenCV" | ||
| 63 | FILES_${PN}-dbg += "${libdir}/.debug" | ||
| 64 | FILES_${PN}-dev = "${includedir} ${libdir}/pkgconfig" | ||
| 65 | FILES_${PN}-doc = "${datadir}/OpenCV/doc" | ||
| 66 | |||
| 67 | ALLOW_EMPTY_${PN} = "1" | ||
| 68 | |||
| 69 | INSANE_SKIP_python-opencv = "True" | ||
| 70 | DESCRIPTION_python-opencv = "Python bindings to opencv" | ||
| 71 | FILES_python-opencv = "${PYTHON_SITEPACKAGES_DIR}/*" | ||
| 72 | RDEPENDS_python-opencv = "python-core python-numpy" | ||
| 73 | |||
| 74 | do_install_append() { | ||
| 75 | cp ${S}/include/opencv/*.h ${D}${includedir}/opencv/ | ||
| 76 | sed -i '/blobtrack/d' ${D}${includedir}/opencv/cvaux.h | ||
| 77 | } | ||
