[英]Exception in thread “main” java.lang.UnsatisfiedLinkError: no opencv_java2410 in java.library.path
i am trying to capture camera with opencv version 2410 but this exception appear although path is right 我正在尝试使用opencv版本2410捕获摄像机,但是尽管路径正确,也会出现此异常
iam try to open camera and capture video from camera but this exception appear iam尝试打开相机并从相机捕获视频,但出现此异常
iam searched in many sites but nothing same words iam在许多站点中搜索,但没有相同的单词
netbeans 8.0.2 netbeans 8.0.2
how can i solve it ? 我该如何解决?
output
Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java2410 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1119)
at videocap.VideoCap.main(VideoCap.java:20)
Java Result: 1
code here 这里的代码
VideoCap.java
package videocap;
import org.opencv.core.*;
import org.opencv.highgui.Highgui;
import org.opencv.highgui.VideoCapture;
public class VideoCap {
public static void main (String args[]){
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
VideoCapture camera = new VideoCapture(0);
if(!camera.isOpened()){
System.out.println("Error");
}
else {
Mat frame = new Mat();
while(true){
if (camera.read(frame)){
System.out.println("Frame Obtained");
System.out.println("Captured Frame Width " + frame.width() + " Height " + frame.height());
Highgui.imwrite("camera.jpg", frame);
System.out.println("OK");
break;
}
}
}
camera.release();
}
}
In order to include native library we need to add following steps in netbeans 为了包括本机库,我们需要在netbeans中添加以下步骤
==>Right click on the Project
==>Properties
==>Click on RUN
==>VM Options : -Djava.library.path="C:\Your Directory where Dll is present"
==>Ok
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.