From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fFkzU-0002Bt-1j for guix-patches@gnu.org; Mon, 07 May 2018 14:36:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fFkzS-0002ls-6P for guix-patches@gnu.org; Mon, 07 May 2018 14:36:04 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:45270) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fFkzS-0002lc-3b for guix-patches@gnu.org; Mon, 07 May 2018 14:36:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fFkzR-0006ys-TL for guix-patches@gnu.org; Mon, 07 May 2018 14:36:01 -0400 Subject: [bug#30801] Add opencv Resent-Message-ID: Date: Mon, 7 May 2018 20:35:47 +0200 From: =?UTF-8?Q?Bj=C3=B6rn_?= =?UTF-8?Q?H=C3=B6fling?= Message-ID: <20180507203547.3ae3cb35@alma-ubu> In-Reply-To: <87a7unglrh.fsf@gnu.org> References: <20180313175809.7d782c1a@alma-ubu> <87po45rqx5.fsf@gnu.org> <20180401002649.37231b47@alma-ubu> <87a7unglrh.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/5tc.tVMpAtwr2Ap/UzXB5hL"; protocol="application/pgp-signature" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 30801@debbugs.gnu.org --Sig_/5tc.tVMpAtwr2Ap/UzXB5hL Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Here is another update: * Kept it in one output. * No, there are no .a-files. * I tried to build the documentation, but somehow it did not work. Postponed for the next update. * Added more to the description. * The new ffmpeg 4.0 caused a core dump during test phase, so I set it explicitly to the old 3.4. Bj=C3=B6rn =46rom 0e234430fec497d3c7702e288474e39d37cb8ae8 Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?Bj=3DC3=3DB6rn=3D20H=3DC3=3DB6fling?=3D Date: Fri, 16 Feb 2018 20:31:37 +0100 Subject: [PATCH] gnu: Add opencv. * gnu/packages/image-processing.scm (opencv): New variable. --- gnu/packages/image-processing.scm | 200 ++++++++++++++++++++++++++++++ 1 file changed, 200 insertions(+) diff --git a/gnu/packages/image-processing.scm b/gnu/packages/image-process= ing.scm index 6705a726c..ef303e134 100644 --- a/gnu/packages/image-processing.scm +++ b/gnu/packages/image-processing.scm @@ -5,6 +5,7 @@ ;;; Copyright =C2=A9 2014 Mark H Weaver ;;; Copyright =C2=A9 2016 Eric Bavier ;;; Copyright =C2=A9 2018 Tobias Geerinckx-Rice +;;; Copyright =C2=A9 2018 Bj=C3=B6rn H=C3=B6fling ;;; ;;; This file is part of GNU Guix. ;;; @@ -38,12 +39,16 @@ #:use-module (gnu packages gnome) #:use-module (gnu packages graphics) #:use-module (gnu packages graphviz) + #:use-module (gnu packages gtk) #:use-module (gnu packages image) #:use-module (gnu packages maths) #:use-module (gnu packages perl) + #:use-module (gnu packages photo) #:use-module (gnu packages pkg-config) + #:use-module (gnu packages protobuf) #:use-module (gnu packages python) #:use-module (gnu packages serialization) + #:use-module (gnu packages video) #:use-module (gnu packages xiph) #:use-module (gnu packages xml) #:use-module (gnu packages xorg)) @@ -191,3 +196,198 @@ triangulation. VTK has an extensive information visu= alization framework, has a suite of 3D interaction widgets, supports parallel processing, and integrates with various databases on GUI toolkits such as Qt and Tk.") (license license:bsd-3))) + +(define-public opencv + (package + (name "opencv") + (version "3.4.1") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/opencv/opencv/archiv= e/" + version ".zip")) + (file-name (string-append name "-" version ".zip")) + (sha256 + (base32 + "1g8pvnlkzzp50amd89149hqsbvsc2hq3vk1d6a9fksdcx8ra9g94")) + (modules '((guix build utils))) + (snippet + '(begin + ;; Remove external libraries. We have all available in G= uix: + (delete-file-recursively "3rdparty") + + ;; Milky icon set is non-free: + (delete-file-recursively "modules/highgui/src/files_Qt/M= ilky") + + ;; Some jars found: + (for-each delete-file + '("modules/java/test/pure_test/lib/junit-4.11.= jar" + "samples/java/sbt/sbt/sbt-launch.jar")))))) + (build-system cmake-build-system) + (arguments + `(#:configure-flags + (list "-DWITH_IPP=3DOFF" + "-DWITH_ITT=3DOFF" + + ;; CPU-Features: + ;; See cmake/OpenCVCompilerOptimizations.cmake + ;; (CPU_ALL_OPTIMIZATIONS) for a list of all optimizations + ;; BASELINE is the minimum optimization all CPUs must support + ;; + ;; DISPATCH is the list of optional dispatches + "-DCPU_BASELINE=3DSSE2, NEON" + + "-DCPU_DISPATCH=3DSSE3,SSSE3,SSE4_1,SSE4_2,AVX,AVX2" + "-DCPU_DISPATCH_REQUIRE=3DSSE3,SSSE3,SSE4_1,SSE4_2,AVX,AVX2" + + "-DBUILD_PERF_TESTS=3DOFF" + "-D BUILD_TESTS=3DON" + + (string-append "-DOPENCV_EXTRA_MODULES_PATH=3D" + "/tmp/guix-build-opencv-" ,version ".drv-0" + "/opencv-contrib/opencv_contrib-" ,version + "/modules") + + ;;Define test data: + (string-append "-DOPENCV_TEST_DATA_PATH=3D" + "/tmp/guix-build-opencv-" ,version ".drv-0" + ;;"/opencv-3.4.0" + "/opencv-extra/opencv_extra-" ,version + "/testdata") + + ;; Is ON by default and would try to rebuild 3rd-party protob= uf, + ;; which we had removed, which would lead to an error: + "-DBUILD_PROTOBUF=3DOFF" + + ;; Rebuild protobuf files, because we have a slightly differe= nt + ;; version than the included one. If we would not update, we + ;; would get a compile error later: + "-DPROTOBUF_UPDATE_FILES=3DON" + + ;; xfeatures2d disabled, because it downloads extra binaries = from + ;; https://github.com/opencv/opencv_3rdparty + ;; defined in xfeatures2d/cmake/download_{vgg|bootdesc}.cmake + ;; Cmp this bug entry: + ;; https://github.com/opencv/opencv_contrib/issues/1131 + "-DBUILD_opencv_xfeatures2d=3DOFF") + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'disable-broken-tests + (lambda _ + ;; These tests fails with: + ;; vtkXOpenGLRenderWindow (0x723990): Could not find a decent= config + ;; I think we have no OpenGL support with the Xvfb. + (substitute* '("modules/viz/test/test_tutorial3.cpp" + "modules/viz/test/test_main.cpp" + "modules/viz/test/tests_simple.cpp" + "modules/viz/test/test_viz3d.cpp") + (("(TEST\\(Viz, )([a-z].*\\).*)" all pre post) + (string-append pre "DISABLED_" post))) + + ;; This one fails with "unknown file: Failure" + ;; But I couldn't figure out which file was missing: + (substitute* (list (string-append + "../opencv-contrib/opencv_contrib-" + ,version + "/modules/face/test/test_face_align.cpp")) + (("(TEST\\(CV_Face_FacemarkKazemi, )(can_detect_landmarks\\= ).*)" + all pre post) + (string-append pre "DISABLED_" post))) + + ;; Failure reason: Bad accuracy + ;; Incorrect count of accurate poses [2nd case]: 90.000000 / = 94.000000 + (substitute* (list (string-append + "../opencv-contrib/opencv_contrib-" + ,version + "/modules/rgbd/test/test_odometry.cpp")) + (("(TEST\\(RGBD_Odometry_Rgbd, )(algorithmic\\).*)" all pre= post) + (string-append pre "DISABLED_" post))) + #t)) + + ;; Idea copied from ldc.scm (ldc-bootstrap): + (add-after 'unpack 'unpack-submodule-sources + (lambda* (#:key inputs #:allow-other-keys) + (mkdir "../opencv-extra") + (mkdir "../opencv-contrib") + (let ((unpack (lambda (source target) + (with-directory-excursion target + (apply invoke "unzip" + (list (assoc-ref inputs source))))))) + (unpack "opencv-extra" "../opencv-extra") + (unpack "opencv-contrib" "../opencv-contrib")))) + + (add-after 'set-paths 'add-ilmbase-include-path + (lambda* (#:key inputs #:allow-other-keys) + ;; OpenEXR propagates ilmbase, but its include files do not app= ear + ;; in the CPATH, so we need to add "$ilmbase/include/OpenEXR/" = to + ;; the CPATH to satisfy the dependency on "ImathVec.h". + (setenv "CPATH" + (string-append (assoc-ref inputs "ilmbase") + "/include/OpenEXR" + ":" (or (getenv "CPATH") ""))) + #t)) + (add-before 'check 'start-xserver + (lambda* (#:key inputs #:allow-other-keys) + (let ((xorg-server (assoc-ref inputs "xorg-server")) + (disp ":1")) + (setenv "HOME" (getcwd)) + (setenv "DISPLAY" disp) + ;; There must be a running X server and make check doesn't st= art one. + ;; Therefore we must do it. + (zero? (system (format #f "~a/bin/Xvfb ~a &" xorg-server disp= ))))))))) + (native-inputs + `(("unzip" ,unzip) + ("pkg-config" ,pkg-config) + ("xorg-server" ,xorg-server) ; For running the tests + ("opencv-extra" + ,(origin + (method url-fetch) + (uri (string-append "https://codeload.github.com/" + "opencv/opencv_extra/zip/" version)) + (file-name (string-append "opencv-extra-" version ".zip")) + (sha256 + (base32 "0wfh3pvfxqydf7hsccp50npcsg37sf6fqi6cd3zkc4qil9zhpbps"= )))) + ("opencv-contrib" + ,(origin + (method url-fetch) + (uri (string-append "https://codeload.github.com/" + "opencv/opencv_contrib/zip/" version)) + (file-name (string-append "opencv-contrib-" version ".zip")) + (sha256 + (base32 "18zm0qmjcdvg90c33gzv0ws0xdaid1xpqzz2xa9l2x12qkr6zj3p")= ))))) + (inputs `(("libjpeg" ,libjpeg) + ("libpng" ,libpng) + ("jasper" ,jasper) + ;; ffmpeg 4.0 causes core dumps in tests. + ("ffmpeg" ,ffmpeg-3.4) + ("libtiff" ,libtiff) + ("hdf5" ,hdf5) + ("libgphoto2" ,libgphoto2) + ("libwebp" ,libwebp) + ("zlib" ,zlib) + ("gtkglext" ,gtkglext) + ("openexr" ,openexr) + ("ilmbase" ,ilmbase) + ("gtk+" ,gtk+-2) + ("python-numpy" ,python-numpy) + ("protobuf" ,protobuf) + ("vtk" ,vtk) + ("python" ,python))) + (synopsis "Computer vision library") + (description "OpenCV is a library aimed at +real-time computer vision, including several hundred computer +vision algorithms. It can be used to do things like: + +@itemize +@item image and video input and output +@item image and video processing +@item displaying +@item feature recognition +@item segmentation +@item facial recognition +@item stereo vision +@item structure from motion +@item augmented reality +@item machine learning +@end itemize\n") + (home-page "https://opencv.org/") + (license license:bsd-3))) --=20 2.17.0 --Sig_/5tc.tVMpAtwr2Ap/UzXB5hL Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlrwnIQACgkQvyhstlk+X/1qIwCfVtn7y6rbeg7yMtwhZjKlsmyY D48AnjhRODnCVP0NkRfbok1I9EnV45SY =fMSB -----END PGP SIGNATURE----- --Sig_/5tc.tVMpAtwr2Ap/UzXB5hL--