unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#48251] [PATCH] gnu: Update opencv
@ 2021-05-06  5:59 Andy Tai
       [not found] ` <handler.48251.B.16202808254042.ack@debbugs.gnu.org>
  2022-11-12 20:01 ` [bug#48251] Sharlatan Hellseher
  0 siblings, 2 replies; 3+ messages in thread
From: Andy Tai @ 2021-05-06  5:59 UTC (permalink / raw)
  To: 48251

* gnu/packages/image-processing.scm (opencv): Update to 3.4.14
[arguments]: Adjust #:configure-flags.
[inputs]: add opencl-headers, ocl-icd
---
 gnu/packages/image-processing.scm | 120 +++++++++++++++++++++++-------
 1 file changed, 95 insertions(+), 25 deletions(-)

diff --git a/gnu/packages/image-processing.scm
b/gnu/packages/image-processing.scm
index ed21b26812..127fbbf8c0 100644
--- a/gnu/packages/image-processing.scm
+++ b/gnu/packages/image-processing.scm
@@ -65,6 +65,7 @@
   #:use-module (gnu packages image)
   #:use-module (gnu packages imagemagick)
   #:use-module (gnu packages maths)
+  #:use-module (gnu packages opencl)
   #:use-module (gnu packages pdf)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages photo)
@@ -385,7 +386,7 @@ integrates with various databases on GUI toolkits
such as Qt and Tk.")
 (define-public opencv
   (package
     (name "opencv")
-    (version "3.4.3")
+    (version "3.4.14")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -394,14 +395,35 @@ integrates with various databases on GUI
toolkits such as Qt and Tk.")
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "06bc61r8myym4s8im10brdjfg4wxkrvsbhhl7vr1msdan2xddzi3"))
-              (patches
-               (search-patches "opencv-fix-build-of-grfmt_jpeg2000.cpp.patch"))
+                "0xfgky4j65vq1vy6wcb6p913akgyjw0fdh9b8x6ni7xdladzi0mz"))
+              ;;(patches
+              ;; (search-patches
"opencv-fix-build-of-grfmt_jpeg2000.cpp.patch"))
               (modules '((guix build utils)))
               (snippet
                '(begin
                   ;; Remove external libraries. We have all available in Guix:
-                  (delete-file-recursively "3rdparty")
+                  ;; except quirc not packaged yet in Guix
+                  ;;(delete-file-recursively "3rdparty")
+                  (for-each delete-file-recursively
+                      '("3rdparty/carotene"
+                        "3rdparty/cpufeatures"
+                        "3rdparty/ffmpeg"
+                        "3rdparty/include"
+                        "3rdparty/ippicv"
+                        "3rdparty/ittnotify"
+                        "3rdparty/libjasper"
+                        "3rdparty/libjpeg"
+                        "3rdparty/libjpeg-turbo"
+                        "3rdparty/libpng"
+                        "3rdparty/libtengine"
+                        "3rdparty/libtiff"
+                        "3rdparty/libwebp"
+                        "3rdparty/openexr"
+                        "3rdparty/openvx"
+                        "3rdparty/protobuf"
+                        ;;"3rdparty/quirc"
+                        "3rdparty/tbb"
+                        "3rdparty/zlib"))

                   ;; Milky icon set is non-free:
                   (delete-file-recursively
"modules/highgui/src/files_Qt/Milky")
@@ -462,7 +484,23 @@ integrates with various databases on GUI toolkits
such as Qt and Tk.")
              ;; defined in xfeatures2d/cmake/download_{vgg|bootdesc}.cmake
              ;; Cmp this bug entry:
              ;; https://github.com/opencv/opencv_contrib/issues/1131
-             "-DBUILD_opencv_xfeatures2d=OFF")
+             "-DBUILD_opencv_xfeatures2d=OFF"
+
+             ;; face module disabled as it downloads data
face_landmark_model.dat, etc.
+             ;; cannot be carried out during guix package build
+             "-DBUILD_opencv_face=OFF"
+
+             ;; allowing external VTK to be found
+             (string-append "-DVTK_DIR=" (assoc-ref %build-inputs
"vtk") "/lib/cmake/vtk-8.0")
+
+             ;; allowing external OpenEXR to be found
+             ;; for OpenEXR the cmake search script for OpenEXR
assumes ilmbase libs also should be found
+             ;; else it will try to force building the local OpenEXR
in 3rdParty directory which we don't want
+             (string-append "-DOPENEXR_ROOT:PATH=" (assoc-ref
%build-inputs  "openexr"))
+             (string-append "-DILMBASE_ROOT:PATH=" (assoc-ref
%build-inputs  "ilmbase"))
+
+             )
+
        #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'disable-broken-tests
