Skip to contentSkip to conversation

OpenCV improvement

PATCH Superseded Samuel Martin 3 participants 12 messages Aug 31, 2014 – Sep 21, 2014

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover OpenCV improvement

[series formerly named "scientific packages"]

Hi all,

Here is a couple of improvement in OpenCV package and its reverse dependencies.

Except the last patch (which fixes an autobuilder failure) , all the others patches were originally issued within the "scientific packages" series, but now only concerns OpenCV; hence the renaming of the series.

Cheers,

Samuel Martin (8):
opencv: rework V4L/libv4l support
opencv: add Qt5 support
opencv: add python/numpy support
opencv: define modules inter-dependencies
opencv: add hidden symbol BR2_PACKAGE_OPENCV_USE_DEPRECATED_HEADERS
vlc: add opencv support
gst1-plugins-bad: rework opencv plugin dependencies package/opencv: fix ts module missing dependency to highgui

 package/gstreamer1/gst1-plugins-bad/Config.in      |  10 +-
 package/opencv/Config.in                           | 146 ++++++++++++++++-----
 ...01-fix-cross-compilation-issue-with-Numpy.patch |  74 +++++++++++
 ...-ts-add-missing-opencv_highgui-dependency.patch |  26 ++++
 package/opencv/opencv.mk                           |  32 ++++-
 package/vlc/Config.in                              |   1 +
 package/vlc/vlc.mk                                 |   7 +
 7 files changed, 247 insertions(+), 49 deletions(-)
 create mode 100644 package/opencv/opencv-0001-fix-cross-compilation-issue-with-Numpy.patch
 create mode 100644 package/opencv/opencv-0002-modules-ts-add-missing-opencv_highgui-dependency.patch

--
2.1.0

#1 lore raw

PATCH v3 1/8 opencv: rework V4L/libv4l support

Starting with the 2.4.7 release, for V4L support, OpenCV does not requires a libv4l dependency for its V4L support.

So, it now provides 2 distincts knobs for this: WITH_V4L and a new
one: WITH_LIBV4L.

This patch takes advantage of this new knob and libv4l support is now automatically enabled only if the libv4l package is enabled.

In OpenCV, the logic behind this is:
- using libv4l if available,
- otherwise, use v4l2 or v4l API from the kernel if available.

---
chnages v2 -> v3:
- rebase
- remove comments about libv4l use (Yann)

changes v1 -> v2:
- rebase
- extend commit message

---
 package/opencv/Config.in |  8 +-------
 package/opencv/opencv.mk | 10 +++++++---
 2 files changed, 8 insertions(+), 10 deletions(-)
package/opencv/Config.in +1 -7
index 3f5051e..24f540e 100644
@@ -205,16 +205,10 @@ config BR2_PACKAGE_OPENCV_WITH_TIFF
 
 config BR2_PACKAGE_OPENCV_WITH_V4L
 	bool "v4l support"
-	depends on BR2_LARGEFILE
-	depends on BR2_TOOLCHAIN_HAS_THREADS
-	depends on BR2_USE_MMU # libv4l fork
-	select BR2_PACKAGE_LIBV4L
 	help
 	  Enable Video 4 Linux support.
 
-comment "v4l support needs a toolchain w/ largefile, threads"
-	depends on !BR2_LARGEFILE || !BR2_TOOLCHAIN_HAS_THREADS
-	depends on BR2_USE_MMU
+	  If the package libv4l is enabled, its support is automatically enabled.
 
 comment "Install options"
 
package/opencv/opencv.mk +7 -3
index 1341d32..2b649ff 100644
@@ -220,10 +220,14 @@ OPENCV_CONF_OPT += -DWITH_TIFF=OFF
 endif
 
 ifeq ($(BR2_PACKAGE_OPENCV_WITH_V4L),y)
-OPENCV_CONF_OPT += -DWITH_V4L=ON -DWITH_LIBV4L=ON
-OPENCV_DEPENDENCIES += libv4l
+OPENCV_CONF_OPT += \
+	-DWITH_V4L=ON \
+	-DWITH_LIBV4L=$(if $(BR2_PACKAGE_LIBV4L),ON,OFF)
+OPENCV_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBV4L),libv4l)
 else
-OPENCV_CONF_OPT += -DWITH_V4L=OFF -DWITH_LIBV4L=OFF
+OPENCV_CONF_OPT += \
+	-DWITH_V4L=OFF \
+	-DWITH_LIBV4L=OFF
 endif
 
 # Installation hooks:
Signature · 1 line
2.1.0
#2 lore raw

PATCH v3 1/8 opencv: rework V4L/libv4l support

Samuel, All,

On 2014-08-31 22:09 +0200, Samuel Martin spake thusly:

Quoted 59 lines

Starting with the 2.4.7 release, for V4L support, OpenCV does not requires a libv4l dependency for its V4L support.

So, it now provides 2 distincts knobs for this: WITH_V4L and a new
one: WITH_LIBV4L.

This patch takes advantage of this new knob and libv4l support is now automatically enabled only if the libv4l package is enabled.

In OpenCV, the logic behind this is:
- using libv4l if available,
- otherwise, use v4l2 or v4l API from the kernel if available.

