Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

UnsatisfiedLinkError Java OpenCV 3.0.0

Dear all,

I just compiled Opencv-3.0.0 from the source code on Github with the following options: I'm running on Redhat 6.6.

mkdir build
cd build
cmake -D WITH_PTHREADS_PF=OFF -D WITH_OPENMP=ON -D WITH_IPP=OFF -DBUILD_SHARED_LIBS=OFF -D CMAKE_INSTALL_PREFIX=. ../
make -j8

Things seem to go well and the ant build also succeeds. In my build/lib directory I have a splendid 15 megabyte libopencv_java300.so, and in my build/bin directory a very lovely opencv-300.jar.

In order to test things out I've been using my Scala console. Here's the short program that I execute in the read-eval-print-loop:

[me@home lib]$ LD_LIBRARY_PATH=. scala -classpath ../bin/opencv-300.jar
Welcome to Scala version 2.10.4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_79).
Type in expressions to have them evaluated.
Type :help for more information.

scala> import org.opencv.core._
import org.opencv.core._

scala> System.loadLibrary(Core.NATIVE_LIBRARY_NAME)

scala> new Rect(0,0,100,100)
res1: org.opencv.core.Rect = {0, 0, 100x100}

scala> new Scalar(10f)
res2: org.opencv.core.Scalar = [10.0, 0.0, 0.0, 0.0]

scala> new Mat(10,10, CvType.CV_32S)
java.lang.UnsatisfiedLinkError: org.opencv.core.Mat.n_Mat(III)J
        at org.opencv.core.Mat.n_Mat(Native Method)
        at org.opencv.core.Mat.<init>(Mat.java:37)
        at .<init>(<console>:11)
        at .<clinit>(<console>)
        at .<init>(<console>:7)
        at .<clinit>(<console>)

OpenCV 2.4.11 works wonderfully, but I was hoping to take advantage of a few of the improvements in 3.0.0, such as the new FeatureDescriptors and some of the improved Java API. Unfortunately, I haven't been able to get to the bottom of the UnsatisfiedLinkError. I would greatly appreciate any advice!