@@ -481,7 +519,7 @@ integrates with various databases on GUI toolkits
such as Qt and Tk.")
              ;; But I couldn't figure out which file was missing:
              (substitute*
"../opencv-contrib/modules/face/test/test_face_align.cpp"
                (("(TEST\\(CV_Face_FacemarkKazemi, )(can_detect_landmarks\\).*)"
-                 all pre post)
+                all pre post)
                 (string-append pre "DISABLED_" post)))

              ;; Failure reason: Bad accuracy
@@ -489,6 +527,21 @@ integrates with various databases on GUI toolkits
such as Qt and Tk.")
              (substitute*
"../opencv-contrib/modules/rgbd/test/test_odometry.cpp"
                (("(TEST\\(RGBD_Odometry_Rgbd, )(algorithmic\\).*)"
all pre post)
                 (string-append pre "DISABLED_" post)))
+
+             ;; Failure reason: data reading failure
+             ;; these tests fail due to data reading using protobuf
+             (substitute* "modules/dnn/test/test_layers.cpp"
+               (("(TEST_P\\(Test_Caffe_layers, )(Accum\\).*)" all pre post)
+                (string-append pre "DISABLED_" post)))
+             (substitute* "modules/dnn/test/test_layers.cpp"
+               (("(TEST_P\\(Test_Caffe_layers,
)(DataAugmentation\\).*)" all pre post)
+                (string-append pre "DISABLED_" post)))
+             (substitute* "modules/dnn/test/test_layers.cpp"
+               (("(TEST_P\\(Test_Caffe_layers, )(Resample\\).*)" all pre post)
+                (string-append pre "DISABLED_" post)))
+             (substitute* "modules/dnn/test/test_layers.cpp"
+               (("(TEST_P\\(Test_Caffe_layers, )(Correlation\\).*)"
all pre post)
+                (string-append pre "DISABLED_" post)))
              #t))

          (add-after 'unpack 'unpack-submodule-sources
@@ -497,10 +550,21 @@ integrates with various databases on GUI
toolkits such as Qt and Tk.")
              (mkdir "../opencv-contrib")
              (copy-recursively (assoc-ref inputs "opencv-extra")
                                "../opencv-extra")
-             (invoke "tar" "xvf"
-                     (assoc-ref inputs "opencv-contrib")
-                     "--strip-components=1"
-                     "-C" "../opencv-contrib")))
+             (copy-recursively (assoc-ref inputs "opencv-contrib")
+                               "../opencv-contrib")
+             #t))
+
+         (add-after 'unpack  'patch-cmake-files
+             (lambda _
+             ;; make ILMBASE_ROOT effective
+               (substitute* "cmake/OpenCVFindOpenEXR.cmake"
+                 (("SET\\(SEARCH_PATHS") "SET\(SEARCH_PATHS\n
\"${ILMBASE_ROOT}\""))
+
+             ;; disable 3rdparty opencl header installation
+             ;; as we use Guix's opencl header
+               (substitute* "cmake/OpenCVDetectOpenCL.cmake"
+                 (("ocv_install_3rdparty_licenses")
+                   "#ocv_install_3rdparty_licenses"))))

          (add-after 'set-paths 'add-ilmbase-include-path
            (lambda* (#:key inputs #:allow-other-keys)
@@ -512,18 +576,21 @@ integrates with various databases on GUI
toolkits such as Qt and Tk.")
                                   "/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 start one.
-             ;; Therefore we must do it.
-             (zero? (system (format #f "~a/bin/Xvfb ~a &" xorg-server
disp)))))))))
+
+         (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 start one.
+                 ;; Therefore we must do it.
+                 (zero? (system (format #f "~a/bin/Xvfb ~a &"
xorg-server disp))))
+               #t)))))
     (native-inputs
      `(("pkg-config" ,pkg-config)
        ("xorg-server" ,xorg-server-for-tests) ; For running the tests
+       ("opencl-headers" ,opencl-headers)
        ("opencv-extra"
         ,(origin
            (method git-fetch)
@@ -532,7 +599,7 @@ integrates with various databases on GUI toolkits
such as Qt and Tk.")
                   (commit version)))
            (file-name (git-file-name "opencv_extra" version))
            (sha256
-            (base32 "08p5xnq8n1jw8svvz0fnirfg7q8dm3p4a5dl7527s5xj0f9qn7lp"))))
+            (base32 "1m257hi34p511v4g3g2qx7ny8q2pgfi28lzkfmkilwhmhhw8iw0h"))))
        ("opencv-contrib"
         ,(origin
            (method git-fetch)
@@ -540,9 +607,9 @@ integrates with various databases on GUI toolkits
such as Qt and Tk.")
                   (url "https://github.com/opencv/opencv_contrib")
                   (commit version)))
            (file-name (git-file-name "opencv_contrib" version))
-           (patches (search-patches "opencv-rgbd-aarch64-test-fix.patch"))
+           ;;(patches (search-patches "opencv-rgbd-aarch64-test-fix.patch"))
            (sha256
-            (base32
"1f334glf39nk42mpqq6j732h3ql2mpz89jd4mcl678s8n73nfjh2"))))))
+            (base32
"11mqxnc5bw4yrdy7nwmrl8b98dxsql6s5pvk50dwdswlp06824m6"))))))
     (inputs `(("libjpeg" ,libjpeg-turbo)
               ("libpng" ,libpng)
               ("jasper" ,jasper)
@@ -551,15 +618,18 @@ integrates with various databases on GUI
toolkits such as Qt and Tk.")
               ("libtiff" ,libtiff)
               ("hdf5" ,hdf5)
               ("libgphoto2" ,libgphoto2)
+              ("v4l-utils" ,v4l-utils)                   ;libv4l2
               ("libwebp" ,libwebp)
               ("zlib" ,zlib)
               ("gtkglext" ,gtkglext)
               ("openexr" ,openexr)
               ("ilmbase" ,ilmbase)
-              ("gtk+" ,gtk+-2)
+              ("gtk+-2" ,gtk+-2)
+              ("gtk+" ,gtk+)
+              ("ocl-icd" ,ocl-icd) ;for OpenCL support
               ("python-numpy" ,python-numpy)
               ("protobuf" ,protobuf)
-              ("vtk" ,vtk)
+              ("vtk" ,vtk-8)
               ("python" ,python)))
     ;; These three CVEs are not a problem of OpenCV, see:
     ;; https://github.com/opencv/opencv/issues/10998
