Hello !

I want to install and work with the OpenCV on Mac . I did everything as described in this tutorial. Wrote the following code:

 import org.opencv.core.Core; import org.opencv.core.CvType; import org.opencv.core.Mat; public class Main { static { try { System.load("/Users/nikto92/Documents/opencv-2.4.13/release/bin/opencv_java2413.jar"); } catch (UnsatisfiedLinkError e) { System.err.println("Native code library failed to load.\n" + e); System.exit(1); } } public static void main(String argv[]) { System.loadLibrary( Core.NATIVE_LIBRARY_NAME ); Mat mat = Mat.eye( 3, 3, CvType.CV_8UC1 ); System.out.println( "mat = " + mat.dump() ); } } 

It produces the following error:

Native code library failed to load. java.lang.UnsatisfiedLinkError: Can't load library: /Users/nikto92/Documents/opencv-2.4.13/release/bin/opencv_java2413.jar

What have I done wrong ?

For the answer I will be very grateful. Thank !

  • so there is no))) What version of macOS ??? and kaku version of OpenCV instal ?? - Alex.B
  • @ Akuma925 opencv-2.4.13, mac os mavericks - kxko

1 answer 1

You need to rebuild the instructions here:

  • Install CMake First of all, you need to download the DMG file of the CMake binary distribution. After the installation is complete, you will be prompted to place CMake in /usr/bin , select Yes and complete the installation. To check that CMake has been successfully installed, type in Terminal

    CMake -version

  • Installing OpenCV First, download the source files of the stable version of OpenCV ( 2.4.7 in my case) Extract the files to a folder and navigate to this folder via the terminal, for example

    cd ~ / Downloads tar -xvf opencv-2.4.7.tar cd opencv-2.4.7

  • Now, we will build and install OpenCV in the Terminal, the following commands should be successfully executed (without errors)

    mkdir build cd build cmake -G "Unix Makefiles" .. make -j8 sudo make install

  • There was a question from the second stage: if I want to use this Mac on MacOS but not for iOS, do I need to download for iOS or for Linux? - kxko
  • No, you just build openCV for the target system (no matter macos linux, windows, ios, android, BSD) for what you collect under that and it will work. - Alex.B