openCv 导入 android studio
2016-03-23 23:10
375 查看
这是我从国外网站上看到的配置教程,it works for me!
Follow the below steps to add Open CV in your project as library.
Create alibrariesfolder underneath your project main directory. For example, if your project is
OpenCVExamples, you would create a
OpenCVExamples/librariesfolder.
Go to the location where you have SDK "\OpenCV-2.4.8-android-sdk\sdk" here you will find the
javafolder, rename it to
opencv.
Now copy the complete opencv directory from the SDK into the libraries folder you just created.
Now create a
build.gradlefile in the
opencvdirectory with the following contents
apply plugin: 'android-library' buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } android { compileSdkVersion 19 buildToolsVersion "19.0.1" defaultConfig { minSdkVersion 8 targetSdkVersion 19 versionCode 2480 versionName "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'
Sync your project with Gradle and it should looks like this
![](http://i.stack.imgur.com/8Dcx9.png)
Right click on your project then click on the
Open Module Settingsthen Choose Modules from the left-hand list, click on your application’s module, click on the Dependencies tab, and click on the + button to add a new module dependency.
![](http://i.stack.imgur.com/A34Dx.png)
Choose
Module dependency. It will open a dialog with a list of modules to choose from; select “:libraries:opencv”.
![](http://i.stack.imgur.com/EnZNx.png)
Create a
jniLibsfolder in the
/app/src/main/location and copy the all the folder with *.so files (armeabi, armeabi-v7a, mips, x86) in the
jniLibsfrom the OpenCV SDK.
![](http://i.stack.imgur.com/ufun9.png)
Click OK. Now everything done, go and enjoy with OpenCV.
顺便附上视频教程
https://youtu.be/OTw_GIQNbD8
原文地址
http://stackoverflow.com/questions/17767557/how-to-use-opencv-in-android-studio-using-gradle-build-tool?lq=1
相关文章推荐
- python中使用OpenCV进行人脸检测的例子
- opencv 做人脸识别 opencv 人脸匹配分析
- 使用opencv拉伸图像扩大分辨率示例
- Android Studio注释模板介绍
- 基于C++实现kinect+opencv 获取深度及彩色数据
- OpenCV 2.4.3 C++ 平滑处理分析
- Python中使用OpenCV库来进行简单的气象学遥感影像计算
- 利用Python和OpenCV库将URL转换为OpenCV格式的方法
- python结合opencv实现人脸检测与跟踪
- Python环境搭建之OpenCV的步骤方法
- Python实现OpenCV的安装与使用示例
- 在树莓派2或树莓派B+上安装Python和OpenCV的教程
- opencv-python学习一--人脸检测
- 关于Android Studio 和 Gradle的那些事儿
- 收藏各种技术源码
- 在Ubuntu上安装OpenCV3.0和Python-openCV的经历
- OpenCV配置,从来没有这么简单!
- ubuntu下opencv和qt的安装配置
- OpenCV学习笔记(二十五)——OpenCV图形界面设计Qt+VS2008
- 分享一些OpenCV实现立体视觉的经验