Skip to contentSkip to conversation

package: add opencv

PATCH Superseded Samuel Martin 3 participants 4 messages Oct 23, 2011 – Oct 27, 2011

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 package: add opencv

OpenCV is a free, open-source, cross-platform computer vision library

Changelog:
v1: initial submission
v2: changes according to Thomas Petazonni's review:
- remove obvious unneeded options
- typo and style fixes
- do not use 3RDPARTY_LIBS
v3: changes according to Thomas Petazonni's review:
- typo and style fixes
- remove host package (not needed)
v4: update CMAKETARGET call to follow the infra.
v5: - add post install hooks (following Mike Davies' remarks):
- do not install doc
- do not install OpenCVConfig.cmake in the target
- optionally install data in the target
- remove the 'Build examples' option (only install source files)
- disable precompiled header usage (automacally disabled when compiler size optimization is set)

---
 package/Config.in        |    1 +
 package/opencv/Config.in |   77 ++++++++++++++++++++++++++++++++++++++++++++
 package/opencv/opencv.mk |   80 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 158 insertions(+), 0 deletions(-)
 create mode 100644 package/opencv/Config.in
 create mode 100644 package/opencv/opencv.mk
package/Config.in +1 -0
index 3b2769d..c6ca350 100644
@@ -297,6 +297,7 @@ source "package/libraw/Config.in"
 source "package/librsvg/Config.in"
 source "package/libsvgtiny/Config.in"
 source "package/libungif/Config.in"
+source "package/opencv/Config.in"
 source "package/pango/Config.in"
 source "package/pixman/Config.in"
 source "package/tiff/Config.in"
package/opencv/Config.in new file +77 -0

77 lines not on this page · raw message

package/opencv/opencv.mk new file +80 -0

80 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#1 lore raw

PATCH v5 1/1 package: add opencv

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Samuel" == Samuel Martin <[email protected]> writes:

Samuel> OpenCV is a free, open-source, cross-platform computer vision library Samuel> Changelog:
Samuel> v1: initial submission
Samuel> v2: changes according to Thomas Petazonni's review:

 Samuel>      - remove obvious unneeded options
 Samuel>      - typo and style fixes
 Samuel>      - do not use 3RDPARTY_LIBS
 Samuel>  v3: changes according to Thomas Petazonni's review:
 Samuel>      - typo and style fixes
 Samuel>      - remove host package (not needed)
 Samuel>  v4: update CMAKETARGET call to follow the infra.
 Samuel>  v5: - add post install hooks (following Mike Davies' remarks):
 Samuel>        - do not install doc
 Samuel>        - do not install OpenCVConfig.cmake in the target
 Samuel>      - optionally install data in the target
 Samuel>      - remove the 'Build examples' option (only install source files)
 Samuel>      - disable precompiled header usage (automacally disabled when

Samuel> compiler size optimization is set)

Thanks, committed with some changes (see below)

Samuel> +menuconfig BR2_PACKAGE_OPENCV

I prefer config rather than yet another submenu.

Samuel> + bool "opencv"
Samuel> + select BR2_PACKAGE_ZLIB

opencv uses C++ and needs wchar, so you need to depend on BR2_INSTALL_LIBSTDCPP / show a comment when they aren't available in the toolchain.

Samuel> + help
Samuel> + OpenCV (Open Source Computer Vision) is a library of programming
Samuel> + functions for real time computer vision.
Samuel> +
Samuel> + http://opencv.willowgarage.com/wiki/
Samuel> +
Samuel> +if BR2_PACKAGE_OPENCV
Samuel> +
Samuel> +comment "Built targets"
Samuel> +
Samuel> +config BR2_PACKAGE_OPENCV_BUILD_NEW_PYTHON_SUPPORT
Samuel> + bool "Python support"
Samuel> + select BR2_PACKAGE_PYTHON

This should only be shown if python is enabled already, similar to the gtk/qt options. It imho also belongs down there.

Samuel> +
Samuel> +config BR2_PACKAGE_OPENCV_BUILD_TESTS
Samuel> + bool "Tests"

config descriptions are normally in lower case.

Samuel> +
Samuel> +comment "Install options"
Samuel> +
Samuel> +config BR2_PACKAGE_OPENCV_INSTALL_DATA
Samuel> + bool "Install data"

I made this "install extra data" to make it clear that this isn't necessarily needed.

Samuel> + help
Samuel> + Install various data that is used by cv libraries and/or demo
Samuel> + applications, specifically for haarcascades and lbpcascades features.
Samuel> +
Samuel> + For further information: see OpenCV documentation.
Samuel> +
Samuel> +comment "Build options"
Samuel> +
Samuel> +config BR2_PACKAGE_OPENCV_WITH_FFMPEG
Samuel> + bool "FFMPEG support"
Samuel> + select BR2_PACKAGE_FFMPEG
Samuel> + select BR2_PACKAGE_FFMPEG_SWSCALE
Samuel> + help
Samuel> + Use ffmpeg from the target system.
Samuel> +
Samuel> +config BR2_PACKAGE_OPENCV_WITH_GSTREAMER
Samuel> + bool "Gstreamer support"
Samuel> + select BR2_PACKAGE_GSTREAMER
Samuel> + select BR2_PACKAGE_GST_PLUGINS_BASE
Samuel> + select BR2_PACKAGE_GST_PLUGINS_BASE_PLUGIN_APP
Samuel> +
Samuel> +config BR2_PACKAGE_OPENCV_WITH_GTK
Samuel> + bool "GTK support"
Samuel> + depends on BR2_PACKAGE_LIBGTK2 && BR2_PACKAGE_LIBGLIB2
Samuel> +
Samuel> +config BR2_PACKAGE_OPENCV_WITH_JPEG
Samuel> + bool "JPEG support"
Samuel> + select BR2_PACKAGE_JPEG
Samuel> + help
Samuel> + Use shared libjpeg from the target system.
Samuel> +
Samuel> +config BR2_PACKAGE_OPENCV_WITH_PNG
Samuel> + bool "PNG support"
Samuel> + select BR2_PACKAGE_LIBPNG
Samuel> + help
Samuel> + Use shared libpng from the target system.
Samuel> +
Samuel> +config BR2_PACKAGE_OPENCV_WITH_QT
Samuel> + bool "Qt Backend support"
Samuel> + select BR2_PACKAGE_QT

I moved this up under gtk.

Samuel> +
Samuel> +config BR2_PACKAGE_OPENCV_WITH_TIFF
Samuel> + bool "TIFF support"
Samuel> + select BR2_PACKAGE_TIFF
Samuel> + help
Samuel> + Use shared libtiff from the target system.
Samuel> +
Samuel> +config BR2_PACKAGE_OPENCV_WITH_V4L
Samuel> + bool "Video 4 Linux support"
Samuel> + select BR2_PACKAGE_LIBV4L

libv4l needs largefile support, so you need to depend on that / show a comment if not available.

Samuel> + default y
Samuel> +
Samuel> +endif
Samuel> diff --git a/package/opencv/opencv.mk b/package/opencv/opencv.mk Samuel> new file mode 100644
Samuel> index 0000000..48add1e
Samuel> --- /dev/null
Samuel> +++ b/package/opencv/opencv.mk
Samuel> @@ -0,0 +1,80 @@
Samuel> +############################################################# Samuel> +#
Samuel> +# OpenCV (Open Source Computer Vision)
Samuel> +#
Samuel> +############################################################# Samuel> +OPENCV_SERIES = 2.3
Samuel> +OPENCV_VERSION = $(OPENCV_SERIES).0
Samuel> +OPENCV_SITE = http://$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/project/opencvlibrary/opencv-unix/$(OPENCV_SERIES)
Samuel> +OPENCV_SOURCE = OpenCV-$(OPENCV_VERSION).tar.bz2
Samuel> +OPENCV_INSTALL_STAGING = YES
Samuel> +
Samuel> +# Build type
Samuel> +OPENCV_CONF_OPT += -DCMAKE_BUILD_TYPE=$(if $(BR2_ENABLE_DEBUG),Debug,Release)

While this works it looks quite different than other packages - We normally do:

OPENCV_CONF_OPT += \
                blah=.. \
                blih=.. \
                bloh=..

ifeq ($(BR2_PACKAGE_BLAH))
OPENCV_CONF_OPT += BLAH=on
OPENCV_DEPENDENCIES += blah
else
OPENCV_CONF_OPT += BLAH=OFF
endif

..

I've rewritten it to use that form.

Samuel> +define OPENCV_CLEAN_INSTALL_DOC
Samuel> + $(RM) -fr $(TARGET_DIR)/usr/share/opencv/doc
Samuel> +endef

This should only be done if BR2_HAVE_DOCUMENTATION isn't enabled.

Samuel> +
Samuel> +define OPENCV_CLEAN_INSTALL_CMAKE
Samuel> + $(RM) -fr $(TARGET_DIR)/usr/share/opencv/*.cmake
Samuel> +endef

This should only be done if cmake for the target isn't enabled.

Samuel> +
Samuel> +define OPENCV_CLEAN_INSTALL_DATA
Samuel> + $(RM) -fr $(TARGET_DIR)/usr/share/opencv/haarcascades \
Samuel> + $(TARGET_DIR)/usr/share/opencv/lbpcascades
Samuel> +endef
Samuel> +
Samuel> +OPENCV_POST_INSTALL_TARGET_HOOKS += OPENCV_CLEAN_INSTALL_DOC OPENCV_CLEAN_INSTALL_CMAKE Samuel> +OPENCV_POST_INSTALL_TARGET_HOOKS += $(if $(BR2_PACKAGE_OPENCV_INSTALL_DATA),,OPENCV_CLEAN_INSTALL_DATA) Samuel> +
Samuel> +OPENCV_POST_INSTALL_STAGING_HOOKS += OPENCV_CLEAN_INSTALL_DOC
Samuel> +OPENCV_POST_INSTALL_STAGING_HOOKS += $(if $(BR2_PACKAGE_OPENCV_INSTALL_DATA),,OPENCV_CLEAN_INSTALL_DATA)

It doesn't make sense to run these target hooks when staging gets installed.

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH v5 1/1 package: add opencv

On Monday, October 24, 2011 15:35:32 Peter Korsgaard wrote:
[snip]

Quoted 19 lines

Samuel> +# Build type
Samuel> +OPENCV_CONF_OPT += -DCMAKE_BUILD_TYPE=$(if
$(BR2_ENABLE_DEBUG),Debug,Release)

While this works it looks quite different than other packages - We normally do:

OPENCV_CONF_OPT += \
                blah=.. \
                blih=.. \
                bloh=..

ifeq ($(BR2_PACKAGE_BLAH))
OPENCV_CONF_OPT += BLAH=on
OPENCV_DEPENDENCIES += blah
else
OPENCV_CONF_OPT += BLAH=OFF
endif

Quoted 3 lines

..

I've rewritten it to use that form.

Actually, for that particular one you haven't :-)

Also I think it's important to use

ifeq ($(BR2_PACKAGE_BLAH),y)

so you can easily disable it on the command line with

make BR2_PACKAGE_BLAH=n

(Of course, 'make BR2_PACKAGE_BLAH=' would still work, but it's less intuitive.)

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  31BB CF53 8660 6F88 345D  54CC A836 5879 20D7 CF43
#3 lore raw

PATCH v5 1/1 package: add opencv

2011/10/26 Arnout Vandecappelle <[email protected]>

Quoted 23 lines · On Monday, October 24, 2011 15:35:32 Peter Korsgaard wrote:

[snip]

Quoted 21 lines

Samuel> +# Build type
Samuel> +OPENCV_CONF_OPT += -DCMAKE_BUILD_TYPE=$(if
$(BR2_ENABLE_DEBUG),Debug,Release)

While this works it looks quite different than other packages - We normally do:

OPENCV_CONF_OPT += \
                blah=.. \
                blih=.. \
                bloh=..

ifeq ($(BR2_PACKAGE_BLAH))
OPENCV_CONF_OPT += BLAH=on
OPENCV_DEPENDENCIES += blah
else
OPENCV_CONF_OPT += BLAH=OFF
endif

..

Quoted 8 lines
Quoted 1 line

I've rewritten it to use that form.

Actually, for that particular one you haven't :-)

Also I think it's important to use

ifeq ($(BR2_PACKAGE_BLAH),y)

Actually, in the 1st version of the patch it was this form, then I changed it following the comments of Thomas P. ...

Using one or the other form does not change anything, it is just a matter of consistency.

Defining some rules like these can certainly be gathered into a "developer guide-line" or something like that.
If everybody follows the same form/standard (whatever you call it) it will make easier processing submitted patches.
It could also allow to develop some checker scripts.

Regards,

Sam

Quoted 12 lines

so you can easily disable it on the command line with

make BR2_PACKAGE_BLAH=n

(Of course, 'make BR2_PACKAGE_BLAH=' would still work, but it's less intuitive.)

Regards,
Arnout

Quoted 9 lines

--

Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR
Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  31BB CF53 8660 6F88 345D  54CC A836 5879 20D7 CF43

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20111027/84a0b624/attachment-0001.html>