---
chnages v2 -> v3:
- rebase
- remove comments about libv4l use (Yann)

changes v1 -> v2:
- rebase
- extend commit message

---
 package/opencv/Config.in |  8 +-------
 package/opencv/opencv.mk | 10 +++++++---
 2 files changed, 8 insertions(+), 10 deletions(-)
package/opencv/Config.in +1 -7
index 3f5051e..24f540e 100644
@@ -205,16 +205,10 @@ config BR2_PACKAGE_OPENCV_WITH_TIFF
 
 config BR2_PACKAGE_OPENCV_WITH_V4L
 	bool "v4l support"
-	depends on BR2_LARGEFILE
-	depends on BR2_TOOLCHAIN_HAS_THREADS
-	depends on BR2_USE_MMU # libv4l fork
-	select BR2_PACKAGE_LIBV4L
 	help
 	  Enable Video 4 Linux support.
 
-comment "v4l support needs a toolchain w/ largefile, threads"
-	depends on !BR2_LARGEFILE || !BR2_TOOLCHAIN_HAS_THREADS
-	depends on BR2_USE_MMU
+	  If the package libv4l is enabled, its support is automatically enabled.
 
 comment "Install options"
 
package/opencv/opencv.mk +0 -1
index 1341d32..2b649ff 100644
@@ -220,10 +220,14 @@ OPENCV_CONF_OPT += -DWITH_TIFF=OFF
 endif
 
 ifeq ($(BR2_PACKAGE_OPENCV_WITH_V4L),y)
-OPENCV_CONF_OPT += -DWITH_V4L=ON -DWITH_LIBV4L=ON

package/opencv/opencv.mk OPENCV_CONF_OPT += -DWITH_TIFF=OFF · line 230

Quoted 10 lines
package/opencv/opencv.mk +7 -2
-OPENCV_DEPENDENCIES += libv4l
+OPENCV_CONF_OPT += \
+	-DWITH_V4L=ON \
+	-DWITH_LIBV4L=$(if $(BR2_PACKAGE_LIBV4L),ON,OFF)
+OPENCV_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBV4L),libv4l)
 else
-OPENCV_CONF_OPT += -DWITH_V4L=OFF -DWITH_LIBV4L=OFF
+OPENCV_CONF_OPT += \
+	-DWITH_V4L=OFF \
+	-DWITH_LIBV4L=OFF

Gratuituous reformating. Besides, the previous line fit in 80-chars, so there is no real reason to reformat it.

With that fixed:

Regards,
Yann E. MORIN.

Quoted 10 lines
package/opencv/opencv.mk +0 -0
 endif
 
 # Installation hooks:
Signature · 6 lines
2.1.0

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH v3 1/8 opencv: rework V4L/libv4l support

In reply to Samuel Martin

Dear Samuel Martin,

Quoted 6 lines · Samuel Martin

Starting with the 2.4.7 release, for V4L support, OpenCV does not requires a libv4l dependency for its V4L support.

So, it now provides 2 distincts knobs for this: WITH_V4L and a new
one: WITH_LIBV4L.

Quoted 8 lines

This patch takes advantage of this new knob and libv4l support is now automatically enabled only if the libv4l package is enabled.

In OpenCV, the logic behind this is:
- using libv4l if available,
- otherwise, use v4l2 or v4l API from the kernel if available.

Thanks, applied, after tweaking the commit as suggested by Yann (do not do a gratuitous reformatting).

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#4 lore raw

PATCH v3 2/8 opencv: add Qt5 support

In reply to Samuel Martin

Starting with the 2.4.6 release, OpenCV supports both Qt4 and Qt5, but only one can be enable at the same time.

Since Buildroot does not support Qt4/Qt5 co-existence, we keep the Qt support knob as a boolean, but make it depend on BR2_PACKAGE_QT or BR2_PACKAGE_QT5, and automatically uses the enabled one.

Note that we usually use 'select ...' to express the dependencies between packages, but in this case, we cannot since the Qt4/Qt5 co-existence exclusion is not handled by a simple choice, but by a dependency. This makes impossible using 'select ...' for the Qt support knob without triggering a circular dependency at the kconfig level.

Besides, we already use 'depends on ...' to express the dependencies with some "big" packages (like xorg or libgtk2). qt or qt5* packages are fairly big. So, I don't think it will hurt that much to use a 'depends on ...' statement in this case.

---
changes v2 -> v3:
- rebase
- remove duplicate qt/qt5 dependencies (Yann)
- add missing 'depends on' to the comment about qt4

changes v1 -> v2:
- rebase
- update threads support dependency for qt5

---
 package/opencv/Config.in | 42 +++++++++++++++++++++++++++++++-----------
 package/opencv/opencv.mk |  4 ++--
 2 files changed, 33 insertions(+), 13 deletions(-)
package/opencv/Config.in +31 -11
index 24f540e..571309f 100644
@@ -185,17 +185,37 @@ config BR2_PACKAGE_OPENCV_WITH_PNG
 	  Use shared libpng from the target system.
 
 config BR2_PACKAGE_OPENCV_WITH_QT