-- 
2.26.3




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [bug#48251] Acknowledgement ([PATCH] gnu: Update opencv)
       [not found] ` <handler.48251.B.16202808254042.ack@debbugs.gnu.org>
@ 2021-05-06  6:10   ` Andy Tai
  0 siblings, 0 replies; 3+ messages in thread
From: Andy Tai @ 2021-05-06  6:10 UTC (permalink / raw)
  To: 48251

A comment on the patch:

I do not have ARM64 hardware so someone interested in that aspect may
want to run the patch on ARM64 to see no bad effects.  Note the two
patches for ARM64 are commented out as they don't apply; I did not try
to update the two patches, if needed.
 wish to submit further information on this problem, please




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [bug#48251]
  2021-05-06  5:59 [bug#48251] [PATCH] gnu: Update opencv Andy Tai
       [not found] ` <handler.48251.B.16202808254042.ack@debbugs.gnu.org>
@ 2022-11-12 20:01 ` Sharlatan Hellseher
  1 sibling, 0 replies; 3+ messages in thread
From: Sharlatan Hellseher @ 2022-11-12 20:01 UTC (permalink / raw)
  To: 48251; +Cc: Ludovic Courtès, Christopher Baines

[-- Attachment #1: Type: text/plain, Size: 234 bytes --]

Hi,

I was looking for any pending patches for opencv-python but found this
orphaned one.

Current version of ocv in Guix - 4.5.4.

https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/image-processing.scm#n460

Regards,
Oleg

[-- Attachment #2: Type: text/html, Size: 569 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-12 20:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-06  5:59 [bug#48251] [PATCH] gnu: Update opencv Andy Tai
     [not found] ` <handler.48251.B.16202808254042.ack@debbugs.gnu.org>
2021-05-06  6:10   ` [bug#48251] Acknowledgement ([PATCH] gnu: Update opencv) Andy Tai
2022-11-12 20:01 ` [bug#48251] Sharlatan Hellseher

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).