In December, we released OpenCV 4.9.0. As part of that release, we made Android builds available through the Maven Central repository for the first time. This work is supported by Arm company, the authors of the computer architecture on which Android and the world’s smartphones are built.
OpenCV is the open-source library for developing and deploying computer vision (CV) workloads. Its availability for Android will make it easier to develop and maintain CV applications for Android systems, lowering the barrier of entry for developers to build high-quality CV algorithms for supporting AI and image processing algorithms.
Managing your application’s OpenCV dependency through Maven Central is simple, with support built into Android Studio and many other tools. Doing so also enables you to easily keep up to date with bug fixes, new features, and performance improvements as new versions of OpenCV are released. The OpenCV team maintains source compatibility for releases, and the update is safe. Using Maven Central also ensures that you get a build of OpenCV configured correctly for performance and for using the correct dependencies.
We are working with Arm on continuous improvements to OpenCV’s performance across the broad reach of Arm-based devices, from sensors to servers and supercomputers. This includes leveraging improvements from algorithmic changes or using new Arm CPU features.
We will update Maven Central with the latest versions of OpenCV as they are released and continue to update our support for Android, ensuring that developers can integrate OpenCV into their workflows alongside other Android functionality.
We would like to thank Arm for supporting this work.
The OpenCV package will be downloaded and linked automatically by Gradle during the application build. Native libraries are also added to APK automatically. You just need to add a run-time call to load the OpenCV native part before the first library usage like this:
It is also possible to use OpenCV with your native code libraries in your Android application. The OpenCV AAR package includes a prefab part and allows developers to develop native parts for Android, too. The OpenCV tutorial Tutorial2-mixed processing provides an example of this.
In summary, as well as the normal Gradle steps outlined above, you must update your native code to link against the OpenCV libraries. In CMake, this can be done as follows:
Finally, as a reminder, the OpenCV package is available here:
https://central.sonatype.com/artifact/org.opencv/opencv.
OpenCV is an open-source project distributed with Apache 2.0 license. Feel free to contribute on GitHub!
I’m not a developer; what could I do? Donations are welcome!
If you need custom development and consulting in computer vision, feel free to leave a request at opencv.ai