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;