简体   繁体   中英

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

I'm trying to work on how to activate webcam and capture videos with marvin framework. i insalled javacv and opencv but i still get an exception. i don't know if it's due to a problem of versions of opencv and javacv or what. hope u guys can help.

Here's the exception:

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

and this message too:

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.

'

here's my code:

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

how exactly are you launching your java application?

openCV has a native library (see this doc , refers to libopencv_java*.so/dll) that native library needs to be on the classpath for the JVM you are launching.

see this similar question for details on how

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM