0

我正在尝试研究如何使用 marvin 框架激活网络摄像头和捕获视频。我安装了 javacv 和 opencv,但我仍然遇到异常。我不知道这是否是由于 opencv 和 javacv 的版本问题或什么。希望你们能帮忙。

这是一个例外:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniopencv_core in java.library.path

还有这个消息:

SETUP: Setting up device 0
SETUP: HP Webcam
SETUP: Couldn't find preview pin using SmartTee
SETUP: Default Format is set to 640 by 360 
SETUP: trying requested format RGB24 @ 640 by 480
SETUP: Capture callback set
SETUP: Device is setup and ready to capture.

'

这是我的代码:

public class SimpleVideoTest extends JFrame implements Runnable{

private MarvinVideoInterface    videoAdapter;
private MarvinImage             image;
private MarvinImagePanel        videoPanel;

public SimpleVideoTest(){
    super("Simple Video Test");

    // Create the VideoAdapter and connect to the camera
    MarvinVideoInterface  videoAdapter = new MarvinJavaCVAdapter();
    try {
        videoAdapter.connect(0);
    } catch (MarvinVideoInterfaceException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    // Create VideoPanel
    videoPanel = new MarvinImagePanel();
    add(videoPanel);

    // Start the thread for requesting the video frames 
    new Thread(this).start();

    setSize(800,600);
    setVisible(true);
}

public static void main(String[] args) {
    SimpleVideoTest t = new SimpleVideoTest();
    t.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

 @Override
public void run() {
    while(true){
        // Request a video frame and set into the VideoPanel
        try {
            image = videoAdapter.getFrame();
        } catch (MarvinVideoInterfaceException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        videoPanel.setImage(image);
    }
}
4

1 回答 1

0

你究竟是如何启动你的java应用程序的?

openCV 有一个本地库(请参阅此文档,指的是 libopencv_java*.so/dll),该本地库需要位于您正在启动的 JVM 的类路径中。

有关如何的详细信息,请参阅这个类似的问题

于 2019-10-06T13:11:38.153 回答