-	bool "qt backend support"
-	depends on BR2_INSTALL_LIBSTDCPP
-	depends on !BR2_avr32 # qt
-	depends on BR2_USE_MMU # qt
-	depends on BR2_PACKAGE_OPENCV_LIB_HIGHGUI
-	select BR2_PACKAGE_QT
-	select BR2_PACKAGE_QT_STL
-	select BR2_PACKAGE_QT_GUI_MODULE
-	select BR2_PACKAGE_QT_TEST
-	help
-	  Use Qt with QtTest module and STL support
+	bool "qt support"
+	depends on BR2_PACKAGE_QT || BR2_PACKAGE_QT5
+	select BR2_PACKAGE_QT_STL             if BR2_PACKAGE_QT
+	select BR2_PACKAGE_QT_GUI_MODULE      if BR2_PACKAGE_QT && \
+						BR2_PACKAGE_OPENCV_LIB_HIGHGUI
+	select BR2_PACKAGE_QT_TEST            if BR2_PACKAGE_QT && \
+						BR2_PACKAGE_OPENCV_LIB_HIGHGUI
+	select BR2_PACKAGE_QT5BASE            if BR2_PACKAGE_QT5
+	select BR2_PACKAGE_QT5BASE_CONCURRENT if BR2_PACKAGE_QT5
+	select BR2_PACKAGE_QT5BASE_TEST       if BR2_PACKAGE_QT5
+	select BR2_PACKAGE_QT5BASE_GUI        if BR2_PACKAGE_QT5
+	select BR2_PACKAGE_QT5BASE_WIDGETS    if BR2_PACKAGE_QT5
+	help
+	  Enable Qt support for OpenCV.
+
+	  If Qt4 is already enabled, then use Qt4 with QtTest and QtGui modules
+	  and STL support.
+
+	  If Qt5 is already enabled, then use Qt5 with the following components:
+	  base, concurrent, test, gui and widgets.
+
+if !BR2_PACKAGE_QT && !BR2_PACKAGE_QT5
+comment "qt support with Qt4 needs qt"
+	depends on !BR2_avr32
+
+comment "qt support with Qt5 needs qt5"
+	depends on BR2_USE_MMU && BR2_INET_IPV6 && BR2_TOOLCHAIN_HAS_THREADS
+
+comment "qt support with Qt5 needs a toolchain w/ wchar, IPv6, theads"
+	depends on !BR2_USE_MMU || !BR2_INET_IPV6 || !BR2_TOOLCHAIN_HAS_THREADS_NPTL
+endif
 
 config BR2_PACKAGE_OPENCV_WITH_TIFF
 	bool "tiff support"
package/opencv/opencv.mk +2 -2
index 2b649ff..00a9e22 100644
@@ -206,8 +206,8 @@ OPENCV_CONF_OPT += -DWITH_PNG=OFF
 endif
 
 ifeq ($(BR2_PACKAGE_OPENCV_WITH_QT),y)
-OPENCV_CONF_OPT += -DWITH_QT=4
-OPENCV_DEPENDENCIES += qt
+OPENCV_CONF_OPT += -DWITH_QT=$(if $(BR2_PACKAGE_QT),4,5)
+OPENCV_DEPENDENCIES += $(if $(BR2_PACKAGE_QT),qt,qt5base)
 else
 OPENCV_CONF_OPT += -DWITH_QT=OFF
 endif
Signature · 1 line
2.1.0
#5 lore raw

PATCH v3 2/8 opencv: add Qt5 support

Samuel, All,

On 2014-08-31 22:09 +0200, Samuel Martin spake thusly:

Quoted 2 lines

Starting with the 2.4.6 release, OpenCV supports both Qt4 and Qt5, but only one can be enable at the same time.

[--SNIP--]

Quoted 21 lines
package/opencv/Config.in +2 -11
index 24f540e..571309f 100644
@@ -185,17 +185,37 @@ config BR2_PACKAGE_OPENCV_WITH_PNG
 	  Use shared libpng from the target system.
 
 config BR2_PACKAGE_OPENCV_WITH_QT
-	bool "qt backend support"
-	depends on BR2_INSTALL_LIBSTDCPP
-	depends on !BR2_avr32 # qt
-	depends on BR2_USE_MMU # qt
-	depends on BR2_PACKAGE_OPENCV_LIB_HIGHGUI
-	select BR2_PACKAGE_QT
-	select BR2_PACKAGE_QT_STL
-	select BR2_PACKAGE_QT_GUI_MODULE
-	select BR2_PACKAGE_QT_TEST
-	help
-	  Use Qt with QtTest module and STL support
+	bool "qt support"
+	depends on BR2_PACKAGE_QT || BR2_PACKAGE_QT5

package/opencv/Config.in config BR2_PACKAGE_OPENCV_WITH_PNG · line 199

