Giter VIP home page Giter VIP logo

opencv-android's Introduction

opencv-android

OpenCV4Android, packaged as a .aar for direct use without depending on the stupid OpenCV Manager app.

Building an .aar of OpenCV-3.x.y for yourself

Building OpenCV-3.x.y for Android is actually quite simple, its just not obvious where to get the pieces and the OpenCV docs hard-sell the "OpenCV Manager" in favour of the better and easier direct integration approach.

Here's the steps I used to create my .aar:

  1. Download and extract the OpenCV4Android bundle
  2. Create a Library Project in Android Studio
  3. Copy the java source files from OpenCV4Android into src/main/java
  4. Drop the OpenCV native libraries into src/main/jniLibs
  5. Run the gradle build
  6. Et voila, .aar file

Using your glorious new .aar

Reference the maven repository you've deployed your .aar to, e.g. mine (which I can't stop you from using ;)) is:

allprojects {
  repositories {
    jcenter()
    maven {
       url  "http://dl.bintray.com/steveliles/maven" 
    }
  }
}

Include the .aar in your build.gradle file:

dependencies {
  compile 'org.opencv:OpenCV-Android:3.1.0'
}

Bootstrap OpenCV in your Java code:

import org.opencv.android.OpenCVLoader;

...

if (OpenCVLoader.initDebug()) {
  // do some opencv stuff
}

Optional but recommended: to keep the downloaded APK size to a minimum, build separate APK's per architecture (approx 10MB each vs 42MB for universal) by placing the following inside the 'android' gradle directive of your application's build.gradle:

splits {
  abi {
    enable true
    reset()
    include 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'mips', 'mips64', 'arm64-v8a'
    universalApk false
  }
}

Disclaimer: This project is simply my bundling of OpenCV as an Android Library. I am not otherwise involved in the OpenCV project, and all credit for the wonderful OpenCV library goes to the developers thereof.

opencv-android's People

Contributors

steveliles avatar

Watchers

Alexander Mayatsky avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.