1

可能重复:
UnsatisfiedLinkError 的原因是什么?

我是 Java 编程新手。我正在使用 javacv 和 opencv 进行面部识别。我在 linux 12.04 上使用 eclipse,带有 javacv-0.1 和 opencv-2.4.0.tar.bz2。

这是我一直在尝试的代码

import static com.googlecode.javacv.cpp.opencv_core.cvFlip;

import static com.googlecode.javacv.cpp.opencv_highgui.cvSaveImage;
import com.googlecode.javacv.CanvasFrame;
import com.googlecode.javacv.FrameGrabber;
import com.googlecode.javacv.VideoInputFrameGrabber;
import com.googlecode.javacv.cpp.opencv_core.IplImage;

public class Grabbershow implements Runnable {
//final int INTERVAL=1000;///you may use interval
IplImage image;
CanvasFrame canvas = new CanvasFrame("Web Cam");
public Grabbershow() {
    canvas.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
}
@Override
public void run() {
    FrameGrabber grabber = new VideoInputFrameGrabber(0); // 1 for next camera
    int i=0;
    try {
        grabber.start();
        IplImage img;
        while (true) {
            img = grabber.grab();
            if (img != null) {
                cvFlip(img, img, 1);// l-r = 90_degrees_steps_anti_clockwise
                cvSaveImage((i++)+"-aa.jpg", img);
                // show image on window
                canvas.showImage(img);
            }
             //Thread.sleep(INTERVAL);
        }
    } catch (Exception e) {
    }
}

我收到了这个错误

Exception in thread "Thread-1" java.lang.UnsatisfiedLinkError: no jnivideoInputLib in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1681)
    at java.lang.Runtime.loadLibrary0(Runtime.java:840)
    at java.lang.System.loadLibrary(System.java:1047)
    at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:444)
    at com.googlecode.javacpp.Loader.load(Loader.java:368)
    at com.googlecode.javacpp.Loader.load(Loader.java:315)
    at com.googlecode.javacv.cpp.videoInputLib.<clinit>(videoInputLib.java:81)
    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.javacpp.Loader.load(Loader.java:315)
    at com.googlecode.javacv.cpp.videoInputLib$videoInput.<clinit>(videoInputLib.java:193)
    at com.googlecode.javacv.VideoInputFrameGrabber.start(VideoInputFrameGrabber.java:96)
    at com.googlecode.javacv.VideoInputFrameGrabber.start(VideoInputFrameGrabber.java:93)
    at Grabbershow.run(Grabbershow.java:21)
    at java.lang.Thread.run(Thread.java:679)

我在论坛上阅读了一些答案,但我不理解它们并且无法解决这个问题。我需要你的帮助!我很绝望。

请帮我?

4

1 回答 1

1

This line appears at the top of your error log :

no jnivideoInputLib in java.library.path

Make sure that you have configured your environment correctly with the -Djava.library.path option.

于 2012-09-26T10:52:06.497 回答