Quoted 10 lines
package/opencv/Config.in +10 -0
+	select BR2_PACKAGE_QT_STL             if BR2_PACKAGE_QT
+	select BR2_PACKAGE_QT_GUI_MODULE      if BR2_PACKAGE_QT && \
+						BR2_PACKAGE_OPENCV_LIB_HIGHGUI
+	select BR2_PACKAGE_QT_TEST            if BR2_PACKAGE_QT && \
+						BR2_PACKAGE_OPENCV_LIB_HIGHGUI
+	select BR2_PACKAGE_QT5BASE            if BR2_PACKAGE_QT5
+	select BR2_PACKAGE_QT5BASE_CONCURRENT if BR2_PACKAGE_QT5
+	select BR2_PACKAGE_QT5BASE_TEST       if BR2_PACKAGE_QT5
+	select BR2_PACKAGE_QT5BASE_GUI        if BR2_PACKAGE_QT5
+	select BR2_PACKAGE_QT5BASE_WIDGETS    if BR2_PACKAGE_QT5

I think all those select are ugly. Did you give a thought at my proposal in my previous review:

    http://lists.busybox.net/pipermail/buildroot/2014-May/095737.html

where I suggested something like:

---8<---

config BR2_PACKAGE_OPENCV_WITH_QT
bool "Qt backend"
depends on BR2_PACKAGE_QT || BR2_PACKAGE_QT5 select BR2_PACKAGE_OPENCV_QT4_BACKEND if BR2_PACKAGE_QT select BR2_PACKAGE_OPENCV_QT5_BACKEND if BR2_PACKAGE_QT5 help
Enable Qt support for OpenCV.

This uses whatever Qt version you enabled: Qt4 or Qt5.

config BR2_PACKAGE_OPENCV_QT4_BACKEND
bool
select BR2_PACKAGE_QT_STL
select BR2_PACKAGE_QT_GUI_MODULE if BR2_PACKAGE_OPENCV_LIB_HIGHGUI
select BR2_PACKAGE_QT_TEST if BR2_PACKAGE_OPENCV_LIB_HIGHGUI

config BR2_PACKAGE_OPENCV_QT5_BACKEND
bool
select BR2_PACKAGE_QT5BASE
select BR2_PACKAGE_QT5BASE_CONCURRENT
select BR2_PACKAGE_QT5BASE_TEST
select BR2_PACKAGE_QT5BASE_GUI
select BR2_PACKAGE_QT5BASE_WIDGETS

comment "Qt backend needs either Qt4 or Qt5"
depends on !BR2_PACKAGE_QT && !BR2_PACKAGE_QT5

Then, as soon as one or the other is selected, the comment disapears, and the option becomes visible.

---8<---

Quoted 9 lines
package/opencv/Config.in +9 -0
+	help
+	  Enable Qt support for OpenCV.
+
+	  If Qt4 is already enabled, then use Qt4 with QtTest and QtGui modules
+	  and STL support.
+
+	  If Qt5 is already enabled, then use Qt5 with the following components:
+	  base, concurrent, test, gui and widgets.
+

package/opencv/Config.in config BR2_PACKAGE_OPENCV_WITH_PNG · line 218

Quoted 10 lines
package/opencv/Config.in +10 -0
+if !BR2_PACKAGE_QT && !BR2_PACKAGE_QT5
+comment "qt support with Qt4 needs qt"
+	depends on !BR2_avr32
+
+comment "qt support with Qt5 needs qt5"
+	depends on BR2_USE_MMU && BR2_INET_IPV6 && BR2_TOOLCHAIN_HAS_THREADS
+
+comment "qt support with Qt5 needs a toolchain w/ wchar, IPv6, theads"
+	depends on !BR2_USE_MMU || !BR2_INET_IPV6 || !BR2_TOOLCHAIN_HAS_THREADS_NPTL
+endif

Something lokks fichy with those comments. What about not trying to be smart, and just say that Qt support requires eithe Qt or Qt5 to be enabled:

comment "Qt support needs either Qt or Qt5 to be enabled"
depends on !BR2_PACKAGE_QT && !BR2_PACKAGE_QT5

and let the user do his work by enabling either.

Of course, it requires extra depends to be applied, so as to hide the comment when neither Qt nor Qt5 are available (MMU, arch...)

Regards,
Yann E. MORIN.

Quoted 24 lines
package/opencv/Config.in +0 -0
 config BR2_PACKAGE_OPENCV_WITH_TIFF
 	bool "tiff support"
package/opencv/opencv.mk +2 -2
index 2b649ff..00a9e22 100644
@@ -206,8 +206,8 @@ OPENCV_CONF_OPT += -DWITH_PNG=OFF
 endif
 
 ifeq ($(BR2_PACKAGE_OPENCV_WITH_QT),y)
-OPENCV_CONF_OPT += -DWITH_QT=4
-OPENCV_DEPENDENCIES += qt
+OPENCV_CONF_OPT += -DWITH_QT=$(if $(BR2_PACKAGE_QT),4,5)
+OPENCV_DEPENDENCIES += $(if $(BR2_PACKAGE_QT),qt,qt5base)
 else
 OPENCV_CONF_OPT += -DWITH_QT=OFF
 endif
Signature · 6 lines
2.1.0

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#6 lore raw

PATCH v3 3/8 opencv: add python/numpy support

In reply to Samuel Martin

opencv_python module needs python-numpy because it uses some numpy headers in this wrapper.

A patch in the OpenCV's build-system is also needed to prevent it from trying to run python for numpy detection. This patch has already been integrated upstream.

---
changes v2 -> v3:
- rebase
- add fetch uri in the opencv's patch (Yann)
- move pyhton module knob under the multi-line if block about python deps (Yann)

