我有用于拍摄快照的代码,但我遇到了“java.library.java中没有opencv_java”的问题。我已经尝试了opencv的所有方法(安装它,设置.dll文件,设置.so文件),但就像问题保持不变之前一样。
import org.opencv.core.*;
import org.opencv.highgui.Highgui;
import org.opencv.highgui.VideoCapture;
public class web
{
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();
}
}
现在我如何克服这个问题,我已经完成了NATIVE库路径
-Djava.library.path="C:\path to the .dll file"