问题
How to integrate opencv in Android Studio? I am facing problem in importing and installing opencv library in android studio
回答1:
Install openCV in Android Studio Simple Steps:-(Indirect Method)
- Download/Install(Extract) OpenCV for Android (you might already have it)
Download :-here Documentation :- here
Version 2.4.11 is recommended. - Open you Android Project on Android Studio.
Import Module
(Files >> New >> Import Module)
Browse the path to the samples Folder inside OpenCV for Android Folder and Select any one of the Samples
eg :-OpenCV-2.4.11-android-sdk\OpenCV-android-sdk\samples\15-puzzle
While importing keep everything checked.
This will automatically add OpenCV Libraries Module to your project.
Now you can delete the 15-puzzle module (this is optional). - In the gradle file of your app add dependency :-
compile project(':openCVLibrary2411')
dependencies { compile project(':openCVLibrary2411') }
- Now you can Import openCV classes in your project
eg:-
import org.opencv.android.BaseLoaderCallback;
import org.opencv.android.LoaderCallbackInterface;
import org.opencv.android.OpenCVLoader;
来源:https://stackoverflow.com/questions/31144098/opencv-integration-in-android-studio-for-app-development