changes v1 -> v2:
- rebase
- use patch merged upstream

---
 package/opencv/Config.in                           |  7 +-
 ...01-fix-cross-compilation-issue-with-Numpy.patch | 74 ++++++++++++++++++++++
 package/opencv/opencv.mk                           | 18 +++++-
 3 files changed, 96 insertions(+), 3 deletions(-)
 create mode 100644 package/opencv/opencv-0001-fix-cross-compilation-issue-with-Numpy.patch
package/opencv/Config.in +6 -1
index 571309f..d725d44 100644
@@ -84,7 +84,12 @@ config BR2_PACKAGE_OPENCV_LIB_PHOTO
 	help
 	  Include opencv_photo module into the OpenCV build.
 
-comment "opencv_python module requires numpy which is not yet available."
+config BR2_PACKAGE_OPENCV_LIB_PYTHON
+	bool "python"
+	depends on BR2_PACKAGE_PYTHON
+	help
+	  Include opencv_python module into the OpenCV build.
+	  No python example is installed.
 
 config BR2_PACKAGE_OPENCV_LIB_STITCHING
 	bool "stitching"
package/opencv/opencv-0001-fix-cross-compilation-issue-with-Numpy.patch new file +74 -0

74 lines not on this page · raw message

package/opencv/opencv.mk +16 -2
index 00a9e22..807b7d8 100644
@@ -60,7 +60,6 @@ OPENCV_CONF_OPT += \
 	-DBUILD_opencv_objdetect=$(if $(BR2_PACKAGE_OPENCV_LIB_OBJDETECT),ON,OFF) \
 	-DBUILD_opencv_ocl=OFF                                                  \
 	-DBUILD_opencv_photo=$(if $(BR2_PACKAGE_OPENCV_LIB_PHOTO),ON,OFF)       \
-	-DBUILD_opencv_python=OFF                                               \
 	-DBUILD_opencv_stitching=$(if $(BR2_PACKAGE_OPENCV_LIB_STITCHING),ON,OFF) \
 	-DBUILD_opencv_superres=$(if $(BR2_PACKAGE_OPENCV_LIB_SUPERRES),ON,OFF) \
 	-DBUILD_opencv_ts=$(if $(BR2_PACKAGE_OPENCV_LIB_TS),ON,OFF)             \
@@ -142,7 +141,6 @@ OPENCV_CONF_OPT += \
 	-DBUILD_PNG=OFF	    \
 	-DBUILD_TIFF=OFF    \
 	-DBUILD_ZLIB=OFF    \
-	-DBUILD_NEW_PYTHON_SUPPORT=OFF \
 	-DINSTALL_C_EXAMPLES=OFF       \
 	-DINSTALL_PYTHON_EXAMPLES=OFF  \
 	-DINSTALL_TO_MANGLED_PATHS=OFF
@@ -230,6 +228,22 @@ OPENCV_CONF_OPT += \
 	-DWITH_LIBV4L=OFF
 endif
 
