Win7中的JavaCV / OpenCV错误

时间:2012-08-03 06:34:51

标签: netbeans opencv javacv

64位,JDK 1.7,OpenCV 2.40,代码的新版JavaCV

package test; 

 import static com.googlecode.javacv.cpp.opencv_core; 
 import static com.googlecode.javacv.cpp.opencv_highgui; 
 import com.googlecode.javacv.CanvasFrame; 

        public class Test{ 
        public static void main(String args) { 
        final IplImage image = cvLoadImage("img1.png");
        final CanvasFrame canvas = new CanvasFrame("Demo");
        canvas.showImage(image);
        canvas.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
  } 
} 

上述代码出现以下错误:

Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\BBPATIL\AppData\Local\Temp\javacpp173171889406337\jniopencv_core.dll: Can't find dependent libraries
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1928)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1825)
    at java.lang.Runtime.load0(Runtime.java:792)
    at java.lang.System.load(System.java:1059)
    at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:418)
    at com.googlecode.javacpp.Loader.load(Loader.java:368)
    at com.googlecode.javacpp.Loader.load(Loader.java:315)
    at com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:131)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at com.googlecode.javacpp.Loader.load(Loader.java:334)
    at com.googlecode.javacv.cpp.opencv_imgproc.<clinit>(opencv_imgproc.java:96)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at com.googlecode.javacpp.Loader.load(Loader.java:334)
    at com.googlecode.javacv.cpp.opencv_highgui.<clinit>(opencv_highgui.java:91)
    at sdmcetd.main(sdmcetd.java:11)
Java Result: 1

请有人尽快帮助我.. !!!!

2 个答案:

答案 0 :(得分:2)

将环境变量(如路径,类路径)设置为openCV目录。 如果问题存在,请从互联网下载javacv-0.1.jar并将其作为您的库。

答案 1 :(得分:0)

  • 确保您已正确设置路径变量。
  • 如果javacv和opencv应该相同的比特

您可以在以下链接中找到详细说明。

http://opencvlover.blogspot.in/2012/04/javacv-setup-with-eclipse-on-windows-7.html