返回
顶部

修改密码

How to Use OpenCV in Android Studio,opencvandroid

+1

-1

收藏

+1

-1

点赞0

评论0

How to Use OpenCV in Android Studio,opencvandroidHow to Use OpenCV in Android StudioCreate a libraries folder underneath your project main directory. For example, if your project is OpenCVExamples, you would create a OpenCVExamples/libraries folder.Go t…

How to Use OpenCV in Android Studio,opencvandroid

How to Use OpenCV in Android Studio
  • Create a libraries folder underneath your project main directory. For example, if your project is OpenCVExamples, you would create a OpenCVExamples/libraries folder.

  • Go to the location where you have SDK "\OpenCV-2.4.8-android-sdk\sdk" here you will find the java folder, rename it to opencv.

  • Now copy the complete opencv directory from the SDK into the libraries folder you just created.

  • Now create a build.gradle file in the opencv directory 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

    screen 1

  • Right click on your project then click on the Open Module Settings then 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.

    enter image description here

  • Choose Module dependency. It will open a dialog with a list of modules to choose from; select “:libraries:opencv”.

    enter image description here

  • Create a jniLibs folder in the /app/src/main/ location and copy the all the folder with *.so files (armeabi, armeabi-v7a, mips, x86) in the jniLibs from the OpenCV SDK.

    enter image description here

  • Click OK. Now everything done, go and enjoy with OpenCV.



  • 或查看此链接:http://www.bubuko.com/infodetail-949520.html

  • 版权声明:本文为博主原创文章,未经博主允许不得转载。

    http://www.bkjia.com/Androidjc/1052766.htmlwww.bkjia.comtruehttp://www.bkjia.com/Androidjc/1052766.htmlTechArticleHow to Use OpenCV in Android Studio,opencvandroid How to Use OpenCV in Android Studio Create a libraries folder underneath your project main directory. For example, if your proje...

    扫一扫在手机打开

    评论
    已有0条评论
    0/150
    提交
    热门评论
    相关推荐
    Get your hands on Android Studio 1.3,handsandroid
    • AndroidStudio
    • 2022-05-20 18:29
    • 9 0 0
    +1
    How to Use OpenCV in Android Studio,opencvandroid
    • AndroidStudio
    • 2022-05-20 18:29
    • 11 0 0
    +1
    Useful Android Studio Shortcuts
    • AndroidStudio
    • 2022-05-20 18:29
    • 5 0 0
    +1
    Android Studio tutorial for beginners
    • AndroidStudio
    • 2022-05-20 18:29
    • 11 0 0
    +1
    Android Studio: Simple webview setup
    • AndroidStudio
    • 2022-05-20 18:29
    • 7 0 0
    +1
    今日要闻
    换一批
    热点排行