java - 线程中出现异常 "main"java.lang.UnsatisfiedLinkError : no jniopencv_core in java. library.path

标签 java opencv javacv marvin-framework

我正在尝试研究如何使用 marvin 框架激活网络摄像头并捕获视频。我安装了 javacv 和 opencv 但仍然出现异常。不知道是因为opencv和javacv版本的问题还是什么。 希望大家能帮忙。

这是一个异常(exception):

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);
    }
}

最佳答案

你到底是如何启动你的java应用程序的?

openCV 有一个原生库(参见 this doc ,指 libopencv_java*.so/dll) 该 native 库需要位于您要启动的 JVM 的类路径上。

参见this similar question详细了解如何操作

关于java - 线程中出现异常 "main"java.lang.UnsatisfiedLinkError : no jniopencv_core in java. library.path,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58257440/

相关文章:

java - 从 Android 手机上未完成的应用程序恢复源代码

java - 如何检查 Android 设备是否支持库?

opencv - 如何在 opencv 中使用 gpu::pyrdown?

opencv - 如何在OpenCV中对图像执行交叉加法

android - 在 OpenCV 中将 Mat 对象从 native 代码返回到 java

java - 有用还是浪费内存?

java - 自定义 View Canvas

c++ - 是什么导致 "OpenCV(4.0.1) Error : Assertion failed(m.dims <= 2)"

java - java 中的 openCV - 希望使用 split 方法。

java - 从 org.bytedeco.javacv.Frame 转换为 matlab 图像