2

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.

Community
  • 1
  • 1
snake plissken
  • 2,649
  • 10
  • 43
  • 64
  • possible duplicate of [Javacv UnsatisfiedLinkError in windows 7](http://stackoverflow.com/questions/10790613/javacv-unsatisfiedlinkerror-in-windows-7) – karlphillip Jan 15 '14 at 12:53

2 Answers2

5

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.

snake plissken
  • 2,649
  • 10
  • 43
  • 64
  • 3
    I was getting the same error. I was added to project the jars from javacv-0.7-bin.zip but missed all .jars from javacv-0.7-cppjars.zip. This link explain the way to correct configure: http://opencvlover.blogspot.in/2012/04/javacv-setup-with-eclipse-on-windows-7.html (in my case, i used the OpenCV 2.4.8) – marcostrama Mar 16 '14 at 21:42
4

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

midhun0003
  • 603
  • 1
  • 10
  • 26
  • I ve already done the first step following the instructions: NetBeans (Java SE 6 or 7): In the Projects window, right-click the Libraries node of your project, and select "Add JAR/Folder...". Locate the JAR files, select them, and click OK. But i still receiving class main not found!! – snake plissken Jan 15 '14 at 11:06
  • select the opencv jar file and set native library path for that jar file from netbeans,, i dont know how to do this in netbeans because i had done it in Eclipse. Search how to set native library location of jar file in netbeans for opencv – midhun0003 Jan 15 '14 at 11:09