Adding OpenCV Library in an Android Studio IDE
Posted By Bhriguraj Salponia | 29-Jun-2016
As per Wikipedia:
OpenCV (Open Source Computer Vision) is a library of programming functions mainly aimed at real-time computer vision, originally developed by Intel's research center in Russia, later supported by Willow Garage and now maintained by Itseez. The library is cross-platform and free for use under the open-source BSD license.
Step 1: Download the latest OpenCV Android SDK
Step 2: Create a new Android Studio project
Note: The minimal platform supported by OpenCV is Android 2.2 i.e..API 8
Step 3: Importing the Module
Once the project is successfully created click on File ->new ->Import Module and then select the unzipped OpenCV-android-sdk ->skd ->Java and click Next & ok.
Step 4: Adding Module Dependency
Go to File -> Project Structure & under Modules select app ->Dependecies ->Module Dependency, select the respective openCV library and click ok.
Step 5: Gradle changes
Now go to OpenCV build.gradle and set the compileSdkVersion, buildToolsVersion, minSdkVersion and targetSdkVersion same as in the app's build.gradle and we are done.