Question

I am trying to follow the instructions for installing javaCV from here: https://code.google.com/p/javacv/. I ve already built opencv. Actually I locate the java folder with .jar file and .dll in opencv folder and I add them in the path of my project. When I am trying to run the SimpleSample.java I am receiving Error: Could not find or load main class FaceRecognition. Is there something else I ve got to follow in order to install javaCV? My simple Code

 package simplesample;

 /**
 *
 * @author snake
 */

 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 SimpleSample{

/**
 * @param args the command line arguments
 */
public static void main(String[] args) {
    // TODO code application logic here

   }
}

EDIT2: I add some jar files (javacv-windows-x86.jar, javacpp.jar, javacv.jar) and I finally got it running. But when I am trying to read a simple jpg image:

 public static void main(String[] args) {
    // TODO code application logic here
    System.out.println("soul makosa");

    IplImage image = cvLoadImage("ef.jpg");
    if (image != null) {
        cvSmooth(image, image, CV_GAUSSIAN, 3);
        cvSaveImage("ef1.jpg", image);
        cvReleaseImage(image);
    }

}

I am reveiving the following errors:

    Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniopencv_highgui in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)
at java.lang.Runtime.loadLibrary0(Runtime.java:849)
at java.lang.System.loadLibrary(System.java:1088)
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:711)
at com.googlecode.javacpp.Loader.load(Loader.java:586)
at com.googlecode.javacpp.Loader.load(Loader.java:540)
at com.googlecode.javacv.cpp.opencv_highgui.<clinit>(opencv_highgui.java:79)
at projectcv.ProjectCV.main(ProjectCV.java:28)
    Caused by: java.lang.UnsatisfiedLinkError: C:\Documents and Settings\chrathan\Local         Settings\Temp\javacpp101399456657827\jniopencv_highgui.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1965)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1851)
at java.lang.Runtime.load0(Runtime.java:795)
at java.lang.System.load(System.java:1062)
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:700)
... 4 more
   Java Result: 1

I also add .dll file in properties->run->VM optimize as instructed here giving 'java.library.path' in netbeans for .dll/.so files. However I am still receiving the above message.

Was it helpful?

Solution

SOLVED:Ok my problems was due to the fact that I had to install specific version of javaCV. So for openCV version 2.4.6.1 I ve installed 0.6 java_CV and now works like a charm.

OTHER TIPS

You need to add native class library path while adding opencv jar file into the project

Goto the buildpath>>libraries>>opencv >> click on expand and edit " native library location" to

C:/opencv/build/java/x86

for face FaceRecognition you need to add all jar files from that site

javacv-0.7-bin.zip javacv-0.7-cppjars.zip ffmg, etc....

it will work .... Its working for me

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top