我正在尝试使用opencv中的VideoCapture,但我有这个错误:
11-02 13:50:02.209 16755-16755/? W/System.err: java.lang.UnsatisfiedLinkError: Couldn't load opencv_java3 from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.opencv.samples.puzzle15-1.apk"],nativeLibraryDirectories=[/data/app-lib/org.opencv.samples.puzzle15-1, /vendor/lib, /system/lib, /system/lib/arm]]]: findLibrary returned null
11-02 13:50:02.209 16755-16755/? W/System.err: at java.lang.Runtime.loadLibrary(Runtime.java:358)
11-02 13:50:02.209 16755-16755/? W/System.err: at java.lang.System.loadLibrary(System.java:526)
11-02 13:50:02.209 16755-16755/? W/System.err: at org.opencv.android.StaticHelper.loadLibrary(StaticHelper.java:64)
11-02 13:50:02.209 16755-16755/? W/System.err: at org.opencv.android.StaticHelper.initOpenCVLibs(StaticHelper.java:95)
11-02 13:50:02.209 16755-16755/? W/System.err: at org.opencv.android.StaticHelper.initOpenCV(StaticHelper.java:39)
11-02 13:50:02.209 16755-16755/? W/System.err: at org.opencv.android.OpenCVLoader.initDebug(OpenCVLoader.java:72)
11-02 13:50:02.209 16755-16755/? W/System.err: at org.opencv.samples.puzzle15.Puzzle15Activity.onCreate(Puzzle15Activity.java:62)
11-02 13:50:02.209 16755-16755/? W/System.err: at android.app.Activity.performCreate(Activity.java:5231)
11-02 13:50:02.209 16755-16755/? W/System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
11-02 13:50:02.209 16755-16755/? W/System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2218)
11-02 13:50:02.209 16755-16755/? W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2304)
11-02 13:50:02.209 16755-16755/? W/System.err: at android.app.ActivityThread.access$900(ActivityThread.java:142)
11-02 13:50:02.209 16755-16755/? W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1255)
11-02 13:50:02.209 16755-16755/? W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
11-02 13:50:02.209 16755-16755/? W/System.err: at android.os.Looper.loop(Looper.java:149)
11-02 13:50:02.209 16755-16755/? W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5097)
11-02 13:50:02.209 16755-16755/? W/System.err: at java.lang.reflect.Method.invokeNative(Native Method)
11-02 13:50:02.209 16755-16755/? W/System.err: at java.lang.reflect.Method.invoke(Method.java:515)
11-02 13:50:02.209 16755-16755/? W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
11-02 13:50:02.209 16755-16755/? W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:610)
11-02 13:50:02.209 16755-16755/? W/System.err: at dalvik.system.NativeStart.main(Native Method)
目前我只是想创建VideoCapture,但它不起作用。这是我的代码 private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this){
@Override
public void onManagerConnected(int status) {
switch (status) {
case LoaderCallbackInterface.SUCCESS:
{
Log.i(TAG, "OpenCV loaded successfully");
/* Now enable camera view to start receiving frames */
mOpenCvCameraView.setOnTouchListener(Puzzle15Activity.this);
mOpenCvCameraView.enableView();
} break;
default:
{
super.onManagerConnected(status);
} break;
}
}
};
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
if (!OpenCVLoader.initDebug()) {
Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback);
}
VideoCapture cv=new VideoCapture();
}
我正在使用android studio和opencv 3.0.0。