In May August this year, opencv 2.3.1 was released. although opencv has been known to support the Android platform since 2.2, it can still run on Android 2.3.1. in this version, we can use camera of Android or videocapture of opencv. most important APIs have been encapsulated into Java interfaces and can be directly called in Android. for example, imread, videocapture, And Mat. let's take a look at how to use opencv in Android.
1. Download JDK, Android SDK, Adt, and eclipse to configure the android development environment. Detailed steps are available on the developer website.
2. Download opencv-2.3.1-android-bin.tar.bz2 and decompress it. Android is relatively simple and does not need to be compiled by yourself.
3. Open eclipse, right-click package release E, and select import. select the extracted OpenCV-2.3.1-android-bin folder, there are two files ah OpenCV-2.3.1 and samples. the previous directory contains all implemented Java interfaces. It is a library project. the last directory is an example, which is simple, clear, and useful.
4. Select an example, such as face-detection, right-click build project, and load the compiled APK to your mobile phone.
5 if you use opencv in your android project, You Need To Do :( 1) Add the OpenCV-2.3.1 to the project, this project is a library by default, you can use it in other projects (2) in your own project, right-click and select "properties", select "android" in the pop-up window, and then "add ". then we can see opencv, which can be used after being added.
Although Android camera and opencv camera can be used, I personally think that android camera is better and more flexible to use. Users can easily set various attributes, such as video format, resolution, and frame rate, white Balance, exposure, etc. the camera class of Android allows you to set previewcallback. You can call the opencv API to process each frame of the image and display the result on the screen in real time.
From 2.2 to 2.3.1 is a huge leap for the Android version of opencv, and there is reason to believe that opencv will provide better support for Android in future versions. thanks to Android, opencv, and open source.