gpt4 book ai didi

eclipse - 异常 "cannot find dependent library"使用 javacv

转载 作者:太空宇宙 更新时间:2023-11-03 21:09:21 25 4
gpt4 key购买 nike

我尝试使用 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 文件。我给的路径是类路径D:\opencv\build\x86\vc10\libD:\opencv\build\common\tbb\ia32\vc10D:\opencv\build\x86\vc10\staticlib

路径D:\opencv\build\common\tbb\ia32\vc10D:\opencv\build\x86\vc10\bin

我该怎么办?我还需要添加哪些依赖库?

最佳答案

只需将 opencv 目录复制到 C:\驱动器即可解决此问题。与正确设置所有路径相比,这可能是最简单的出路。 JavaCV 文档中某处提到了这一点(现在找不到)。

关于eclipse - 异常 "cannot find dependent library"使用 javacv,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15461146/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com