我刚开始在 MacOSX 下使用 JavaCV。我从最新的源代码用 CMake 编译了 OpenCV,并将库所在的路径放入-Djava.library.path=\path\to\libraries
JVM 参数中,并在我的项目设置中添加了 JavaCV 库。我还尝试了其他几个 Classpath 的变体。但是当我启动一个简单的项目以从我的网络摄像头中抓取一张图像时,我收到以下错误:
Exception in thread "Thread-3" java.lang.UnsatisfiedLinkError: no jnivideoInputLib in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1758)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1045)
at com.googlecode.javacpp.Loader.load(Loader.java:358)
at com.googlecode.javacpp.Loader.load(Loader.java:285)
at com.googlecode.javacv.cpp.videoInputLib.<clinit>(videoInputLib.java:80)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at com.googlecode.javacpp.Loader.load(Loader.java:305)
at com.googlecode.javacpp.Loader.load(Loader.java:285)
at com.googlecode.javacv.cpp.videoInputLib$videoInput.<clinit>(videoInputLib.java:192)
at com.googlecode.javacv.VideoInputFrameGrabber.start(VideoInputFrameGrabber.java:89)
at webcampong.Grabber.run(Grabber.java:35)
at java.lang.Thread.run(Thread.java:680)