Application of opencv on Android platform

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.