Skip to contentSkip to conversation

package/opencv4: new package

PATCH Applied Fabrice Fontaine 2 participants 2 messages Dec 26, 2020 – Jul 27, 2021

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/opencv4: new package

opencv4 is not fully backward compatible with opencv3 as "a lot of C API from OpenCV 1.x has been removed.": https://opencv.org/opencv-4-0.

Moreover, it should be noted that layout of include files as well as pkg-config filename changed since
https://github.com/opencv/opencv/commit/a95673287433fc810eda2d88b94bb234298c4cd5

All these changes mean that most of buildroot packages (e.g. vlc, ffmpeg) are not compatible with opencv4.

Here is the most important changes between opencv3 and opencv 4.5.1:
- License is Apache-2.0 (https://opencv.org/opencv-4-5-0)
- openjpeg is an optional dependency (enabled by default) since
https://github.com/opencv/opencv/commit/0384eb7d8c1a31831704e31b8bdbfbc6ff854281
jpeg2000 can be enabled through openjpeg or jasper
- pkg-config must be enabled with OPENCV_GENERATE_PKGCONFIG since
https://github.com/opencv/opencv/commit/e755a2a6e48ae02dd5136a628cc4148566a08225
- cmake is not installed in /usr/share anymore so hook can be dropped
- C++11 is required since
https://github.com/opencv/opencv/commit/d4688e6474dcd59c1d66736b744a8049f386a90b

---
Changes v1 -> v2:
- Add C++11 requirement
- Bump to version 4.5.1

 DEVELOPERS                   |   1 +
 package/Config.in            |   1 +
 package/opencv4/Config.in    | 363 +++++++++++++++++++++++++++++++++
 package/opencv4/opencv4.hash |   3 +
 package/opencv4/opencv4.mk   | 375 +++++++++++++++++++++++++++++++++++
 5 files changed, 743 insertions(+)
 create mode 100644 package/opencv4/Config.in
 create mode 100644 package/opencv4/opencv4.hash
 create mode 100644 package/opencv4/opencv4.mk
DEVELOPERS +1 -0
index ad5beba8ac..25bf087f92 100644
@@ -866,6 +866,7 @@ F:	package/motion/
 F:	package/mutt/
 F:	package/ncmpc/
 F:	package/oniguruma/
+F:	package/opencv4/
 F:	package/oprofile/
 F:	package/pcmanfm/
 F:	package/python-backcall/
package/Config.in +1 -0
index ddc0c7ce3c..0e7d6da625 100644
@@ -1481,6 +1481,7 @@ menu "Graphics"
 	source "package/libwpe/Config.in"
 	source "package/menu-cache/Config.in"
 	source "package/opencv3/Config.in"
+	source "package/opencv4/Config.in"
 	source "package/opengl/Config.in"
 	source "package/openjpeg/Config.in"
 	source "package/pango/Config.in"
package/opencv4/Config.in new file +363 -0

363 lines not on this page · raw message

package/opencv4/opencv4.hash new file +3 -0
new file mode 100644
index 0000000000..3f187b87d5
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256  e27fe5b168918ab60d58d7ace2bd82dd14a4d0bd1d3ae182952c2113f5637513  opencv4-4.5.1.tar.gz
+sha256  cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30  LICENSE
package/opencv4/opencv4.mk new file +375 -0

375 lines not on this page · raw message

Signature · 1 line
2.29.2
#1 lore raw
Quoted 21 lines · Fabrice Fontaine

opencv4 is not fully backward compatible with opencv3 as "a lot of C API from OpenCV 1.x has been removed.": https://opencv.org/opencv-4-0.

Moreover, it should be noted that layout of include files as well as pkg-config filename changed since
https://github.com/opencv/opencv/commit/a95673287433fc810eda2d88b94bb234298c4cd5

All these changes mean that most of buildroot packages (e.g. vlc, ffmpeg) are not compatible with opencv4.

Here is the most important changes between opencv3 and opencv 4.5.1:
- License is Apache-2.0 (https://opencv.org/opencv-4-5-0)
- openjpeg is an optional dependency (enabled by default) since
https://github.com/opencv/opencv/commit/0384eb7d8c1a31831704e31b8bdbfbc6ff854281
jpeg2000 can be enabled through openjpeg or jasper
- pkg-config must be enabled with OPENCV_GENERATE_PKGCONFIG since
https://github.com/opencv/opencv/commit/e755a2a6e48ae02dd5136a628cc4148566a08225
- cmake is not installed in /usr/share anymore so hook can be dropped
- C++11 is required since
https://github.com/opencv/opencv/commit/d4688e6474dcd59c1d66736b744a8049f386a90b

Quoted 1 line

Applied to master, thanks. With a few remarks.

[snip]

package/opencv4/Config.in line 9

Quoted 1 line
package/opencv4/Config.in new file +1 -0
+	depends on !BR2_PACKAGE_OPENCV3

This is very annoying. Now it's OK, but it makes it a lot harder for another
package to select opencv4 - it quickly leads to circular dependencies (I experienced that with lapack/clapack).

Unfortunately, I don't know a good solution. A choice doesn't help either. The
best is actually if we can make the two side-by-side installable. The only conflicting files are the .so symlinks. So, we could install the opencv4 .so symlinks in a different directory and add an explicit -L to the dependent packages.

On the other hand - opencv3 is dead, so mid-term we're going to remove it
anyway. So I guess we can live with packages depending on !OPENCV3.

[snip]

package/opencv4/Config.in

Quoted 4 lines
package/opencv4/Config.in new file +4 -0
+config BR2_PACKAGE_OPENCV4_WITH_GSTREAMER1
+	bool "gstreamer-1.x"
+	depends on BR2_USE_MMU # gstreamer1 -> libglib2
+	depends on BR2_USE_WCHAR # gstreamer1 -> libglib> +	depends on BR2_TOOLCHAIN_HAS_THREADS # gstreamer1 -> libglib2

These two are redundant with the dependencies of opencv4 itself. Normally I
like to keep them anyway, but since it also allows to remove the comment below, I removed it in this case.

There was another one like that as well.

Quoted 9 lines
package/opencv4/Config.in new file +9 -0
+	select BR2_PACKAGE_GSTREAMER1
+	select BR2_PACKAGE_GST1_PLUGINS_BASE
+	select BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_APP
+	help
+	  Enable gstreamer support.
+
+comment "gstreamer support needs a toolchain w/ wchar, threads"
+	depends on BR2_USE_MMU
+	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS

[snip]

Quoted 1 line

+comment "opencv4 needs a toolchain w/ C++, NPTL, wchar, dynamic library, gcc >= .8"

4.8

[snip]
_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot