How to use OpenCV in Android Studio
Create Alibraries
Folder underneath your project main directory. For example, if your project isOpenCVExamples
, you would create aOpenCVExamples/libraries
Folder.
Go To the location where you have the SDK "\OPENCV-2.4.8-ANDROID-SDK\SDK" Here you'll find The java
folder, rename it to opencv
.
Now create a file in the directory with the build.gradle
opencv
following contents
Apply Plugin: ' Android-library 'Buildscript{repositories{mavencentral() }Dependencies{Classpath' com.android.tools.build:gradle:0.9.+ ' }}Android{compilesdkversion +buildtoolsversion"19.0.1"Defaultconfig{minsdkversion8targetsdkversion +Versioncode2480Versionname"2.4.8" }sourcesets{Main{Manifest.Srcfile' Androidmanifest.xml 'Java.Srcdirs= [' src ']Resources.Srcdirs= [' src ']Res.Srcdirs= [' Res ']Aidl.Srcdirs= [' src '] } }}
Edit Your Settings.gradle file in your application ' s main directory and add this line:
include ': Libraries:opencv '
open module Settings then Choose Modules from the left-hand list, click on your application ' s Module, click O n the Dependencies tab, and click on the + button to add a new module dependency.
/li>
Choose Module dependency
. It would open a dialog with a list of modules to choose from; Select ": Libraries:opencv".
Create AjniLibs
Folder in the/app/src/main/
Location and copy the "the" folder with *.so files (Armeabi, ARMEABI-V7A, MIPS, x86) in thejniLibs
From the OpenCV SDK.
Click OK. Now everything do, go and enjoy with OpenCV.
or view this link: http://www.bubuko.com/infodetail-949520.html
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
How to use OpenCV in Android Studio