Netbeans 中的 OpenCV 类路径
我刚刚开始在 MacOSX 下使用 JavaCV。我使用最新源代码的 CMake 编译了 OpenCV,并将库所在的路径放入 -Djava.library.path=\path\to\libraries
JVM 参数中,并在我的项目设置中添加了 JavaCV 库。我还尝试了类路径的其他几种变体。但是,当我启动一个简单的项目以从网络摄像头抓取一张图像时,我收到以下错误:
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)
i just started working with JavaCV under MacOSX. I compiled OpenCV with CMake from the latest source and put the path where the libraries are into the -Djava.library.path=\path\to\libraries
JVM Argument and added the JavaCV Libraries in my Project Settings. I also tried several other Variation of the Classpath. But when i launch an easy Project to just grab one image from my webcam i get following error:
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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是由于您的 openCV 和 javaCV 库的兼容性问题。
尝试下载兼容的 openCV 库(包含 bin 文件夹)。
It is due to the compatibility issue of your openCV and javaCV libraries.
Try to download compatible openCV libraries (containing bin folder).
VideoInputFrameGrabber 仅在 Windows 下工作。
如 JavaCV 的 README.txt 中所述:
videoInputLib
包装器和相应的VideoInputFrameGrabber
使用 DirectShow 进行捕获,在 Windows 7 下很有用,其中 OpenCV 和 FFmpeg 可能无法使用 Video for Windows 进行捕获(问题#58)VideoInputFrameGrabber works only under Windows.
As stated in JavaCV's README.txt:
videoInputLib
wrapper and correspondingVideoInputFrameGrabber
to capture using DirectShow, useful under Windows 7 where OpenCV and FFmpeg can fail to capture using Video for Windows (issue #58)我使用 javacpp 和 videoinput 来操作相机。当我调用“videoInput.listDevices()”时,出现错误“java.lang.UnsatisfiedLinkError:java.library.path 中没有 jnivideoInputLib”。
我通过添加如下代码来解决问题:
在调用其他方法之前必须先调用“Loader.load”,我不知道为什么。
I use javacpp and videoinput to manipulate cameras. I got the error 'java.lang.UnsatisfiedLinkError: no jnivideoInputLib in java.library.path' when I call 'videoInput.listDevices()'.
I fix the problem by adding codes like:
you must call 'Loader.load' first before you call other methods, I don't know why.