opencv: import from oe-classic and upgrade to 2.3.1
OpenCV <= 2.2 won't compile on oe-core due to the lack of v4l1 headers, and therefore wasn't included in this patch. Also, the support for newer cv2-style python bindings is a bit hacked up at the moment due to the way OpenCV detects the Python version and Numpy headers (see 0001-Fix-CMakeLists.txt-numpy-detection.patch). In particular, it requires the native & target python to be the same version and have similar site-packages directories, which is true at least for now in OE.
Signed-off-by Connor Abbott <[email protected]>
--- .../recipes-support/opencv/opencv-samples_2.3.bb | 42 +++++++++++ .../0001-Fix-CMakeLists.txt-numpy-detection.patch | 37 ++++++++++ meta-oe/recipes-support/opencv/opencv_2.3.bb | 75 ++++++++++++++++++++ 3 files changed, 154 insertions(+), 0 deletions(-) create mode 100644 meta-oe/recipes-support/opencv/opencv-samples_2.3.bb create mode 100644 meta-oe/recipes-support/opencv/opencv/0001-Fix-CMakeLists.txt-numpy-detection.patch create mode 100644 meta-oe/recipes-support/opencv/opencv_2.3.bb
meta-oe/recipes-support/opencv/opencv-samples_2.3.bb new file +42 -0
@@ -0,0 +1,42 @@ +DESCRIPTION = "Opencv : The Open Computer Vision Library" +HOMEPAGE = "http://opencv.willowgarage.com/wiki/" +SECTION = "libs" +LICENSE = "BSD" + +DEPENDS = "opencv" + +LIC_FILES_CHKSUM = "file://include/opencv2/opencv.hpp;endline=41;md5=6d690d8488a6fca7a2c192932466bb14 \ +" + +SRC_URI = "svn://code.ros.org/svn/opencv/tags/2.3.1;module=opencv;proto=https \ +" + +SRCREV = "6923" +PV = "2.3.1" +PR = "r0" + +S = "${WORKDIR}/opencv" + +do_install() { + cd samples/c + install -d ${D}/${bindir} + install -d ${D}/${datadir}/opencv/samples + + cp * ${D}/${datadir}/opencv/samples || true + + for i in *.c; do + echo "compiling $i" + ${CXX} ${CFLAGS} ${LDFLAGS} -ggdb `pkg-config --cflags opencv` -o `basename $i .c` $i `pkg-config --libs opencv` || true + install -m 0755 `basename $i .c` ${D}/${bindir} || true + rm ${D}/${datadir}/opencv/samples/`basename $i .c` || true + done + for i in *.cpp; do + echo "compiling $i" + ${CXX} ${CFLAGS} ${LDFLAGS} -ggdb `pkg-config --cflags opencv` -o `basename $i .cpp` $i `pkg-config --libs opencv` || true + install -m 0755 `basename $i .cpp` ${D}/${bindir} || true + rm ${D}/${datadir}/opencv/samples/`basename $i .cpp` || true + done +} + +FILES_${PN}-dev += "${datadir}/opencv/samples/*.c* ${datadir}/opencv/samples/*.vcp* ${datadir}/opencv/samples/build*" +FILES_${PN} += "${bindir} ${datadir}/opencv"
meta-oe/recipes-support/opencv/opencv/0001-Fix-CMakeLists.txt-numpy-detection.patch new file +37 -0
@@ -0,0 +1,37 @@ +From a7301911a3cdf9196abd93ff894a9e86e0bcdc5e Mon Sep 17 00:00:00 2001 +From: Connor Abbott <[email protected]> +Date: Sun, 30 Oct 2011 20:00:03 -0400 +Subject: [PATCH] Fix CMakeLists.txt numpy detection + +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 . +Signed-off-by: Connor Abbott <[email protected]> +--- + CMakeLists.txt | 12 ++++++++---- + 1 files changed, 8 insertions(+), 4 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ff8f20c..8edbd78 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -715,10 +715,14 @@ IF ("${PYTHON_VERSION_MAJOR_MINOR}" VERSION_GREATER 2.4) + ENDIF() + + # Attempt to discover the NumPy include directory. If this succeeds, then build python API with NumPy +-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]" +- RESULT_VARIABLE PYTHON_NUMPY_PROCESS +- OUTPUT_VARIABLE PYTHON_NUMPY_INCLUDE_DIRS +- OUTPUT_STRIP_TRAILING_WHITESPACE) ++if(NOT DEFINED PYTHON_NUMPY_INCLUDE_DIRS) ++ 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]" ++ RESULT_VARIABLE PYTHON_NUMPY_PROCESS ++ OUTPUT_VARIABLE PYTHON_NUMPY_INCLUDE_DIRS ++ OUTPUT_STRIP_TRAILING_WHITESPACE) ++else() ++ set(PYTHON_NUMPY_PROCESS 0) ++endif() + + if(PYTHON_NUMPY_PROCESS EQUAL 0) + set(PYTHON_USE_NUMPY 1) +-- +1.7.4.1 +
meta-oe/recipes-support/opencv/opencv_2.3.bb new file +75 -0
76 lines not on this page · raw message
Signature · 1 line
1.7.4.1