Easy way to integrate OpenCV into your Android project via Gradle.
No NDK dependency needed - just include this library and you are good to go.
opencv:VERSION-contrib
opencv-contrib:VERSION
Each versions is available in only OpenCV as well as OpenCV with contributions.
4.4.0
‼️ Please use 4.5.3.0
instead of 4.5.3
. They are both the same versions, however, 4.5.3
has some runtime issues on some of the Android versions while 4.5.3.0
works fine.
Add mavenCentral
to your project's build.gradle
file's repositories section if not already present.
repositories {
mavenCentral()
}
Add either the normal or contributions version in the dependencies of your module.
// opencv
implementation `com.quickbirdstudios:opencv:VERSION`
// opencv with contributions
implementation `com.quickbirdstudios:opencv-contrib:VERSION`
}
if (!OpenCVLoader.initDebug())
Log.e("OpenCV", "Unable to load OpenCV!");
else
Log.d("OpenCV", "OpenCV loaded Successfully!");
opencv_VERSION
or opencv-contrib_VERSION
. Copy this folder to the project and keep it at the same level as the app
folder.settings.gradle
and replace the VERSION with the OpenCV version you have downloaded.
// Remove/comment out the one you aren't going to need
include ":opencv_VERSION"
include ":opencv-contrib_VERSION"
// Remove/comment out the one you aren't going to need
implementation(project(":opencv_VERSION"))
implementation(project(":opencv-contrib_VERSION"))
OpenCV Loaded Successfully
.In progress 👷