Tôi cần chụp một luồng video từ webcam USB của mình, vì tôi sử dụng Opencv 2.4.6 để phát triển trong Java. Tôi làm theo các bước được liệt kê trong hereOpenCV + Java = UnsatisfiedLinkError
Tôi thêm thư mục "C: \ opencv \ build \ java \ x64" vào Hệ thống PATH của tôi và bao gồm tệp "opencv-246.jar" vào thư viện của tôi trên ECLIPSE. Khi y chạy explame
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
public class Main {
public static void main(String[] args) {
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
Mat m = Mat.eye(3, 3, CvType.CV_8UC1);
System.out.println("m = " + m.dump());
}
}
tôi nhận được
m = [1, 0, 0;
0, 1, 0;
0, 0, 1]
OK =)
nhưng khi tôi chạy
import org.opencv.highgui.VideoCapture;
public class Main {
public static void main(String[] args) {
VideoCapture vc = new VideoCapture(0);
if(vc.isOpened()){
System.out.println("Works!");
}
}
}
tôi nhận được
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.opencv.highgui.VideoCapture.n_VideoCapture(I)J
at org.opencv.highgui.VideoCapture.n_VideoCapture(Native Method)
at org.opencv.highgui.VideoCapture.<init>(VideoCapture.java:113)
at Main.main(Main.java:5)
i thêm tất cả các tuyến đường containes trong:
C: \ OpenCV \ xây dựng \ x64 \ VC10
từng người một, nhưng doesn `t làm việc.
Cuối cùng tôi tạo một biến có tên OPENCV_DIR với C: \ opencv \ build \ x64 \ vc10 nhưng vẫn nhận được UnsatisfiedLinkError.
XIN VUI LÒNG GIÚP TÔI!
tĩnh {System.loadLibrary (Core.NATIVE_LIBRARY_NAME); } để đảm bảo nó được tải một lần .. –