+ifeq ($(BR2_PACKAGE_OPENCV_LIB_PYTHON),y)
+OPENCV_CONF_OPT += \
+	-DBUILD_opencv_python=ON \
+	-DBUILD_NEW_PYTHON_SUPPORT=ON \
+	-DPYTHON_EXECUTABLE=$(HOST_DIR)/usr/bin/python2                               \
+	-DPYTHON_INCLUDE_DIR=$(STAGING_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR) \
+	-DPYTHON_LIBRARY=$(STAGING_DIR)/usr/lib/libpython$(PYTHON_VERSION_MAJOR).so   \
+	-DPYTHON_NUMPY_INCLUDE_DIR=$(STAGING_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages/numpy/core/include \
+	-DPYTHON_NUMPY_VERSION=$(PYTHON_NUMPY_VERSION)
+OPENCV_DEPENDENCIES += python python-numpy
+else
+OPENCV_CONF_OPT += \
+	-DBUILD_opencv_python=ON \
+	-DBUILD_NEW_PYTHON_SUPPORT=OFF
+endif
+
 # Installation hooks:
 define OPENCV_CLEAN_INSTALL_DOC
 	$(RM) -fr $(TARGET_DIR)/usr/share/OpenCV/doc
Signature · 1 line
2.1.0
#7 lore raw

PATCH v3 4/8 opencv: define modules inter-dependencies

In reply to Samuel Martin

OpenCV allows to enable/disable the selection of modules (a.k.a. opencv libraries). These modules depend one on the others; these dependencies are already handled by the build-system (CMake).

However, the way we handled them in Buildroot was not really clean. For each opencv module, there is a kconfig option, but we forced the corresponding cmake config option without checking for module dependencies.

This patch replicates the modules' dependency relations in the Config.in, so that the selection of the user will actually be built.

---
changes v2 -> v3:
- rebase
- fix typo in commit log (Yann)
- update A/R/T tags

changes v1 -> v2:
- rebase

---
 package/opencv/Config.in | 75 ++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 60 insertions(+), 15 deletions(-)
package/opencv/Config.in +60 -15
index d725d44..7c2b964 100644
@@ -8,6 +8,8 @@ menuconfig BR2_PACKAGE_OPENCV
 	  OpenCV (Open Source Computer Vision) is a library of programming
 	  functions for real time computer vision.
 
+	  Note that the opencv_core module is automatically enabled.
+
 	  http://opencv.org/
 
 if BR2_PACKAGE_OPENCV
@@ -16,109 +18,152 @@ comment "OpenCV modules"
 
 config BR2_PACKAGE_OPENCV_LIB_CALIB3D
 	bool "calib3d"
-	default y
+	select BR2_PACKAGE_OPENCV_LIB_IMGPROC
+	select BR2_PACKAGE_OPENCV_LIB_FEATURES2D
 	help
 	  Include opencv_calib3d module into the OpenCV build.
 
 config BR2_PACKAGE_OPENCV_LIB_CONTRIB
 	bool "contrib"
-	default y
+	select BR2_PACKAGE_OPENCV_LIB_CALIB3D
+	select BR2_PACKAGE_OPENCV_LIB_FEATURES2D
+	select BR2_PACKAGE_OPENCV_LIB_IMGPROC
+	select BR2_PACKAGE_OPENCV_LIB_ML
+	select BR2_PACKAGE_OPENCV_LIB_OBJDETECT
+	select BR2_PACKAGE_OPENCV_LIB_VIDEO
 	help
 	  Include opencv_contrib module into the OpenCV build.
 
+# opencv_core module is automatically enabled when OpenCV package is selected
+
 config BR2_PACKAGE_OPENCV_LIB_FEATURES2D
 	bool "features2d"
-	default y
+	select BR2_PACKAGE_OPENCV_LIB_FLANN
+	select BR2_PACKAGE_OPENCV_LIB_IMGPROC
 	help
 	  Include opencv_features2d module into the OpenCV build.
 
 config BR2_PACKAGE_OPENCV_LIB_FLANN
 	bool "flann"
-	default y
+	# opencv_core dependency is already enabled
 	help
 	  Include opencv_flann module into the OpenCV build.
 
 config BR2_PACKAGE_OPENCV_LIB_GPU
 	bool "gpu"
+	select BR2_PACKAGE_OPENCV_LIB_CALIB3D
+	select BR2_PACKAGE_OPENCV_LIB_IMGPROC
+	select BR2_PACKAGE_OPENCV_LIB_LEGACY
+	select BR2_PACKAGE_OPENCV_LIB_OBJDETECT
+	select BR2_PACKAGE_OPENCV_LIB_PHOTO
+	select BR2_PACKAGE_OPENCV_LIB_VIDEO
 	help
 	  Include opencv_gpu module into the OpenCV build.
 
 config BR2_PACKAGE_OPENCV_LIB_HIGHGUI
 	bool "highgui"
-	default y
+	select BR2_PACKAGE_OPENCV_LIB_IMGPROC
 	help
 	  Include opencv_highgui module into the OpenCV build.
 
 config BR2_PACKAGE_OPENCV_LIB_IMGPROC
 	bool "imgproc"
-	default y
+	# opencv_core dependency is already enabled
 	help
 	  Include opencv_imgproc module into the OpenCV build.
 
 config BR2_PACKAGE_OPENCV_LIB_LEGACY
 	bool "legacy"
-	default y
+	select BR2_PACKAGE_OPENCV_LIB_CALIB3D
+	select BR2_PACKAGE_OPENCV_LIB_ML
+	select BR2_PACKAGE_OPENCV_LIB_VIDEO
 	help
 	  Include opencv_legacy module into the OpenCV build.
 
 config BR2_PACKAGE_OPENCV_LIB_ML
 	bool "ml (machine learning)"
-	default y
+	# opencv_core dependency is already enabled
 	help
 	  Include opencv_ml module into the OpenCV build.
 
 config BR2_PACKAGE_OPENCV_LIB_NONFREE
 	bool "nonfree"
+	select BR2_PACKAGE_OPENCV_LIB_CALIB3D
+	select BR2_PACKAGE_OPENCV_LIB_FEATURES2D
+	select BR2_PACKAGE_OPENCV_LIB_IMGPROC
 	help
 	  Include opencv_nonfree module into the OpenCV build.
 
 config BR2_PACKAGE_OPENCV_LIB_OBJDETECT
 	bool "objdetect"
-	default y
+	# opencv_core dependency is already enabled
+	select BR2_PACKAGE_OPENCV_LIB_IMGPROC
 	help
 	  Include opencv_objdetect module into the OpenCV build.
 
 config BR2_PACKAGE_OPENCV_LIB_PHOTO
 	bool "photo"
-	default y
+	select BR2_PACKAGE_OPENCV_LIB_IMGPROC
 	help
 	  Include opencv_photo module into the OpenCV build.
 
 config BR2_PACKAGE_OPENCV_LIB_PYTHON
 	bool "python"
 	depends on BR2_PACKAGE_PYTHON
+	# opencv_core dependency is already enabled
+	select BR2_PACKAGE_OPENCV_LIB_CALIB3D
+	select BR2_PACKAGE_OPENCV_LIB_CONTRIB
+	select BR2_PACKAGE_OPENCV_LIB_FEATURES2D
+	select BR2_PACKAGE_OPENCV_LIB_FLANN
+	select BR2_PACKAGE_OPENCV_LIB_HIGHGUI
+	select BR2_PACKAGE_OPENCV_LIB_IMGPROC
+	select BR2_PACKAGE_OPENCV_LIB_LEGACY
+	select BR2_PACKAGE_OPENCV_LIB_ML
+	select BR2_PACKAGE_OPENCV_LIB_OBJDETECT
+	select BR2_PACKAGE_OPENCV_LIB_PHOTO
+	select BR2_PACKAGE_OPENCV_LIB_VIDEO
 	help
 	  Include opencv_python module into the OpenCV build.
 	  No python example is installed.
 
 config BR2_PACKAGE_OPENCV_LIB_STITCHING
 	bool "stitching"
-	default y
+	select BR2_PACKAGE_OPENCV_LIB_CALIB3D
+	select BR2_PACKAGE_OPENCV_LIB_FEATURES2D
+	select BR2_PACKAGE_OPENCV_LIB_IMGPROC
+	select BR2_PACKAGE_OPENCV_LIB_OBJDETECT
 	help
 	  Include opencv_stitching module into the OpenCV build.
 
 config BR2_PACKAGE_OPENCV_LIB_SUPERRES
 	bool "superres"
-	default y
+	select BR2_PACKAGE_OPENCV_LIB_IMGPROC
+	select BR2_PACKAGE_OPENCV_LIB_VIDEO
 	help
 	  Include opencv_superres "super resolution" - module into the OpenCV
 	  build.
 
 config BR2_PACKAGE_OPENCV_LIB_TS
 	bool "ts (touchscreen)"
-	default y
+	# opencv_core dependency is already enabled
+	select BR2_PACKAGE_OPENCV_LIB_FEATURES2D
 	help
 	  Include opencv_ts module into the OpenCV build.
 
 config BR2_PACKAGE_OPENCV_LIB_VIDEO
 	bool "video"
-	default y
+	select BR2_PACKAGE_OPENCV_LIB_IMGPROC
 	help
 	  Include opencv_video module into the OpenCV build.
 
 config BR2_PACKAGE_OPENCV_LIB_VIDEOSTAB
 	bool "videostab"
-	default y
+	select BR2_PACKAGE_OPENCV_LIB_CALIB3D
+	select BR2_PACKAGE_OPENCV_LIB_FEATURES2D
+	select BR2_PACKAGE_OPENCV_LIB_HIGHGUI
+	select BR2_PACKAGE_OPENCV_LIB_IMGPROC
+	select BR2_PACKAGE_OPENCV_LIB_PHOTO
+	select BR2_PACKAGE_OPENCV_LIB_VIDEO
 	help
 	  Include opencv_videostab module into the OpenCV build.
 
Signature · 1 line
2.1.0
#8 lore raw

PATCH v3 5/8 opencv: add hidden symbol BR2_PACKAGE_OPENCV_USE_DEPRECATED_HEADERS

In reply to Samuel Martin

This new hidden symbol aims to automatically select all OpenCV modules required when another package use the deprecated OpenCV 'cv.h' headers.

---
changes v2 -> v3:
- rebase
- update A/R/T tags

changes v1 -> v2:
- new patch

---
 package/opencv/Config.in | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
package/opencv/Config.in +15 -0
index 7c2b964..83771d4 100644
@@ -14,6 +14,21 @@ menuconfig BR2_PACKAGE_OPENCV
 
 if BR2_PACKAGE_OPENCV
 
+config BR2_PACKAGE_OPENCV_USE_DEPRECATED_HEADERS
+	bool
+	select BR2_PACKAGE_OPENCV_LIB_CALIB3D
+	select BR2_PACKAGE_OPENCV_LIB_FEATURES2D
+	select BR2_PACKAGE_OPENCV_LIB_HIGHGUI
+	select BR2_PACKAGE_OPENCV_LIB_IMGPROC
+	select BR2_PACKAGE_OPENCV_LIB_LEGACY
+	select BR2_PACKAGE_OPENCV_LIB_ML
+	select BR2_PACKAGE_OPENCV_LIB_OBJDETECT
+	select BR2_PACKAGE_OPENCV_LIB_PHOTO
+	select BR2_PACKAGE_OPENCV_LIB_VIDEO
+	help
+	  Select all required modules needed by the deprecated OpenCV API
+	  (cv.h, cvaux.h, cxcore.h, etc).
+
 comment "OpenCV modules"
 
 config BR2_PACKAGE_OPENCV_LIB_CALIB3D
Signature · 1 line
2.1.0
#9 lore raw

PATCH v3 6/8 vlc: add opencv support

In reply to Samuel Martin

Add OpenCV support for video filter in vlc.

vlc source code still includes the headers from the deprecated OpenCV API.

---
changes v2 -> v3:
- rebase
- update A/R/T tags

changes v1 -> v2:
- new patch

---
 package/vlc/Config.in | 1 +
 package/vlc/vlc.mk    | 7 +++++++
 2 files changed, 8 insertions(+)
package/vlc/Config.in +1 -0
index cdb0d16..ede9269 100644
@@ -11,6 +11,7 @@ config BR2_PACKAGE_VLC
 	depends on BR2_USE_WCHAR
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	select BR2_PACKAGE_LIBVORBIS if BR2_PACKAGE_OPUS
+	select BR2_PACKAGE_OPENCV_USE_DEPRECATED_HEADERS if BR2_PACKAGE_OPENCV
 	help
 	  VLC is a free and open source cross-platform multimedia player
 	  and framework that plays most multimedia files as well as DVD,
package/vlc/vlc.mk +7 -0
index ad9f485..f46de3f 100644
@@ -124,6 +124,13 @@ else
 VLC_CONF_OPT += --disable-glx
 endif
 
+ifeq ($(BR2_PACKAGE_OPENCV),y)
+VCL_CONF_OPT += --with-opencv
+VLC_DEPENDENCIES += opencv
+else
+VLC_CONF_OPT += --without-opencv
+endif
+
 ifeq ($(BR2_PACKAGE_OPUS),y)
 VLC_CONF_OPT += --enable-opus
 VLC_DEPENDENCIES += libvorbis opus
Signature · 1 line
2.1.0
#10 lore raw

PATCH v3 7/8 gst1-plugins-bad: rework opencv plugin dependencies

In reply to Samuel Martin

gst1 opencv plugin source code still include OpenCV's headers from its deprecated API.

Use the newly introduced BR2_PACKAGE_OPENCV_USE_DEPRECATED_HEADERS to select all required OpenCV module dependencies.

---
changes v2 -> v3:
- rebase
- update A/R/T tags

changes v1 -> v2:
- new patch

---
 package/gstreamer1/gst1-plugins-bad/Config.in | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
package/gstreamer1/gst1-plugins-bad/Config.in +1 -9
index 054ed87..c1433f1 100644
@@ -430,15 +430,7 @@ config BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_OPENCV
 	# Remove the following opencv modules when gstreamer fixes the
 	# problem of including the old "cv.h" header
 	# bug: https://bugzilla.gnome.org/show_bug.cgi?id=725163
-	select BR2_PACKAGE_OPENCV_LIB_CALIB3D
-	select BR2_PACKAGE_OPENCV_LIB_CONTRIB
-	select BR2_PACKAGE_OPENCV_LIB_FEATURES2D
-	select BR2_PACKAGE_OPENCV_LIB_FLANN
-	select BR2_PACKAGE_OPENCV_LIB_IMGPROC
-	select BR2_PACKAGE_OPENCV_LIB_LEGACY
-	select BR2_PACKAGE_OPENCV_LIB_ML
-	select BR2_PACKAGE_OPENCV_LIB_OBJDETECT
-	select BR2_PACKAGE_OPENCV_LIB_VIDEO
+	select BR2_PACKAGE_OPENCV_USE_DEPRECATED_HEADERS
 	help
 	  GStreamer OpenCV Plugins
 
Signature · 1 line
2.1.0
#11 lore raw

PATCH v3 8/8 package/opencv: fix ts module missing dependency to highgui

In reply to Samuel Martin

Fixes:
http://autobuild.buildroot.net/results/3dc/3dc3e10e412d87937adae4d20a67cc4557bb328b/

---
changes v2 -> v3:
- new patch

---
 package/opencv/Config.in                           |  1 +
 ...-ts-add-missing-opencv_highgui-dependency.patch | 26 ++++++++++++++++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 package/opencv/opencv-0002-modules-ts-add-missing-opencv_highgui-dependency.patch
package/opencv/Config.in +1 -0
index 83771d4..7b59e6c 100644
@@ -162,6 +162,7 @@ config BR2_PACKAGE_OPENCV_LIB_TS
 	bool "ts (touchscreen)"
 	# opencv_core dependency is already enabled
 	select BR2_PACKAGE_OPENCV_LIB_FEATURES2D
+	select BR2_PACKAGE_OPENCV_LIB_HIGHGUI
 	help
 	  Include opencv_ts module into the OpenCV build.
 
package/opencv/opencv-0002-modules-ts-add-missing-opencv_highgui-dependency.patch new file +26 -0
new file mode 100644
index 0000000..1238703
@@ -0,0 +1,26 @@
+From 1ac234b4a5d4e6c562daa5f17193403f59a9a3a0 Mon Sep 17 00:00:00 2001
+From: Samuel Martin <[email protected]>
+Date: Sat, 30 Aug 2014 14:09:44 +0200
+Subject: [PATCH] modules/ts: add missing opencv_highgui dependency
+
+Signed-off-by: Samuel Martin <[email protected]>
+---
+ modules/ts/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/modules/ts/CMakeLists.txt b/modules/ts/CMakeLists.txt
+index bb56da2..8fa8a58 100644
+--- a/modules/ts/CMakeLists.txt
++++ b/modules/ts/CMakeLists.txt
+@@ -9,7 +9,7 @@ set(OPENCV_MODULE_IS_PART_OF_WORLD FALSE)
+ 
+ ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef)
+ 
+-ocv_add_module(ts opencv_core opencv_features2d)
++ocv_add_module(ts opencv_core opencv_features2d opencv_highgui)
+ 
+ ocv_glob_module_sources()
+ ocv_module_include_directories()
+-- 
+2.1.0
+
Signature · 1 line
2.1.0