我尝试使用 JavaCV 在 eclipse 中实现一个程序。这是示例代码,
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);
}
}
当我运行程序时出现异常
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
我也为环境变量提供了正确的路径。我还从 javacv-bin 添加了外部 Jar 文件。我给出的路径是 CLASSPATH D:\opencv\build\x86\vc10\lib D:\opencv\build\common\tbb\ia32\vc10 D:\opencv\build\x86\vc10\staticlib
路径 D:\opencv\build\common\tbb\ia32\vc10 D:\opencv\build\x86\vc10\bin
我该怎么办?我还需要添加哪些依赖库?