3

I tried implementing a program in eclipse using JavaCV. Here is the sample code,

import static com.googlecode.javacv.cpp.opencv_core.*;
import static com.googlecode.javacv.cpp.opencv_imgproc.*;
import static com.googlecode.javacv.cpp.opencv_highgui.*;
public class JavaCVProj01 
         {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        IplImage img = cvLoadImage("Paris.jpeg");
        cvShowImage("Paris",img);
        cvSmooth(img,img,CV_GAUSSIAN,13);
        cvShowImage("BlurImage",img);

        cvWaitKey();
        cvReleaseImage(img);

    }

}

When I run the program I get an exception

Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\Bhavana\AppData\Local\Temp\javacpp34629596157210\jniopencv_core.dll: Can't find dependent libraries
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(Unknown Source)
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.load0(Unknown Source)
    at java.lang.System.load(Unknown Source)
    at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:566)
    at com.googlecode.javacpp.Loader.load(Loader.java:489)
    at com.googlecode.javacpp.Loader.load(Loader.java:431)
    at com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:136)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.googlecode.javacpp.Loader.load(Loader.java:453)
    at com.googlecode.javacv.cpp.opencv_imgproc.<clinit>(opencv_imgproc.java:97)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.googlecode.javacpp.Loader.load(Loader.java:453)
    at com.googlecode.javacv.cpp.opencv_highgui.<clinit>(opencv_highgui.java:85)
    at demo.main(demo.java:13)
Caused by: java.lang.UnsatisfiedLinkError: no opencv_core244 in java.library.path
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:593)
    at com.googlecode.javacpp.Loader.load(Loader.java:481)
    ... 11 more

I have given right path for the environment variables also. And I aslo added external Jar files from javacv-bin. The paths i gave were CLASSPATH D:\opencv\build\x86\vc10\lib D:\opencv\build\common\tbb\ia32\vc10 D:\opencv\build\x86\vc10\staticlib

PATH D:\opencv\build\common\tbb\ia32\vc10 D:\opencv\build\x86\vc10\bin

What do I do?What are those dependent libraries I still got to add?

4 Answers 4

1

Just copying the opencv directory to C:\ drive should solve this. That is probably the easiest way out compared to setting all the paths right. This is mentioned somewhere in the JavaCV documentation (can't find it now).

Sign up to request clarification or add additional context in comments.

Comments

1

These errors happen if the version of your OpenCV is not compatible with JavaCV-Bin.

For example:

  • OpenCV 2.4.0 and JAVA-BIN 0.2 = not compatible

  • OpenCV 2.4.3 and JAVA-BIN 0.3 = compatible


Make sure you restart after installation

1 Comment

Please, don't type uppercase your entire answer, it seems you're yelling the question ;) Thank you!
0

your PATH should NOT look like this:

D:\opencv\build\common\tbb\ia32\vc10 D:\opencv\build\x86\vc10\bin

but like this:

"D:\opencv\build\common\tbb\ia32\vc10";"D:\opencv\build\x86\vc10\bin"

(note the semicolon instead of the blanks)

same applies to the CLASSPATH !

1 Comment

Ok, I actually did give a semi-colon but i forgot to mention it here previously. I still got the same error.
0

Almost the same question I answered.

You should add path to opencv_java244.dll to %PATH% environment variable.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.