| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 |
|
| 25 | (define-module (gnu packages image-processing)
|
| 26 | #:use-module ((guix licenses) #:prefix license:)
|
| 27 | #:use-module (guix packages)
|
| 28 | #:use-module (guix utils)
|
| 29 | #:use-module (guix download)
|
| 30 | #:use-module (guix build-system cmake)
|
| 31 | #:use-module (guix build-system gnu)
|
| 32 | #:use-module (gnu packages)
|
| 33 | #:use-module (gnu packages algebra)
|
| 34 | #:use-module (gnu packages boost)
|
| 35 | #:use-module (gnu packages compression)
|
| 36 | #:use-module (gnu packages documentation)
|
| 37 | #:use-module (gnu packages fontutils)
|
| 38 | #:use-module (gnu packages gl)
|
| 39 | #:use-module (gnu packages gnome)
|
| 40 | #:use-module (gnu packages graphics)
|
| 41 | #:use-module (gnu packages graphviz)
|
| 42 | #:use-module (gnu packages gtk)
|
| 43 | #:use-module (gnu packages image)
|
| 44 | #:use-module (gnu packages maths)
|
| 45 | #:use-module (gnu packages perl)
|
| 46 | #:use-module (gnu packages photo)
|
| 47 | #:use-module (gnu packages pkg-config)
|
| 48 | #:use-module (gnu packages protobuf)
|
| 49 | #:use-module (gnu packages python)
|
| 50 | #:use-module (gnu packages serialization)
|
| 51 | #:use-module (gnu packages video)
|
| 52 | #:use-module (gnu packages xiph)
|
| 53 | #:use-module (gnu packages xml)
|
| 54 | #:use-module (gnu packages xorg))
|
| 55 |
|
| 56 | |
| 57 | |
| 58 | |
| 59 | (define-public dcmtk
|
| 60 | (package
|
| 61 | (name "dcmtk")
|
| 62 | (version "3.6.1_20170228")
|
| 63 | (source (origin
|
| 64 | (method url-fetch)
|
| 65 | (uri (string-append "ftp://dicom.offis.de/pub/dicom/offis/"
|
| 66 | "software/dcmtk/snapshot/dcmtk-"
|
| 67 | version ".tar.gz"))
|
| 68 | (sha256
|
| 69 | (base32
|
| 70 | "04cwfx8yrscqcd59mxk2fh6314ckayi9cp68iql5a57pf2pg5qld"))))
|
| 71 | (build-system gnu-build-system)
|
| 72 | (inputs
|
| 73 | `(("libtiff" ,libtiff)
|
| 74 | ("libpng" ,libpng)
|
| 75 | ("doxygen" ,doxygen)
|
| 76 | ("zlib" ,zlib)))
|
| 77 | (native-inputs
|
| 78 | `(("perl" ,perl)))
|
| 79 | (home-page "http://dcmtk.org")
|
| 80 | (synopsis "Libraries and programs implementing parts of the DICOM standard")
|
| 81 | (description "DCMTK is a collection of libraries and applications
|
| 82 | implementing large parts the DICOM standard. It includes software for
|
| 83 | examining, constructing and converting DICOM image files, handling offline
|
| 84 | media, sending and receiving images over a network connection, as well as
|
| 85 | demonstrative image storage and worklist servers.")
|
| 86 | (license (license:fsf-free
|
| 87 | "file://COPYRIGHT"
|
| 88 | "A union of the Apache 2.0 licence and various non-copyleft
|
| 89 | licences similar to the Modified BSD licence."))))
|
| 90 |
|
| 91 | (define-public mia
|
| 92 | (package
|
| 93 | (name "mia")
|
| 94 | (version "2.4.6")
|
| 95 | (source (origin
|
| 96 | (method url-fetch)
|
| 97 | (uri (string-append "mirror://sourceforge/mia/mia/"
|
| 98 | (version-major+minor version)
|
| 99 | "/mia-" version ".tar.xz"))
|
| 100 | (sha256
|
| 101 | (base32
|
| 102 | "0j4nd5z7i3v199jh7hqqhwd4g7snchizkc7rhzanpvngqg91m1pb"))))
|
| 103 | (build-system cmake-build-system)
|
| 104 | (arguments
|
| 105 | `(#:configure-flags
|
| 106 | (list "-DMIA_CREATE_NIPYPE_INTERFACES=0"
|
| 107 | "-DCMAKE_CXX_FLAGS=-fpermissive")))
|
| 108 | (inputs
|
| 109 | `(("boost" ,boost)
|
| 110 | ("dcmtk" ,dcmtk)
|
| 111 | ("doxygen" ,doxygen)
|
| 112 | ("eigen" ,eigen)
|
| 113 | ("fftw" ,fftw)
|
| 114 | ("fftwf" ,fftwf)
|
| 115 | ("gsl" ,gsl)
|
| 116 | ("gts" ,gts)
|
| 117 | ("hdf5" ,hdf5)
|
| 118 | ("itpp" ,itpp)
|
| 119 | ("libjpeg" ,libjpeg)
|
| 120 | ("libpng" ,libpng)
|
| 121 | ("libtiff" ,libtiff)
|
| 122 | ("libxml" ,libxml2)
|
| 123 | ("libxml++" ,libxml++)
|
| 124 | ("maxflow" ,maxflow)
|
| 125 | ("niftilib" ,niftilib)
|
| 126 | ("nlopt" ,nlopt)
|
| 127 | ("openexr" ,openexr)
|
| 128 | ("python-lxml" ,python2-lxml)
|
| 129 | ("vtk" ,vtk)))
|
| 130 | (native-inputs
|
| 131 | `(("pkg-config" ,pkg-config)
|
| 132 | ("python" ,python-2)))
|
| 133 | (home-page "http://mia.sourceforge.net")
|
| 134 | (synopsis "Toolkit for gray scale medical image analysis")
|
| 135 | (description "MIA provides a combination of command line tools, plug-ins,
|
| 136 | and libraries that make it possible run image processing tasks interactively
|
| 137 | in a command shell and to prototype using the shell's scripting language. It
|
| 138 | is built around a plug-in structure that makes it easy to add functionality
|
| 139 | without compromising the original code base and it makes use of a wide variety
|
| 140 | of external libraries that provide additional functionality.")
|
| 141 | (license license:gpl3+)))
|
| 142 |
|
| 143 | (define-public vtk
|
| 144 | (package
|
| 145 | (name "vtk")
|
| 146 | (version "7.1.0")
|
| 147 | (source (origin
|
| 148 | (method url-fetch)
|
| 149 | (uri (string-append "http://www.vtk.org/files/release/"
|
| 150 | (version-major+minor version)
|
| 151 | "/VTK-" version ".tar.gz"))
|
| 152 | (sha256
|
| 153 | (base32
|
| 154 | "0yj96z58haan77gzilnqp7xpf8hg5jk11a3jx55p2ksd400s0gjz"))))
|
| 155 | (build-system cmake-build-system)
|
| 156 | (arguments
|
| 157 | '(#:build-type "Release" |
| 158 | |
| 159 | #:configure-flags '("-DVTK_USE_SYSTEM_EXPAT:BOOL=TRUE"
|
| 160 | "-DVTK_USE_SYSTEM_FREETYPE:BOOL=TRUE"
|
| 161 | "-DVTK_USE_SYSTEM_HDF5:BOOL=TRUE"
|
| 162 | "-DVTK_USE_SYSTEM_JPEG:BOOL=TRUE"
|
| 163 | "-DVTK_USE_SYSTEM_JSONCPP:BOOL=TRUE"
|
| 164 | "-DVTK_USE_SYSTEM_LIBXML2:BOOL=TRUE"
|
| 165 | "-DVTK_USE_SYSTEM_OGGTHEORA:BOOL=TRUE"
|
| 166 | "-DVTK_USE_SYSTEM_PNG:BOOL=TRUE"
|
| 167 | "-DVTK_USE_SYSTEM_TIFF:BOOL=TRUE"
|
| 168 | "-DVTK_USE_SYSTEM_ZLIB:BOOL=TRUE")
|
| 169 | #:tests? #f)) |
| 170 | (inputs
|
| 171 | `(("libXt" ,libxt)
|
| 172 | ("xorgproto" ,xorgproto)
|
| 173 | ("libX11" ,libx11)
|
| 174 | ("libxml2" ,libxml2)
|
| 175 | ("mesa" ,mesa)
|
| 176 | ("glu" ,glu)
|
| 177 | ("expat" ,expat)
|
| 178 | ("freetype" ,freetype)
|
| 179 | ("hdf5" ,hdf5)
|
| 180 | ("jpeg" ,libjpeg)
|
| 181 | ("jsoncpp" ,jsoncpp)
|
| 182 | ("libogg" ,libogg)
|
| 183 | ("libtheora" ,libtheora)
|
| 184 | ("png" ,libpng)
|
| 185 | ("tiff" ,libtiff)
|
| 186 | ("zlib" ,zlib)))
|
| 187 | (home-page "http://www.vtk.org/")
|
| 188 | (synopsis "Libraries for 3D computer graphics")
|
| 189 | (description
|
| 190 | "The Visualization Toolkit (VTK) is a C++ library for 3D computer graphics,
|
| 191 | image processing and visualization. It supports a wide variety of
|
| 192 | visualization algorithms including: scalar, vector, tensor, texture, and
|
| 193 | volumetric methods; and advanced modeling techniques such as: implicit
|
| 194 | modeling, polygon reduction, mesh smoothing, cutting, contouring, and Delaunay
|
| 195 | triangulation. VTK has an extensive information visualization framework, has
|
| 196 | a suite of 3D interaction widgets, supports parallel processing, and
|
| 197 | integrates with various databases on GUI toolkits such as Qt and Tk.")
|
| 198 | (license license:bsd-3)))
|
| 199 |
|
| 200 | (define-public opencv
|
| 201 | (package
|
| 202 | (name "opencv")
|
| 203 | (version "3.4.3")
|
| 204 | (source (origin
|
| 205 | (method url-fetch)
|
| 206 | (uri (string-append "https://github.com/opencv/opencv/archive/"
|
| 207 | version ".zip"))
|
| 208 | (file-name (string-append name "-" version ".zip"))
|
| 209 | (sha256
|
| 210 | (base32
|
| 211 | "0pycx1pz8lj794q32mlalyc3ijqxwsyin65r26nh4yc0p71xiirp"))
|
| 212 | (modules '((guix build utils)))
|
| 213 | (snippet
|
| 214 | '(begin
|
| 215 | |
| 216 | (delete-file-recursively "3rdparty")
|
| 217 |
|
| 218 | |
| 219 | (delete-file-recursively "modules/highgui/src/files_Qt/Milky")
|
| 220 |
|
| 221 | |
| 222 | (for-each delete-file
|
| 223 | '("modules/java/test/pure_test/lib/junit-4.11.jar"
|
| 224 | "samples/java/sbt/sbt/sbt-launch.jar"))))))
|
| 225 | (build-system cmake-build-system)
|
| 226 | (arguments
|
| 227 | `(#:configure-flags
|
| 228 | (list "-DWITH_IPP=OFF"
|
| 229 | "-DWITH_ITT=OFF"
|
| 230 |
|
| 231 | |
| 232 | |
| 233 | |
| 234 | |
| 235 | |
| 236 | |
| 237 | "-DCPU_BASELINE=SSE2, NEON"
|
| 238 |
|
| 239 | "-DCPU_DISPATCH=SSE3,SSSE3,SSE4_1,SSE4_2,AVX,AVX2"
|
| 240 | "-DCPU_DISPATCH_REQUIRE=SSE3,SSSE3,SSE4_1,SSE4_2,AVX,AVX2"
|
| 241 |
|
| 242 | "-DBUILD_PERF_TESTS=OFF"
|
| 243 | "-D BUILD_TESTS=ON"
|
| 244 |
|
| 245 | (string-append "-DOPENCV_EXTRA_MODULES_PATH="
|
| 246 | "/tmp/guix-build-opencv-" ,version ".drv-0"
|
| 247 | "/opencv-contrib/opencv_contrib-" ,version
|
| 248 | "/modules")
|
| 249 |
|
| 250 | |
| 251 | (string-append "-DOPENCV_TEST_DATA_PATH="
|
| 252 | "/tmp/guix-build-opencv-" ,version ".drv-0"
|
| 253 | |
| 254 | "/opencv-extra/opencv_extra-" ,version
|
| 255 | "/testdata")
|
| 256 |
|
| 257 | |
| 258 | |
| 259 | "-DBUILD_PROTOBUF=OFF"
|
| 260 |
|
| 261 | |
| 262 | |
| 263 | |
| 264 | "-DPROTOBUF_UPDATE_FILES=ON"
|
| 265 |
|
| 266 | |
| 267 | |
| 268 | |
| 269 | |
| 270 | |
| 271 | "-DBUILD_opencv_xfeatures2d=OFF")
|
| 272 | #:phases
|
| 273 | (modify-phases %standard-phases
|
| 274 | (add-after 'unpack 'disable-broken-tests
|
| 275 | (lambda _
|
| 276 | |
| 277 | |
| 278 | |
| 279 | (substitute* '("modules/viz/test/test_tutorial3.cpp"
|
| 280 | "modules/viz/test/test_main.cpp"
|
| 281 | "modules/viz/test/tests_simple.cpp"
|
| 282 | "modules/viz/test/test_viz3d.cpp")
|
| 283 | (("(TEST\\(Viz, )([a-z].*\\).*)" all pre post)
|
| 284 | (string-append pre "DISABLED_" post)))
|
| 285 |
|
| 286 | |
| 287 | |
| 288 | (substitute* (list (string-append
|
| 289 | "../opencv-contrib/opencv_contrib-"
|
| 290 | ,version
|
| 291 | "/modules/face/test/test_face_align.cpp"))
|
| 292 | (("(TEST\\(CV_Face_FacemarkKazemi, )(can_detect_landmarks\\).*)"
|
| 293 | all pre post)
|
| 294 | (string-append pre "DISABLED_" post)))
|
| 295 |
|
| 296 | |
| 297 | |
| 298 | (substitute* (list (string-append
|
| 299 | "../opencv-contrib/opencv_contrib-"
|
| 300 | ,version
|
| 301 | "/modules/rgbd/test/test_odometry.cpp"))
|
| 302 | (("(TEST\\(RGBD_Odometry_Rgbd, )(algorithmic\\).*)" all pre post)
|
| 303 | (string-append pre "DISABLED_" post)))
|
| 304 | #t))
|
| 305 |
|
| 306 | |
| 307 | (add-after 'unpack 'unpack-submodule-sources
|
| 308 | (lambda* (#:key inputs #:allow-other-keys)
|
| 309 | (mkdir "../opencv-extra")
|
| 310 | (mkdir "../opencv-contrib")
|
| 311 | (let ((unpack (lambda (source target)
|
| 312 | (with-directory-excursion target
|
| 313 | (apply invoke "unzip"
|
| 314 | (list (assoc-ref inputs source)))))))
|
| 315 | (unpack "opencv-extra" "../opencv-extra")
|
| 316 | (unpack "opencv-contrib" "../opencv-contrib"))))
|
| 317 |
|
| 318 | (add-after 'set-paths 'add-ilmbase-include-path
|
| 319 | (lambda* (#:key inputs #:allow-other-keys)
|
| 320 | |
| 321 | |
| 322 | |
| 323 | (setenv "CPATH"
|
| 324 | (string-append (assoc-ref inputs "ilmbase")
|
| 325 | "/include/OpenEXR"
|
| 326 | ":" (or (getenv "CPATH") "")))
|
| 327 | #t))
|
| 328 | (add-before 'check 'start-xserver
|
| 329 | (lambda* (#:key inputs #:allow-other-keys)
|
| 330 | (let ((xorg-server (assoc-ref inputs "xorg-server"))
|
| 331 | (disp ":1"))
|
| 332 | (setenv "HOME" (getcwd))
|
| 333 | (setenv "DISPLAY" disp)
|
| 334 | |
| 335 | |
| 336 | (zero? (system (format #f "~a/bin/Xvfb ~a &" xorg-server disp)))))))))
|
| 337 | (native-inputs
|
| 338 | `(("unzip" ,unzip)
|
| 339 | ("pkg-config" ,pkg-config)
|
| 340 | ("xorg-server" ,xorg-server) |
| 341 | ("opencv-extra"
|
| 342 | ,(origin
|
| 343 | (method url-fetch)
|
| 344 | (uri (string-append "https://codeload.github.com/"
|
| 345 | "opencv/opencv_extra/zip/" version))
|
| 346 | (file-name (string-append "opencv-extra-" version ".zip"))
|
| 347 | (sha256
|
| 348 | (base32 "0yd1vidzbg6himxyh4yzivywijg8548kfmcn421khabnipm7l74y"))))
|
| 349 | ("opencv-contrib"
|
| 350 | ,(origin
|
| 351 | (method url-fetch)
|
| 352 | (uri (string-append "https://codeload.github.com/"
|
| 353 | "opencv/opencv_contrib/zip/" version))
|
| 354 | (file-name (string-append "opencv-contrib-" version ".zip"))
|
| 355 | (sha256
|
| 356 | (base32 "0j0ci6ia1qwklp9hq07ypl0vkngj1wrgh6n98n657m5d0pyp4m0g"))))))
|
| 357 | (inputs `(("libjpeg" ,libjpeg)
|
| 358 | ("libpng" ,libpng)
|
| 359 | ("jasper" ,jasper)
|
| 360 | |
| 361 | ("ffmpeg" ,ffmpeg-3.4)
|
| 362 | ("libtiff" ,libtiff)
|
| 363 | ("hdf5" ,hdf5)
|
| 364 | ("libgphoto2" ,libgphoto2)
|
| 365 | ("libwebp" ,libwebp)
|
| 366 | ("zlib" ,zlib)
|
| 367 | ("gtkglext" ,gtkglext)
|
| 368 | ("openexr" ,openexr)
|
| 369 | ("ilmbase" ,ilmbase)
|
| 370 | ("gtk+" ,gtk+-2)
|
| 371 | ("python-numpy" ,python-numpy)
|
| 372 | ("protobuf" ,protobuf)
|
| 373 | ("vtk" ,vtk)
|
| 374 | ("python" ,python)))
|
| 375 | |
| 376 | |
| 377 | (properties '((lint-hidden-cve . ("CVE-2018-7712"
|
| 378 | "CVE-2018-7713"
|
| 379 | "CVE-2018-7714"))))
|
| 380 | (synopsis "Computer vision library")
|
| 381 | (description "OpenCV is a library aimed at
|
| 382 | real-time computer vision, including several hundred computer
|
| 383 | vision algorithms. It can be used to do things like:
|
| 384 |
|
| 385 | @itemize
|
| 386 | @item image and video input and output
|
| 387 | @item image and video processing
|
| 388 | @item displaying
|
| 389 | @item feature recognition
|
| 390 | @item segmentation
|
| 391 | @item facial recognition
|
| 392 | @item stereo vision
|
| 393 | @item structure from motion
|
| 394 | @item augmented reality
|
| 395 | @item machine learning
|
| 396 | @end itemize\n")
|
| 397 | (home-page "https://opencv.org/")
|
| 398 | (license license:bsd-3)))
|