Skip to content

BuildOpenCV4SPARCK

maybites edited this page Sep 12, 2022 · 1 revision

For OSX

  1. Follow this nice instructions up to the point 11: 'make'

  2. Once the build is done, copy

    ~/openCV-X.Y.Z/build/bin/opencv-XYZ.jar

    and

    ~/openCV-X.Y.Z/build/lib/libopencv_javaXYZ.dylib

    to the

    sparck/java-classes/lib/ folder and rename

    libopencv_javaXYZ.dylib -> opencv_javaXYZ.dylib

  3. now we need to make changes to the Runpath Search path of the dylib.

    a nice description can be found here

    for this, open the terminal and cd to the

    sparck/java-classes/lib

    folder.

    enter

    otool -l opencv_java420.dylib
    

    in the output you will find at the end something like (maybe multiple of those)

    Load command 42
           cmd LC_RPATH
       cmdsize 40
          path <path to a library location>
    

    we first delete them by providing the complete

    install_name_tool -delete_rpath <path> opencv_java420.dylib
    

    and then add our custom path, relative to this library:

    install_name_tool -add_rpath @loader_path/opencv/libs opencv_java420.dylib
    

    now we have to copy all the opencv libraries into (the newly created folders)

    sparck/java-classes/lib/opencv/lib

For Windows

download the desired installer

unzip and copy

\opencv\build\java\x64\opencv_javaXYZ.dll

to the

sparck/java-classes/lib/ folder

The opencv_javaXYZ.jar we build for OSX should already be there, otherwise copy this one, too.

Clone this wiki locally