OpenCV on Android

There are two major types of OpenCV4Android beginners, the first group is new to Android, and the second – to OpenCV. We’ll try to provide some advice for both:

  1. If you’re an experienced OpenCV adept and you want to start with Android, you should remember, that Android is not desktop OS, you should prepare yourself for mobile development. We’re not aiming to teach you all about Android, so in case you’re not really familiar with the platform, you may consider consulting the official website for developers, or some short introduction like this one. At the same time, we’ve prepared a special “Introduction into Android Development” tutorial and a set of samples helping you to become familiar with Android specifics. What’s important, is that you can reuse your C++ desktop code. It’s even recommended to develop and debug your algorithms in familiar environment, using your PC and favorite IDE. Of course you have to keep efficiency in mind, but please avoid premature optimization. OpenCV was designed to be high-performance, so measure your actual performance before you start to worry. Keep in mind, that majority of modern mobile devices is surprisingly powerful.
  2. If you’re a confident Android developer, but you need some information on OpenCV, please have a look at the documentation and use the user-support resources if needed: forum and issue tracker. And do not forget to look into tutorials, they will help you to quickly understand what you can easily accomplish with OpenCV. Computer Vision field has a long history, but some problems are still unsolved. If you’re not sure if OpenCV could help you with your task, just ask your question at our forum, people there like to solve quirky problems.

How to start

OpenCV4Android is available as a SDK with a set of samples and Javadoc documentation for OpenCV Java API. It also contains prebuilt apk-files, which you can run on your device instantly. There are three OpenCV tutorials aimed to help you start:

  1. “Introduction into Android Development” would be useful for the absolute beginner, because it shows you how to setup Android development environment.
  2. “Android development with OpenCV” shows you how to add OpenCV functionality into your Android application. For those who want to reuse their C++ code, we’ve created a special section: “Native/C++”. We propose this way for the professional developers, since native development is a bit harder, but gives you larger opportunities. Tutorial 2 – Mixed Processing sample shows an example of wrapping a C++ call to Java.
  3. Deep learning is a key feature of many computer vision applications. Mobilenet-objdetect sample code and related article “How to run deep networks on Android device” shows DNN module usage on Android and allows to switch to custom DNN detector.

If you need additional information on OpenCV usage models, you can check this page.

Online resources

User Communities:

OpenCV4Android documentation:

Information on OpenCV:

3rd-party samples and tutorials:

Providing feedback

  1. You know, we love contributions, especially pull requests on the GitHub!
  2. If you think you’ve found a new bug, let’s double-check it:
  3. Please check that you use the latest version of OpenCV4Android.
  4. Please check the open “Android issues” on the tracker.
  5. Ask OpenCV community about your problem.
  6. If you’re still suspecting that you’re probably the first human who met such problem, let’s file a bug! Instructions are here.

Contacts

This page was last updated Feb 5th 2024.

Become a Member

Stay up to date on OpenCV and Computer Vision news