java.lang.UnsatisfiedLinkError:org.opencv.core.Mat.n_Mat(III)J? [英] java.lang.UnsatisfiedLinkError: org.opencv.core.Mat.n_Mat(III)J?

查看:782
本文介绍了java.lang.UnsatisfiedLinkError:org.opencv.core.Mat.n_Mat(III)J?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图在树莓派中使用opencv,但是我根本无法使用它。我创建了一个新的eclipse项目,将其添加到OpenCV库中,并粘贴了一些超级简单的代码。

I've been trying to get opencv working inside of our raspberry pi, but I have not been able to get it working at all. I made a new eclipse project, added in the OpenCV library, and pasted in some super simple code.

import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;

public class Hello
{
   public static void main( String[] args )
   {
      System.loadLibrary( Core.NATIVE_LIBRARY_NAME );
      Mat mat = Mat.eye( 3, 3, CvType.CV_8UC1 );
      System.out.println( "mat = " + mat.dump() );
   }
}

但是我得到了错误:


java.lang.UnsatisfiedLinkError:org.opencv.core.Mat.n_Mat(III)J

java.lang.UnsatisfiedLinkError: org.opencv.core.Mat.n_Mat(III)J

是否有解决此错误的方法?我没主意。

Is there anyway to solve this error? I am out of ideas.

推荐答案

您收到的错误意味着尚未链接/加载本机OpenCV文件。

The error you are getting means that the native OpenCV file has not been linked/loaded.

  System.loadLibrary( Core.NATIVE_LIBRARY_NAME );

上面使用的代码行仅在指定的OpenCV本机文件位于内部时有效Java库路径。

The line of code above that you are using, will work only if the specified OpenCV native file resides inside the Java library path.

您确定其中存在OpenCV文件吗?我建议尝试通过提供完整路径来加载OpenCV本机,以查看问题所在。

Are you sure OpenCV files are there? I would suggest trying to load the OpenCV native by giving the full path, just to see where the problem lies.

System.load("fullPathTo/opencv.dll");

我还建议您看一下这篇文章,其中详细解释了所有这些内容。 https://stackoverflow.com/a/47718273/5165833

I would also recommend taking a look at this post which explains all these in detail. https://stackoverflow.com/a/47718273/5165833

这篇关于java.lang.UnsatisfiedLinkError:org.opencv.core.Mat.n_Mat(III)J?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